Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_ALM_ORDER_MAINTAIN : Enter another operation error while create Workorder

Former Member
0 Kudos

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.

3 REPLIES 3

NTeunckens
Active Contributor
0 Kudos

Can you provide more code?

This could determine a lack of data in the BAPI-Structures for the OrderHeader / OrderOperation / Methods ...

0 Kudos

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.

NTeunckens
Active Contributor
0 Kudos

I see in this code-sample the following :

lv_refno = lv_refno + lv_refno1.

I do believe you should keep the same Refnr.? Will this help?

(Please try to use the 'CODE'-button to indent your CodeSample ...)