‎2010 Jan 13 4:18 PM
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
‎2010 Jan 13 4:37 PM
Hello Chirag,
please try to supply the fields REFNUMBER and OBJECTKEY for the SAVE-Method (same as @ CREATE), too.
Regards,
Alej
‎2010 Jan 13 4:43 PM
HI,
Still it did not work. It only saves the last processed order relationship and not the previous ones.
Thanks,
C
‎2010 Jan 14 2:58 PM
Hi,
Above logic works fine. It was the code before this, was giving me the trouble.
Thanks,
C