SAP BAPI_PO_CREATE Function Module for Create Purchase Order
BAPI_PO_CREATE is a standard bapi po create SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Create Purchase Order processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for bapi po create FM, simply by entering the name BAPI_PO_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: MEWP
Program Name: SAPLMEWP
Main Program: SAPLMEWP
Appliation area: M
Release date: 17-Sep-1997
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function BAPI_PO_CREATE pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'BAPI_PO_CREATE'"Create Purchase Order.
EXPORTING
PO_HEADER = "PO Header Data
* PO_HEADER_ADD_DATA = "Additional Data: PO Header
* HEADER_ADD_DATA_RELEVANT = "Indicator: Additional Data (Header) Relevant
* PO_ADDRESS = "Ordering Address for One-Time Vendor
* SKIP_ITEMS_WITH_ERROR = 'X' "Indicator: Skip Faulty Items
* ITEM_ADD_DATA_RELEVANT = "Indicator: Additional Data (Item) Relevant
* HEADER_TECH_FIELDS = "Technical Header Fields
IMPORTING
PURCHASEORDER = "Purchase Order Number
TABLES
PO_ITEMS = "Table of PO Items
* PO_SRV_ACCASS_VALUES = "Value/Link to Service Account Assignment
* PO_SERVICES_TEXT = "Text for Service Line
* PO_BUSINESS_PARTNER = "Partner Roles
* EXTENSIONIN = "Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
* POADDRDELIVERY = "PO Item: Address Structure BAPIADDR1 for Inbound Delivery
* PO_ITEM_ADD_DATA = "Additional Data: PO Item
PO_ITEM_SCHEDULES = "Table of Schedule Lines
* PO_ITEM_ACCOUNT_ASSIGNMENT = "Table of Account Assignments
* PO_ITEM_TEXT = "Table of Item Texts
* RETURN = "Return Messages
* PO_LIMITS = "Limits
* PO_CONTRACT_LIMITS = "Limits with Contract Reference
* PO_SERVICES = "Services
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLMEWP_001 Customer Exit for Object Determination (Procurement via Catalogs)
EXIT_SAPLMEWP_002 Customer Exit: Creation of Purchase Order via BAPI_PO_CREATE
EXIT_SAPLMEWP_003 Customer Exit to Determine Allowed Catalogs
IMPORTING Parameters details for BAPI_PO_CREATE
PO_HEADER - PO Header Data
Data type: BAPIEKKOCOptional: No
Call by Reference: No ( called with pass by value option)
PO_HEADER_ADD_DATA - Additional Data: PO Header
Data type: BAPIEKKOAOptional: Yes
Call by Reference: No ( called with pass by value option)
HEADER_ADD_DATA_RELEVANT - Indicator: Additional Data (Header) Relevant
Data type: BAPIMMPARA-SELECTIONOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_ADDRESS - Ordering Address for One-Time Vendor
Data type: BAPIADDRESSOptional: Yes
Call by Reference: No ( called with pass by value option)
SKIP_ITEMS_WITH_ERROR - Indicator: Skip Faulty Items
Data type: BAPIMMPARA-SELECTIONDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
ITEM_ADD_DATA_RELEVANT - Indicator: Additional Data (Item) Relevant
Data type: BAPIMMPARA-SELECTIONOptional: Yes
Call by Reference: No ( called with pass by value option)
HEADER_TECH_FIELDS - Technical Header Fields
Data type: BAPITECHOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for BAPI_PO_CREATE
PURCHASEORDER - Purchase Order Number
Data type: BAPIEKKOC-PO_NUMBEROptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for BAPI_PO_CREATE
PO_ITEMS - Table of PO Items
Data type: BAPIEKPOCOptional: No
Call by Reference: No ( called with pass by value option)
PO_SRV_ACCASS_VALUES - Value/Link to Service Account Assignment
Data type: BAPIESKLCOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_SERVICES_TEXT - Text for Service Line
Data type: BAPIESLLTXOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_BUSINESS_PARTNER - Partner Roles
Data type: BAPIEKKOPOptional: Yes
Call by Reference: No ( called with pass by value option)
EXTENSIONIN - Reference Structure for BAPI Parameters EXTENSIONIN/EXTENSIONOUT
Data type: BAPIPAREXOptional: Yes
Call by Reference: Yes
POADDRDELIVERY - PO Item: Address Structure BAPIADDR1 for Inbound Delivery
Data type: BAPIMEPOADDRDELIVERYOptional: Yes
Call by Reference: Yes
PO_ITEM_ADD_DATA - Additional Data: PO Item
Data type: BAPIEKPOAOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_ITEM_SCHEDULES - Table of Schedule Lines
Data type: BAPIEKETOptional: No
Call by Reference: No ( called with pass by value option)
PO_ITEM_ACCOUNT_ASSIGNMENT - Table of Account Assignments
Data type: BAPIEKKNOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_ITEM_TEXT - Table of Item Texts
Data type: BAPIEKPOTXOptional: Yes
Call by Reference: No ( called with pass by value option)
RETURN - Return Messages
Data type: BAPIRETURNOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_LIMITS - Limits
Data type: BAPIESUHCOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_CONTRACT_LIMITS - Limits with Contract Reference
Data type: BAPIESUCCOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_SERVICES - Services
Data type: BAPIESLLCOptional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for BAPI_PO_CREATE Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lt_po_items | TYPE STANDARD TABLE OF BAPIEKPOC, " | |||
| lv_po_header | TYPE BAPIEKKOC, " | |||
| lv_purchaseorder | TYPE BAPIEKKOC-PO_NUMBER, " | |||
| lt_po_srv_accass_values | TYPE STANDARD TABLE OF BAPIESKLC, " | |||
| lt_po_services_text | TYPE STANDARD TABLE OF BAPIESLLTX, " | |||
| lt_po_business_partner | TYPE STANDARD TABLE OF BAPIEKKOP, " | |||
| lt_extensionin | TYPE STANDARD TABLE OF BAPIPAREX, " | |||
| lt_poaddrdelivery | TYPE STANDARD TABLE OF BAPIMEPOADDRDELIVERY, " | |||
| lt_po_item_add_data | TYPE STANDARD TABLE OF BAPIEKPOA, " | |||
| lv_po_header_add_data | TYPE BAPIEKKOA, " | |||
| lt_po_item_schedules | TYPE STANDARD TABLE OF BAPIEKET, " | |||
| lv_header_add_data_relevant | TYPE BAPIMMPARA-SELECTION, " | |||
| lv_po_address | TYPE BAPIADDRESS, " | |||
| lt_po_item_account_assignment | TYPE STANDARD TABLE OF BAPIEKKN, " | |||
| lt_po_item_text | TYPE STANDARD TABLE OF BAPIEKPOTX, " | |||
| lv_skip_items_with_error | TYPE BAPIMMPARA-SELECTION, " 'X' | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRETURN, " | |||
| lv_item_add_data_relevant | TYPE BAPIMMPARA-SELECTION, " | |||
| lt_po_limits | TYPE STANDARD TABLE OF BAPIESUHC, " | |||
| lv_header_tech_fields | TYPE BAPITECH, " | |||
| lt_po_contract_limits | TYPE STANDARD TABLE OF BAPIESUCC, " | |||
| lt_po_services | TYPE STANDARD TABLE OF BAPIESLLC. " |
|   CALL FUNCTION 'BAPI_PO_CREATE' "Create Purchase Order |
| EXPORTING | ||
| PO_HEADER | = lv_po_header | |
| PO_HEADER_ADD_DATA | = lv_po_header_add_data | |
| HEADER_ADD_DATA_RELEVANT | = lv_header_add_data_relevant | |
| PO_ADDRESS | = lv_po_address | |
| SKIP_ITEMS_WITH_ERROR | = lv_skip_items_with_error | |
| ITEM_ADD_DATA_RELEVANT | = lv_item_add_data_relevant | |
| HEADER_TECH_FIELDS | = lv_header_tech_fields | |
| IMPORTING | ||
| PURCHASEORDER | = lv_purchaseorder | |
| TABLES | ||
| PO_ITEMS | = lt_po_items | |
| PO_SRV_ACCASS_VALUES | = lt_po_srv_accass_values | |
| PO_SERVICES_TEXT | = lt_po_services_text | |
| PO_BUSINESS_PARTNER | = lt_po_business_partner | |
| EXTENSIONIN | = lt_extensionin | |
| POADDRDELIVERY | = lt_poaddrdelivery | |
| PO_ITEM_ADD_DATA | = lt_po_item_add_data | |
| PO_ITEM_SCHEDULES | = lt_po_item_schedules | |
| PO_ITEM_ACCOUNT_ASSIGNMENT | = lt_po_item_account_assignment | |
| PO_ITEM_TEXT | = lt_po_item_text | |
| RETURN | = lt_return | |
| PO_LIMITS | = lt_po_limits | |
| PO_CONTRACT_LIMITS | = lt_po_contract_limits | |
| PO_SERVICES | = lt_po_services | |
| . " BAPI_PO_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM BAPI_PO_CREATE
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single PO_NUMBER FROM BAPIEKKOC INTO @DATA(ld_purchaseorder). | ||||
| "SELECT single SELECTION FROM BAPIMMPARA INTO @DATA(ld_header_add_data_relevant). | ||||
| "SELECT single SELECTION FROM BAPIMMPARA INTO @DATA(ld_skip_items_with_error). | ||||
| DATA(ld_skip_items_with_error) | = 'X'. | |||
| "SELECT single SELECTION FROM BAPIMMPARA INTO @DATA(ld_item_add_data_relevant). | ||||
Search for further information about these or an SAP related objects