‎2010 Aug 11 8:10 PM
Hi All,
I am tryin to use a BAPI to update the contract and for this I have coded the following:
v_ponumber = 'abc-123' .
MOVE v_ponumber TO poheader2-number.
MOVE 'X' TO poheaderx-number.
MOVE '00001' TO po_item2-ITEM_NO.
MOVE 'test text' TO po_item2-SHORT_TEXT.
APPEND po_item2.
MOVE '00001' TO po_item2_x-ITEM_NO.
MOVE 'X' TO po_item2_x-ITEM_NOX.
MOVE 'X' TO po_item2_x-SHORT_TEXT.
APPEND po_item2_x.
CALL FUNCTION 'BAPI_CONTRACT_CHANGE'
EXPORTING
PURCHASINGDOCUMENT = v_ponumber
HEADER = poheader2
HEADERX = poheaderx
TABLES
ITEM = po_item2
ITEMX = po_item2_x
RETURN = return2
.
if sy-subrc = 0.
commit work.
endif.in the return table I am getting the message which says that the contract has been updated but I went to see the contract was actually not updated.... any advise where I am missing?
Thanks,
Rajat
‎2010 Aug 11 8:17 PM
I am not sure why it is not working?? Try for any other alternate function modules.
But i see one issue with your coding, always check the return table message type and use commit work, instead of sy-subrc check. This fails for BAPI's
‎2010 Aug 11 9:02 PM
Thanks for the reply Vijay, I was using that commit work just for the testing purposes, I will use BAPI_TRANSACTION_COMMIT to do the actual commit.
Thnaks,
Rajat
‎2010 Aug 11 9:06 PM