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

Creating a PO Using BAPI For Multiple PLants Or Multiple Line Items

Former Member
0 Likes
1,219

Hi All

Can you please suggest me how to create a Purchase Order Using BAPI_PO_Create1 for Multiple Plants Or for Multiple Line items. The Requirement is like the PO is for single material for single vendor but for mulple stores i.e plants

NOte: Suggest me the Creation of PO for MUltiple Line items or for multiple plants Using BAPI . Hope you people will give me the needful.

Regards

Shivakumar Bandari

Hi All

Can you please suggest me how to create a Purchase Order Using BAPI_PO_Create1 for Multiple Plants Or for Multiple Line items. The Requirement is like the PO is for single material for single vendor but for mulple stores i.e plants

NOte: Suggest me the Creation of PO for MUltiple Line items or for multiple plants Using BAPI . Hope you people will give me the needful.

Regards

Shivakumar Bandari

1 REPLY 1
Read only

Former Member
0 Likes
579

Hi,

Here is the sample code to do that...

*---> po header data

wa_poheader-vendor = your vendor..

wa_poheader-doc_type = Your doc type..check with Functional contact....

wa_poheader-purch_org = Purchasing Org..

wa_poheader-pur_group = Purchasing Group

*---> po header data (change toolbar)

wa_poheaderx-vendor = 'X'.

wa_poheaderx-doc_type = 'X'.

wa_poheaderx-purch_org = 'X'.

wa_poheaderx-pur_group = 'X'.

*---> poitem data

data: item like ekpo-ebelp.

item = '0010'.

loop at t_parts.

it_poitem-po_item = '00010'.

IT_POITEM-PLANT = Plant..

IT_POITEM-STGE_LOC = Sloc...

*---> poitemx (item data change toolbar)

it_poitemx-po_item = '0010'.

it_poitemx-po_itemx = 'X'.

IT_POITEMX-PLANT = 'X'.

IT_POITEMX-STGE_LOC = 'X'.

*---> add record's to internal table

APPEND: it_poitem,

it_poitemx.

endloop.

*call bapi_po_create1

CLEAR v_ebeln.

CALL FUNCTION 'BAPI_PO_CREATE1'

EXPORTING

poheader = wa_poheader

poheaderx = wa_poheaderx

IMPORTING

exppurchaseorder = v_ebeln

TABLES

return = it_return

poitem = it_poitem

poitemx = it_poitemx.

*---> check the return table for error message

READ TABLE it_return WITH KEY type = 'E'.

IF sy-subrc NE 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

endif.

Thanks,

Murali