Application Development and Automation 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: 
Read only

BAPI_ALM_ORDER_MAINTAIN - SAVE method

Former Member
0 Likes
1,720

Hi All,

I am using BAPI BAPI_ALM_ORDER_MAINTAIN to update multiple orders.

below is the pseudo code:

loop at order_Data.

wa_methods-refnumber = 1. "sy-tabix.

wa_methods-objecttype = 'RELATION'.

wa_methods-method = 'CREATE'.

wa_methods-objectkey = w_objectkey.

APPEND wa_methods TO t_methods.

CLEAR wa_methods.

wa_methods-method = 'SAVE'.

APPEND wa_methods TO t_methods.

wa_relation-order_predecessor = wa_zordrelseq-relorder.

wa_relation-operation_predecessor = wa_zordrelseq-reloropac.

wa_relation-order_successor = wa_zordrelseq-preorder.

wa_relation-operation_successor = wa_zordrelseq-ordopac.

wa_relation-relation_type = wa_zordrelseq-relortype.

APPEND wa_relation TO t_relation.

wa_relation_up-order_predecessor = 'X'.

wa_relation_up-operation_predecessor = 'X'.

wa_relation_up-order_successor = 'X'.

wa_relation_up-operation_successor = 'X'.

wa_relation_up-relation_type = 'X'.

APPEND wa_relation_up TO t_relation_up.

**--Create new relationship for the order

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

it_methods = t_methods

it_relation = t_relation

it_relation_up = t_relation_up

return = t_return.

if success.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

else.

endif.

endloop.

-


The problem is that even if the BAPI successfully updates orders, the commit to database is not working.

E.g

I have 3 order records in the table and i will update these 3 orders one by one. It will give success messages however do not update in database. Can you please advise a way out to make it work to save in database?

Thanks

3 REPLIES 3
Read only

alejiandro_sensejl
Active Participant
0 Likes
897

Hello Chirag,

please try to supply the fields REFNUMBER and OBJECTKEY for the SAVE-Method (same as @ CREATE), too.

Regards,

Alej

Read only

Former Member
0 Likes
897

HI,

Still it did not work. It only saves the last processed order relationship and not the previous ones.

Thanks,

C

Read only

Former Member
0 Likes
897

Hi,

Above logic works fine. It was the code before this, was giving me the trouble.

Thanks,

C