SAP B40B_PO_CREATE Function Module for Create Purchase Order
B40B_PO_CREATE is a standard b40b 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 b40b po create FM, simply by entering the name B40B_PO_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: BBP_BD_DRIVER_40B
Program Name: SAPLBBP_BD_DRIVER_40B
Main Program: SAPLBBP_BD_DRIVER_40B
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function B40B_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 'B40B_PO_CREATE'"Create Purchase Order.
EXPORTING
PO_HEADER = "Übergabestrukur Anlegen - Bestellkopf
* PO_HEADER_ADD_DATA = "Übergabestruktur Bestellkopf-Zusatzdaten
* HEADER_ADD_DATA_RELEVANT = "
* PO_ADDRESS = "BAPI Übergabestruktur für Adressen
* SKIP_ITEMS_WITH_ERROR = "
* ITEM_ADD_DATA_RELEVANT = "
* LOGICAL_SYSTEM = "
* CUF_HEADER = "Customer Fields für Header
* IT_ATTACH_BE = "KW-Anlagen inkl. Dokument
IMPORTING
PURCHASEORDER = "Purchasing Document Number
TABLES
PO_ITEMS = "Übergabestruktur Anlegen/Listen - Bestellposition + ECI
* PO_SRV_ACCASS_VALUES = "Komm.struktur Anlege Kontierungsverteilung Leistungszeile
* PO_SERVICES_TEXT = "BAPI Leistungen Langtext
* POADDRDELIVERY = "Bestellposition: Adressenstruktur für Anlieferadresse
* CUF_ITEM = "Customer Fields für Item
* CUF_ACC = "Customer Fields für Accounting
CONTROL_RECORD = "
* PO_ITEM_ADD_DATA = "
PO_ITEM_SCHEDULES = "Übergabestruktur Anzeigen/Listen - Bestelleinteilung
* PO_ITEM_ACCOUNT_ASSIGNMENT = "Übergabestruktur Anzeigen - Bestellkontierung (BBP-BAPI)
* PO_ITEM_TEXT = "Übergabestruktur Anlegen - Bestellpositionstext
* RETURN = "
* PO_LIMITS = "Kommunikationsstruktur Limits
* PO_CONTRACT_LIMITS = "Kommunikationsstruktur Kontraktlimits
* PO_SERVICES = "Kommunikationsstruktur Anlegen Leistungszeile
IMPORTING Parameters details for B40B_PO_CREATE
PO_HEADER - Übergabestrukur Anlegen - Bestellkopf
Data type: BBPS_BAPIEKKOCOptional: No
Call by Reference: No ( called with pass by value option)
PO_HEADER_ADD_DATA - Übergabestruktur Bestellkopf-Zusatzdaten
Data type: BBPS_BAPIEKKOAOptional: Yes
Call by Reference: No ( called with pass by value option)
HEADER_ADD_DATA_RELEVANT -
Data type: BAPIMMPARA-SELECTIONOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_ADDRESS - BAPI Übergabestruktur für Adressen
Data type: BBPS_BAPIADDRESSOptional: Yes
Call by Reference: No ( called with pass by value option)
SKIP_ITEMS_WITH_ERROR -
Data type: BAPIMMPARA-SELECTIONOptional: Yes
Call by Reference: No ( called with pass by value option)
ITEM_ADD_DATA_RELEVANT -
Data type: BAPIMMPARA-SELECTIONOptional: Yes
Call by Reference: No ( called with pass by value option)
LOGICAL_SYSTEM -
Data type: BBP_BACKEND_DEST-LOG_SYSOptional: Yes
Call by Reference: No ( called with pass by value option)
CUF_HEADER - Customer Fields für Header
Data type: BBPS_CUF_HEADEROptional: Yes
Call by Reference: No ( called with pass by value option)
IT_ATTACH_BE - KW-Anlagen inkl. Dokument
Data type: BBPT_PD_ATTACH_BEOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for B40B_PO_CREATE
PURCHASEORDER - Purchasing Document Number
Data type: BBPS_BAPIEKKOC-PO_NUMBEROptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for B40B_PO_CREATE
PO_ITEMS - Übergabestruktur Anlegen/Listen - Bestellposition + ECI
Data type: BAPIEKPOC_ECIOptional: No
Call by Reference: Yes
PO_SRV_ACCASS_VALUES - Komm.struktur Anlege Kontierungsverteilung Leistungszeile
Data type: BBPS_BAPIESKLCOptional: Yes
Call by Reference: Yes
PO_SERVICES_TEXT - BAPI Leistungen Langtext
Data type: BBPS_BAPIESLLTXOptional: Yes
Call by Reference: Yes
POADDRDELIVERY - Bestellposition: Adressenstruktur für Anlieferadresse
Data type: BBPS_POADDRDELIVERY_46Optional: Yes
Call by Reference: Yes
CUF_ITEM - Customer Fields für Item
Data type: BBPS_CUF_ITEMOptional: Yes
Call by Reference: Yes
CUF_ACC - Customer Fields für Accounting
Data type: BBPS_CUF_ACCOptional: Yes
Call by Reference: Yes
CONTROL_RECORD -
Data type: BBP_CONTROL_RECORDOptional: No
Call by Reference: Yes
PO_ITEM_ADD_DATA -
Data type: BBP_BAPIEKPOAOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_ITEM_SCHEDULES - Übergabestruktur Anzeigen/Listen - Bestelleinteilung
Data type: BBPS_BAPIEKETOptional: No
Call by Reference: Yes
PO_ITEM_ACCOUNT_ASSIGNMENT - Übergabestruktur Anzeigen - Bestellkontierung (BBP-BAPI)
Data type: BBP_BAPIEKKNOptional: Yes
Call by Reference: Yes
PO_ITEM_TEXT - Übergabestruktur Anlegen - Bestellpositionstext
Data type: BBPS_BAPIEKPOTXOptional: Yes
Call by Reference: Yes
RETURN -
Data type: BAPIRETURNOptional: Yes
Call by Reference: No ( called with pass by value option)
PO_LIMITS - Kommunikationsstruktur Limits
Data type: BBPS_BAPIESUHCOptional: Yes
Call by Reference: Yes
PO_CONTRACT_LIMITS - Kommunikationsstruktur Kontraktlimits
Data type: BBPS_BAPIESUCCOptional: Yes
Call by Reference: Yes
PO_SERVICES - Kommunikationsstruktur Anlegen Leistungszeile
Data type: BAPIESLLC_ECIOptional: Yes
Call by Reference: Yes
Copy and paste ABAP code example for B40B_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_ECI, " | |||
| lv_po_header | TYPE BBPS_BAPIEKKOC, " | |||
| lv_purchaseorder | TYPE BBPS_BAPIEKKOC-PO_NUMBER, " | |||
| lt_po_srv_accass_values | TYPE STANDARD TABLE OF BBPS_BAPIESKLC, " | |||
| lt_po_services_text | TYPE STANDARD TABLE OF BBPS_BAPIESLLTX, " | |||
| lt_poaddrdelivery | TYPE STANDARD TABLE OF BBPS_POADDRDELIVERY_46, " | |||
| lt_cuf_item | TYPE STANDARD TABLE OF BBPS_CUF_ITEM, " | |||
| lt_cuf_acc | TYPE STANDARD TABLE OF BBPS_CUF_ACC, " | |||
| lt_control_record | TYPE STANDARD TABLE OF BBP_CONTROL_RECORD, " | |||
| lt_po_item_add_data | TYPE STANDARD TABLE OF BBP_BAPIEKPOA, " | |||
| lv_po_header_add_data | TYPE BBPS_BAPIEKKOA, " | |||
| lt_po_item_schedules | TYPE STANDARD TABLE OF BBPS_BAPIEKET, " | |||
| lv_header_add_data_relevant | TYPE BAPIMMPARA-SELECTION, " | |||
| lv_po_address | TYPE BBPS_BAPIADDRESS, " | |||
| lt_po_item_account_assignment | TYPE STANDARD TABLE OF BBP_BAPIEKKN, " | |||
| lt_po_item_text | TYPE STANDARD TABLE OF BBPS_BAPIEKPOTX, " | |||
| lv_skip_items_with_error | TYPE BAPIMMPARA-SELECTION, " | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRETURN, " | |||
| lv_item_add_data_relevant | TYPE BAPIMMPARA-SELECTION, " | |||
| lt_po_limits | TYPE STANDARD TABLE OF BBPS_BAPIESUHC, " | |||
| lv_logical_system | TYPE BBP_BACKEND_DEST-LOG_SYS, " | |||
| lv_cuf_header | TYPE BBPS_CUF_HEADER, " | |||
| lt_po_contract_limits | TYPE STANDARD TABLE OF BBPS_BAPIESUCC, " | |||
| lt_po_services | TYPE STANDARD TABLE OF BAPIESLLC_ECI, " | |||
| lv_it_attach_be | TYPE BBPT_PD_ATTACH_BE. " |
|   CALL FUNCTION 'B40B_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 | |
| LOGICAL_SYSTEM | = lv_logical_system | |
| CUF_HEADER | = lv_cuf_header | |
| IT_ATTACH_BE | = lv_it_attach_be | |
| 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 | |
| POADDRDELIVERY | = lt_poaddrdelivery | |
| CUF_ITEM | = lt_cuf_item | |
| CUF_ACC | = lt_cuf_acc | |
| CONTROL_RECORD | = lt_control_record | |
| 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 | |
| . " B40B_PO_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM B40B_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 BBPS_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). | ||||
| "SELECT single SELECTION FROM BAPIMMPARA INTO @DATA(ld_item_add_data_relevant). | ||||
| "SELECT single LOG_SYS FROM BBP_BACKEND_DEST INTO @DATA(ld_logical_system). | ||||
Search for further information about these or an SAP related objects