You are on page 1of 14

Purchase Order using BAPI

Create Purchase Order Using BAPI

Prepared By- Harwinder Singh

Prepared By- Harwinder Singh


Purchase Order using BAPI

Creating PO using BAPI_PO_CREATE1

Many times, we need to use BAPI to create Purchase Orders (PO). The need to use BAPI
for PO creation arises when businesses want to automate PO creation or SAP is
interfaced with a third-party application. When creating a PO we have BAPI’s
like BAPI_PO_CREATE1 and BAPI_PO_CREATE, for amending a PO we have
BAPI_PO_CHANGE. For these BAPIs to work the minimum required data has to be
provided. This document focuses on PO creation using BAPI BAPI_PO_CREATE1 & hopes
to be useful to those who are new to using BAPIs.

The BAPI is designed to populate various data which is used during PO creation. The
data needs to be filled in different tables created in
BAPI. POHEADER, POITEM, POADDRDELIVERY, POSCHEDULE, POACCOUNT, etc are
among the tables in the BAPI. We need to fill data in these tables as per requirement.
The minimum information required to create a PO is to populate below tables:

– POHEADER

– POHEADERX

– POITEM

– POITEMX

– POSCHEDULE

– POSCHEDULEX

Apart from these, different other tables can be used as required, for example POCOND
for entering conditions or POCOMPONENTS for entering components in a subcontracting
PO.

Prepared By- Harwinder Singh


Purchase Order using BAPI

– POHEADER

In POHEADER, we need to enter details such as Company Code, DOC_TYPE, VENDOR,


PMNTTRMS (Payment Terms), PURCH_ORG, PUR_GROUP, CURRENCY, INCOTERMS1,
INCOTERMS2. Apart from these additional details can be provided such as
CREAT_DATE, CREATED_BY, DOWNPAY_TYPE (Down payment type),
DOWNPAY_AMOUNT, etc.

– POITEM

In POITEM, we need to enter details such as PO_ITEM (Item No), MATERIAL, PLANT,
STGE_LOC, QUANTITY, NET_PRICE, TAX_CODE, FUNDS_CTR (Funds Center). Additional
information such as ACCTASSCAT, ITEM_CAT (In case of special procurement, this is
mandatory), AGREEMENT (Contract) etc can be entered.

– POSCHEDULE

In POSCHEDULE, we need to enter details such as PO_ITEM, SCHED_LINE,


DELIVERY_DATE, QUANTITY. Additional details can be entered as required.

In case conditions are required to be maintained, then populate the POCOND table with
details such as ITM_NUMBER (PO Item No), COND_TYPE, COND_VALUE, CALCTYPCON
(Calculation Type), CHANGE_ID (I for inserting new condition, U for updating existing
condition & D for deleting).

We need to set the indicator in the corresponding change parameter table for each of
the fields in every table where we are passing the data. for example, once we have
populated data in the POHEADER table, then the same fields need to be set in the
POHEADERX table. similarly, in all the change parameter tables (POITEMX,
POSCHEDULEX, POCONDX), indicators have to be set for each field where we want to
populate the data.

Please note: Once the BAPI_PO_CREATE1 is executed, to commit the changes, another
BAPI – BAPI_TRANSACTION_COMMIT needs to be executed simultaneously, there in
the WAIT field we can put the value as X.

Prepared By- Harwinder Singh


Purchase Order using BAPI

STEPS TO CREATE A PURCHASE ORDER USING BAPI


▪ Goto BAPI Transaction Code
▪ Goto Materials Management – Purchasing – Purchase Order –
CreateFromData1(Function module)
▪ Put the values in POHEADER, POHEADERX and POITEM, POITEMX
▪ Goto SE37 Transaction code
▪ Click on Function Module – Execute – Test Sequences
▪ Enter BAPI_PO_CREATE1 And BAPI_TRANSACTION_COMMIT
Function Module and Execute it
▪ Goto – Test Data Directory
▪ Select your Test Data and Execute it
▪ Goto to ME22N to check if PO is successfully created

Prepared By- Harwinder Singh


Purchase Order using BAPI

1. Goto BAPI Transaction Code


2. Goto Materials Management – Purchasing – Purchase Order –
CreateFromData1(Function module) or directly go to SE37- Function
builder
3. Click on Test/Execute Icon

Prepared By- Harwinder Singh


Purchase Order using BAPI

4. Put the values in POHEADER, POHEADERX, POITEM and POITEMX


5. Select POHEADER

6. Click on the highlighted icon to get the fields in a single entry

Prepared By- Harwinder Singh


Purchase Order using BAPI

7. Select PO header Mandatory fields


• COMPANY CODE
• DOC_TYPE
• VENDOR
• PURCHASE ORGANIZATION
• PURCHASE GROUP

Prepared By- Harwinder Singh


Purchase Order using BAPI

8. Put X in the fields you want to use.

Prepared By- Harwinder Singh


Purchase Order using BAPI

9. Select POITEM
10. Enter the values in the fields

Prepared By- Harwinder Singh


Purchase Order using BAPI

11. Goto POITEMX


12. Put X in the fields you want to use.
13. Save the Test data

Prepared By- Harwinder Singh


Purchase Order using BAPI

14. Goto SE37 Transaction code


15. Click on Function Module – Execute – Test Sequences
16. Enter BAPI_PO_CREATE1 And BAPI_TRANSACTION_COMMIT
Function Module
17. Execute it

Prepared By- Harwinder Singh


Purchase Order using BAPI

18. After Executing it will redirect to the Test Function Module window
19. Select Goto – Test Data Directory
20. Select your Test Data

21. Click on Execute


22. BAPI_PO_CREATE1 was successfully executed

Prepared By- Harwinder Singh


Purchase Order using BAPI

23. Go back and Execute again


24. A Return value is 000 means BAPI_TRANSACTION_COMMIT is
successfully executed without error and PO is created

Prepared By- Harwinder Singh


Purchase Order using BAPI

25. Goto ME22N Transaction code


26. Purchase order is successfully created

Thanks for your attention

Prepared By- Harwinder Singh

You might also like