Posted: Thu Sep 20, 2007 11:01 am Post subject: BAPI_PO_CHANGE
BAPI_PO_CHANGE - Change purchase order
Functionality
You can use this method to change Enjoy purchase orders.
Code:
PARAMETERS: p_ebeln LIKE ekko-ebeln OBLIGATORY.
PARAMETERS: p_ebelp LIKE ekpo-ebelp OBLIGATORY.
DATA: t_item LIKE bapimepoitem OCCURS 0 WITH HEADER LINE.
DATA: t_itemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: t_return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA i_list LIKE i_listado OCCURS 0 WITH HEADER LINE.
DATA : t_bapi_poheader LIKE bapimepoheader OCCURS 0 WITH HEADER LINE,
t_bapi_poheaderx LIKE bapimepoheaderx OCCURS 0
WITH HEADER LINE,
t_bapi_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
t_bapi_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE,
t_bapireturn LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
LOOP AT i_listado INTO i_list WHERE check = 'X'.
APPEND i_list.
ENDLOOP.
AT END OF ebeln.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = i_listado-ebeln
* poheader = t_bapi_poheader
* poheaderx = t_bapi_poheaderx
TABLES
return = t_bapireturn
poitem = t_bapi_poitem
poitemx = t_bapi_poitemx.
READ TABLE t_bapireturn WITH KEY type = 'E'.
IF sy-subrc NE 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
READ TABLE t_bapireturn WITH KEY type = 'S'.
LOOP AT i_listado WHERE check = 'X'
AND ebeln = i_list-ebeln.
i_listado-message = t_bapireturn-message.
MODIFY i_listado.
ENDLOOP.
ELSE.
LOOP AT i_listado WHERE check = 'X'
AND ebeln = i_list-ebeln.
i_listado-message = t_bapireturn-message.
MODIFY i_listado.
ENDLOOP.
ENDIF.
ENDAT.
ENDLOOP.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.