Creating Material PO using BAPI_PO_CREATE1
Many a 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 BAPI’s to work the minimum required data has to be provided. This document focuses on PO creation using BAPI BAPI_PO_CREATE1 & hopes to serve useful to those who are new in 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 requires to populate below tables:
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.
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.
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.
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 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 POHEADER table, then the same fields needs to be set in 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 value as X.