Page 1 of 1

IBAPI_ALM_ORDERSRULE_CHANGE update production order settleme

PostPosted: Thu Oct 26, 2017 4:43 pm
by stjacqd
Hello guys

I need to update the quantity of the settlement in the production order.
Tcode CO02 - Header - Settlement rule

I neeed to update the quantity of the items.

The IBAPI_ALM_ORDERSRULE_CHANGE should do it but I continuously failing to use it.
Code: Select all
  DATA: ls_COBL     TYPE BAPI_ALM_ORDER_COBL,
            ls_COBL_UP  TYPE COBL_IBAPI_UPDATE,
            ls_CAUFVD   TYPE CAUFVD,
            ls_AFVGD    TYPE AFVGD,
            lt_PS_MESSAGES          TYPE PS_MESSAGES.

  SELECT SINGLE plnbez INTO @DATA(lv_matnr)
                FROM afko
              WHERE aufnr = '000000501483'.  " Production order number

  SELECT SINGLE objnp INTO @DATA(lv_objnp)
                FROM afpo WHERE aufnr = '000000501483'   " Production order number
                                     AND matnr = @lv_matnr.

  SELECT SINGLE * INTO CORRESPONDING FIELDS OF ls_cobl
                FROM cobrb
              WHERE rec_objnr1 = lv_objnp.

  ls_cobl-AQZIF = 0.          " Change quantity to 0
  ls_cobl_up-AQZIF = 'X'.   " Update this field

  ls_caufvd-objnr = ls_cobl-objnr.
  CALL FUNCTION 'IBAPI_ALM_ORDERSRULE_CHANGE'
    EXPORTING
      is_cobl                       = ls_cobl
      is_cobl_up                  = ls_cobl_up
      is_caufvd                     = ls_caufvd
*     IS_AFVGD                      =
   IMPORTING
     ET_MESSAGES                   = lt_PS_MESSAGES
   EXCEPTIONS
    ERROR_CHANGING_SRULE          = 1
    ERROR_READING_SRULE           = 2
     MANDATORY_FIELD_MISSING       = 3
     OTHERS                        = 4


The function always ending with the error message: Log not found (in main memory)

Performing some debugging, the function IBAPI_EINZELREGVERPROBEN_KOBS is the one that is returning the error message.

We can see the note 1471675 has been implemented. But the perform gt_cobra_buf_get is generating the error.

I just need to update the quantity of the settlement.

All suggestion will be highly appreciated.

Regards