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

Transaction problem in using multiple bapis

Former Member
0 Likes
734

Hello,

I am trying to update/cancel the Sales order by giving the reason of rejection . I m using bapi_salesorder_change for this .

Before that i need to delete respective po item . I am using BBP_PO_Delete for this . But as a whole this transaction wont be complete .

BBP_PO_Delete will directly set deletion indicatior in po item and then i can change So for reaon of rejection. But in case of error, still po item remaind deleted . I tried to set an indicatior through BAPI_PO_Change and then use bapi_salesorder_change . But its still saying that delete po item first .

what may be the correct approch . i am passing deletion indication as L in bapi_po_change .

how can i set delete indicator to po item and then update so item .

Thanks

6 REPLIES 6
Read only

Former Member
0 Likes
673

Hi

Deletion Indicator should be D not L. Please pass the indicator as D in BAPI_PO_CHANGE and try the sales order change.

This will work fine. Let me know still you face any problem.

Read only

0 Likes
673

still not working . please check my inputs . for pO

POITEM-PO_ITEM = PO_INPUT-PO_ITEM.

POITEM-DELETE_IND = 'D'.

APPEND POITEM.

CLEAR POITEM.

POITEMX-PO_ITEM = PO_INPUT-PO_ITEM.

POITEMX-PO_ITEMX = 'X'.

POITEMX-DELETE_IND = 'X'.

APPEND POITEMX.

CLEAR POITEMX.

For So its , ORDER_ITEM-ITM_NUMBER = SO_INPUT-SALES_ORDER_ITEM_NO.

ORDER_ITEM-REASON_REJ = SO_INPUT-REJ_REASON .

APPEND ORDER_ITEM.

CLEAR ORDER_ITEM.

ORDER_ITEMX-ITM_NUMBER = SO_INPUT-SALES_ORDER_ITEM_NO.

ORDER_ITEMX-UPDATEFLAG = 'U'.

ORDER_ITEMX-REASON_REJ ='X' .

APPEND ORDER_ITEMX.

CLEAR ORDER_ITEMX.

CALL FUNCTION 'BAPI_PO_CHANGE'

EXPORTING

PURCHASEORDER = PO_INPUT-PO_NUMBER

  • POHEADER =

  • POHEADERX =

TABLES

RETURN = IT_RETURN

POITEM = POITEM

POITEMX = POITEMX .

CALL FUNCTION 'BAPI_SALESORDER_CHANGE'

EXPORTING

SALESDOCUMENT = IT_REL-VBELN

  • ORDER_HEADER_IN = ORDER_HEADER_IN

ORDER_HEADER_INX = ORDER_HEADER_INX

TABLES

RETURN = IT_RETURN

ORDER_ITEM_IN = ORDER_ITEM

ORDER_ITEM_INX = ORDER_ITEMX.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

please let me know if its correct . getting error as Delete purchase order 4500001321, item 00010

Read only

0 Likes
673

Hi

Give the BAPI_TRANSACTION_COMMIT after BAPI_PO_CHANGE and try.

Read only

0 Likes
673

since i want it as transaction, i need commit in the last .

Read only

Former Member
0 Likes
673

Hi

Use FMs BAPI_TRANSACTION_COMMIT and BAPI_TRANSACTION_ROLLBACK in your program.

This will remove your transaction problem.

If you still have any doubts then revert back.

Regards

Krathi

Read only

0 Likes
673

BBP_PO_Delete is already have its internal commit, and so saving it .

if i put rollback after so updation is failed, still Po will be saved and marked for deletion .