Monday, April 20, 2020

BAPI_PO_CHANGE delivery complete indicator in SAP ABAP.


BAPI_PO_CHANGE delivery complete indicator in SAP ABAP.

Some time we get required to change PO status .This time we can use below program it helps you to change the status of PO. 


Code :::
DATA: xreturn  like BAPIRET2      occurs 0 with header line,
           xpoitem  like BAPIMEPOITEM  occurs 0 with header line,
           xpoitemx like BAPIMEPOITEMX occurs 0 with header line.

xpoitem-po_item = p_ebelp.  " set position here
xpoitem-no_more_gr = 'X'.
append xpoitem.
xpoitemx-po_item = p_ebelp. " set position here
xpoitemx-no_more_gr = 'X'.
append xpoitemx.

CALL FUNCTION 'BAPI_PO_CHANGE'
     EXPORTING
              purchaseorder    = p_ebeln "set ebeln here
     TABLES
              return           = xreturn
              poitem           = xpoitem
              poitemx          = xpoitemx.
if sy-subrc = 0.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
       EXPORTING WAIT = 'X'.
endif.

No comments:

Post a Comment