11-10-2016 6:56 AM
Hi,
I am getting Error while create Work order Using BAPI BAPI_ALM_ORDER_MAINTAIN for some of standard order types(PM01). This is only for first operation (0010).
Is it any configuration related error??
Error : " Enter another operation "
Here is my logic :
wa_methods-refnumber = lv_refno.
wa_methods-objecttype = 'OPERATION'.
Wa_methods-method = 'CREATE'.
APPEND wa_methods TO it_methods.
Please help to get it resolve.
Thanks in advance.
11-10-2016 7:14 AM
11-10-2016 7:58 AM
Hi Nic,
Here is the code
wa_methods-method = 'CREATE'.
wa_methods-objectkey = orderid.
wa_methods-refnumber = '000001'.
wa_methods-objecttype = 'HEADER'.
APPEND wa_methods TO it_methods.
***** Heade Data
**** Operation Data
lv_refno1 = '000001'.
LOOP AT wo_operation INTO ls_operation.
lv_refno = lv_refno + lv_refno1.
wa_methods-refnumber = lv_refno.
wa_methods-objecttype = 'OPERATION'.
***************************************** This is working if i put CHANGE, But While create how it is considering CHANGE??
IF ls_operation-activity = '0010'.
IF wo_header-ordertype EQ 'PM01'.
wa_methods-method = 'CHANGE'.
ELSE.
wa_methods-method = 'CREATE'.
ENDIF.
ELSE.
wa_methods-method = 'CREATE'.
ENDIF.
******************************************
CONCATENATE orderid wa_operation-activity INTO wa_methods-objectkey.
APPEND wa_methods TO it_methods.
ENDLOOP.
wa_methods-refnumber = ''.
wa_methods-objecttype = ''.
wa_methods-method = 'SAVE'.
wa_methods-objectkey = orderid.
APPEND wa_methods TO it_methods. CLEAR wa_methods.
CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'
TABLES
it_methods = it_methods
it_header = it_header
it_header_up = it_header_up
it_operation = it_operation
it_operation_up = it_operation_up
return = return
et_numbers = et_numbers.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
If I put CHANGE in methods for PM01 it is working. But we don't want the hard coded value in code. It should be configuration based.
What could be the configuration based on order type.
Thank you.
11-10-2016 9:44 AM