04-26-2015 1:03 PM
Hello All,
I am trying to add a PM02 operation to an existing order and release the order using the BAPI_ALM_ORDER_MAINTAIN. I have added the below lines of code while calling the BAPI. BAPI runs successfully yet ,neither is the operation added nor order is released.Could you please help me with this.
lwa_methods-refnumber = '000001'.
lwa_methods-objecttype = 'OPERATION'.
lwa_methods-method = 'CREATE'."'CREATE'.
CONCATENATE l_aufnr l_vornr INTO lwa_methods-objectkey.
APPEND lwa_methods TO it_methods_rel.
CLEAR lwa_methods.
lwa_methods-refnumber = '000001'.
lwa_methods-objecttype = 'COMPONENT'.
lwa_methods-method = 'CREATE'.
CONCATENATE l_aufnr '0010' INTO lwa_methods-objectkey.
*** lwa_methods-objectkey = l_init_ordid .
APPEND lwa_methods TO it_methods_rel.
CLEAR lwa_methods.
lwa_methods-refnumber = '000001'.
lwa_methods-objecttype = ' '.
lwa_methods-method = 'SAVE'.
lwa_methods-objectkey = l_aufnr .
APPEND lwa_methods TO it_methods_rel.
CLEAR lwa_methods.
lwa_methods-refnumber = '000001'.
lwa_methods-objecttype = 'HEADER'.
lwa_methods-method = 'RELEASE'.
lwa_methods-objectkey = l_aufnr.
APPEND lwa_methods TO it_methods_rel.
CLEAR lwa_methods.
*
*
lwa_methods-refnumber = '000001'.
lwa_methods-objecttype = ' '.
lwa_methods-method = 'SAVE'.
lwa_methods-objectkey = l_aufnr .
APPEND lwa_methods TO it_methods_rel.
CLEAR lwa_methods.
Thanks,
Prakrita Kapoor.
04-26-2015 2:21 PM
Hello Prakrita,
In my view this FM is a difficult one. I remember the following code worked for me for adding an operation. you may develop other requirements if it is useful. (Later I opted for BDCDATA through SHDB recording for operation addition into the Order).
IT_METHODS-REFNUMBER = '000001'.
IT_METHODS-OBJECTTYPE = 'OPERATION'.
IT_METHODS-METHOD = 'CREATE'.
IT_METHODS-OBJECTKEY = P_AUFNR.
APPEND IT_METHODS.
IT_METHODS-OBJECTTYPE = ''.
IT_METHODS-METHOD = 'SAVE'.
APPEND IT_METHODS.
IT_OPERATION-ACTIVITY = P_VORNR.
IT_OPERATION-CONTROL_KEY = 'BSP1'.
IT_OPERATION-WORK_CNTR = P_ARBPL.
IT_OPERATION-PLANT = P_WERKS.
IT_OPERATION-DESCRIPTION = P_LTXA1.
IT_OPERATION-LANGU = 'E'.
APPEND IT_OPERATION.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
IT_METHODS = IT_METHODS
IT_OPERATION = IT_OPERATION
RETURN = RETURN
ET_NUMBERS = ET_NUMBERS .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
Other fm is IBAPI_ORDER_OPERATION_CREATE , looks good but I could never succeed in testing through SE37 itself.
You may have more clues from this discussion
Good luck
KJogeswaraRao
04-27-2015 4:12 AM
Hello Prakrita Kapoor.
Did you write BAPI_TRANSACTION_COMMIT after your BAPI?
Regards.
04-27-2015 5:04 AM