Skip to Content
0

IBAPI_ALM_ORDERSRULE_CHANGE a;ways ending in error

Oct 26, 2017 at 09:51 PM

40

avatar image

Hello everyone

I need to update the quantity of the production order settlment.

Based on my research it should be done with IBAPI_ALM_ORDERSRULE_CHANGE.

Unfortunately the function always end with the error message:

Log not found (in main memory).

How can we make this function work? Or is their any other BAPI to update the settlement quantities?

I did a little demo program to try it.

  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'
                       AND matnr = @lv_matnr.

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

  ls_cobl-AQZIF = 0.       " Settlment qty
  ls_cobl_up-AQZIF = 'X'.  

  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
            .

  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers