SAP Function Modules

B45A_PO_CREATE SAP Function module - Create purchase order







B45A_PO_CREATE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name B45A_PO_CREATE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: BBP_BD_DRIVER_45A
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM B45A_PO_CREATE - B45A PO CREATE





CALL FUNCTION 'B45A_PO_CREATE' "Create purchase order
  EXPORTING
    po_header =                 " bbps_bapiekkoc  Übergabestrukur Anlegen - Bestellkopf
*   po_header_add_data =        " bbps_bapiekkoa  Übergabestruktur Bestellkopf-Zusatzdaten
*   header_add_data_relevant =   " bapimmpara-selection
*   po_address =                " bbps_bapiaddress  BAPI Übergabestruktur für Adressen
*   skip_items_with_error = 'x'  " bapimmpara-selection
*   item_add_data_relevant =    " bapimmpara-selection
*   logical_system =            " bbp_backend_dest-log_sys
*   cuf_header =                " bbps_cuf_header  Customer Fields für Header
*   it_attach_be =              " bbpt_pd_attach_be  KW-Anlagen inkl. Dokument
  IMPORTING
    purchaseorder =             " bbps_bapiekkoc-po_number  Purchasing Document Number
  TABLES
    po_items =                  " bapiekpoc_eci  Übergabestruktur Anlegen/Listen - Bestellposition + ECI
*   po_item_add_data =          " bbp_bapiekpoa
    po_item_schedules =         " bbps_bapieket  Übergabestruktur Anzeigen/Listen - Bestelleinteilung
*   po_item_account_assignment =   " bbp_bapiekkn  Übergabestruktur Anzeigen - Bestellkontierung (BBP-BAPI)
*   po_item_text =              " bbps_bapiekpotx  Übergabestruktur Anlegen - Bestellpositionstext
*   return =                    " bapireturn
*   po_limits =                 " bbps_bapiesuhc  Kommunikationsstruktur Limits
*   po_contract_limits =        " bbps_bapiesucc  Kommunikationsstruktur Kontraktlimits
*   po_services =               " bapiesllc_eci  Kommunikationsstruktur Anlegen Leistungszeile
*   po_srv_accass_values =      " bbps_bapiesklc  Komm.struktur Anlege Kontierungsverteilung Leistungszeile
*   po_services_text =          " bbps_bapieslltx  BAPI Leistungen Langtext
*   poaddrdelivery =            " bbps_poaddrdelivery_46  Bestellposition: Adressenstruktur für Anlieferadresse
*   cuf_item =                  " bbps_cuf_item  Customer Fields für Item
*   cuf_acc =                   " bbps_cuf_acc  Customer Fields für Accounting
    control_record =            " bbp_control_record
    .  "  B45A_PO_CREATE

ABAP code example for Function Module B45A_PO_CREATE





The ABAP code below is a full code listing to execute function module B45A_PO_CREATE including all data declarations. The code uses 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 original method of declaring data variables up front. 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).

DATA:
ld_purchaseorder  TYPE BBPS_BAPIEKKOC-PO_NUMBER ,
it_po_items  TYPE STANDARD TABLE OF BAPIEKPOC_ECI,"TABLES PARAM
wa_po_items  LIKE LINE OF it_po_items ,
it_po_item_add_data  TYPE STANDARD TABLE OF BBP_BAPIEKPOA,"TABLES PARAM
wa_po_item_add_data  LIKE LINE OF it_po_item_add_data ,
it_po_item_schedules  TYPE STANDARD TABLE OF BBPS_BAPIEKET,"TABLES PARAM
wa_po_item_schedules  LIKE LINE OF it_po_item_schedules ,
it_po_item_account_assignment  TYPE STANDARD TABLE OF BBP_BAPIEKKN,"TABLES PARAM
wa_po_item_account_assignment  LIKE LINE OF it_po_item_account_assignment ,
it_po_item_text  TYPE STANDARD TABLE OF BBPS_BAPIEKPOTX,"TABLES PARAM
wa_po_item_text  LIKE LINE OF it_po_item_text ,
it_return  TYPE STANDARD TABLE OF BAPIRETURN,"TABLES PARAM
wa_return  LIKE LINE OF it_return ,
it_po_limits  TYPE STANDARD TABLE OF BBPS_BAPIESUHC,"TABLES PARAM
wa_po_limits  LIKE LINE OF it_po_limits ,
it_po_contract_limits  TYPE STANDARD TABLE OF BBPS_BAPIESUCC,"TABLES PARAM
wa_po_contract_limits  LIKE LINE OF it_po_contract_limits ,
it_po_services  TYPE STANDARD TABLE OF BAPIESLLC_ECI,"TABLES PARAM
wa_po_services  LIKE LINE OF it_po_services ,
it_po_srv_accass_values  TYPE STANDARD TABLE OF BBPS_BAPIESKLC,"TABLES PARAM
wa_po_srv_accass_values  LIKE LINE OF it_po_srv_accass_values ,
it_po_services_text  TYPE STANDARD TABLE OF BBPS_BAPIESLLTX,"TABLES PARAM
wa_po_services_text  LIKE LINE OF it_po_services_text ,
it_poaddrdelivery  TYPE STANDARD TABLE OF BBPS_POADDRDELIVERY_46,"TABLES PARAM
wa_poaddrdelivery  LIKE LINE OF it_poaddrdelivery ,
it_cuf_item  TYPE STANDARD TABLE OF BBPS_CUF_ITEM,"TABLES PARAM
wa_cuf_item  LIKE LINE OF it_cuf_item ,
it_cuf_acc  TYPE STANDARD TABLE OF BBPS_CUF_ACC,"TABLES PARAM
wa_cuf_acc  LIKE LINE OF it_cuf_acc ,
it_control_record  TYPE STANDARD TABLE OF BBP_CONTROL_RECORD,"TABLES PARAM
wa_control_record  LIKE LINE OF it_control_record .

DATA(ld_po_header) = 'Check type of data required'.
DATA(ld_po_header_add_data) = 'Check type of data required'.

DATA(ld_header_add_data_relevant) = some text here
DATA(ld_po_address) = 'Check type of data required'.

DATA(ld_skip_items_with_error) = some text here

DATA(ld_item_add_data_relevant) = some text here

SELECT single LOG_SYS
FROM BBP_BACKEND_DEST
INTO @DATA(ld_logical_system).

DATA(ld_cuf_header) = 'Check type of data required'.
DATA(ld_it_attach_be) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_po_items to it_po_items.

"populate fields of struture and append to itab
append wa_po_item_add_data to it_po_item_add_data.

"populate fields of struture and append to itab
append wa_po_item_schedules to it_po_item_schedules.

"populate fields of struture and append to itab
append wa_po_item_account_assignment to it_po_item_account_assignment.

"populate fields of struture and append to itab
append wa_po_item_text to it_po_item_text.

"populate fields of struture and append to itab
append wa_return to it_return.

"populate fields of struture and append to itab
append wa_po_limits to it_po_limits.

"populate fields of struture and append to itab
append wa_po_contract_limits to it_po_contract_limits.

"populate fields of struture and append to itab
append wa_po_services to it_po_services.

"populate fields of struture and append to itab
append wa_po_srv_accass_values to it_po_srv_accass_values.

"populate fields of struture and append to itab
append wa_po_services_text to it_po_services_text.

"populate fields of struture and append to itab
append wa_poaddrdelivery to it_poaddrdelivery.

"populate fields of struture and append to itab
append wa_cuf_item to it_cuf_item.

"populate fields of struture and append to itab
append wa_cuf_acc to it_cuf_acc.

"populate fields of struture and append to itab
append wa_control_record to it_control_record. . CALL FUNCTION 'B45A_PO_CREATE' EXPORTING po_header = ld_po_header * po_header_add_data = ld_po_header_add_data * header_add_data_relevant = ld_header_add_data_relevant * po_address = ld_po_address * skip_items_with_error = ld_skip_items_with_error * item_add_data_relevant = ld_item_add_data_relevant * logical_system = ld_logical_system * cuf_header = ld_cuf_header * it_attach_be = ld_it_attach_be IMPORTING purchaseorder = ld_purchaseorder TABLES po_items = it_po_items * po_item_add_data = it_po_item_add_data po_item_schedules = it_po_item_schedules * po_item_account_assignment = it_po_item_account_assignment * po_item_text = it_po_item_text * return = it_return * po_limits = it_po_limits * po_contract_limits = it_po_contract_limits * po_services = it_po_services * po_srv_accass_values = it_po_srv_accass_values * po_services_text = it_po_services_text * poaddrdelivery = it_poaddrdelivery * cuf_item = it_cuf_item * cuf_acc = it_cuf_acc control_record = it_control_record . " B45A_PO_CREATE
IF SY-SUBRC EQ 0. "All OK ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_purchaseorder  TYPE BBPS_BAPIEKKOC-PO_NUMBER ,
ld_po_header  TYPE BBPS_BAPIEKKOC ,
it_po_items  TYPE STANDARD TABLE OF BAPIEKPOC_ECI ,
wa_po_items  LIKE LINE OF it_po_items,
ld_po_header_add_data  TYPE BBPS_BAPIEKKOA ,
it_po_item_add_data  TYPE STANDARD TABLE OF BBP_BAPIEKPOA ,
wa_po_item_add_data  LIKE LINE OF it_po_item_add_data,
it_po_item_schedules  TYPE STANDARD TABLE OF BBPS_BAPIEKET ,
wa_po_item_schedules  LIKE LINE OF it_po_item_schedules,
ld_header_add_data_relevant  TYPE BAPIMMPARA-SELECTION ,
ld_po_address  TYPE BBPS_BAPIADDRESS ,
it_po_item_account_assignment  TYPE STANDARD TABLE OF BBP_BAPIEKKN ,
wa_po_item_account_assignment  LIKE LINE OF it_po_item_account_assignment,
ld_skip_items_with_error  TYPE BAPIMMPARA-SELECTION ,
it_po_item_text  TYPE STANDARD TABLE OF BBPS_BAPIEKPOTX ,
wa_po_item_text  LIKE LINE OF it_po_item_text,
ld_item_add_data_relevant  TYPE BAPIMMPARA-SELECTION ,
it_return  TYPE STANDARD TABLE OF BAPIRETURN ,
wa_return  LIKE LINE OF it_return,
ld_logical_system  TYPE BBP_BACKEND_DEST-LOG_SYS ,
it_po_limits  TYPE STANDARD TABLE OF BBPS_BAPIESUHC ,
wa_po_limits  LIKE LINE OF it_po_limits,
ld_cuf_header  TYPE BBPS_CUF_HEADER ,
it_po_contract_limits  TYPE STANDARD TABLE OF BBPS_BAPIESUCC ,
wa_po_contract_limits  LIKE LINE OF it_po_contract_limits,
ld_it_attach_be  TYPE BBPT_PD_ATTACH_BE ,
it_po_services  TYPE STANDARD TABLE OF BAPIESLLC_ECI ,
wa_po_services  LIKE LINE OF it_po_services,
it_po_srv_accass_values  TYPE STANDARD TABLE OF BBPS_BAPIESKLC ,
wa_po_srv_accass_values  LIKE LINE OF it_po_srv_accass_values,
it_po_services_text  TYPE STANDARD TABLE OF BBPS_BAPIESLLTX ,
wa_po_services_text  LIKE LINE OF it_po_services_text,
it_poaddrdelivery  TYPE STANDARD TABLE OF BBPS_POADDRDELIVERY_46 ,
wa_poaddrdelivery  LIKE LINE OF it_poaddrdelivery,
it_cuf_item  TYPE STANDARD TABLE OF BBPS_CUF_ITEM ,
wa_cuf_item  LIKE LINE OF it_cuf_item,
it_cuf_acc  TYPE STANDARD TABLE OF BBPS_CUF_ACC ,
wa_cuf_acc  LIKE LINE OF it_cuf_acc,
it_control_record  TYPE STANDARD TABLE OF BBP_CONTROL_RECORD ,
wa_control_record  LIKE LINE OF it_control_record.

ld_po_header = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_po_items to it_po_items.
ld_po_header_add_data = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_po_item_add_data to it_po_item_add_data.

"populate fields of struture and append to itab
append wa_po_item_schedules to it_po_item_schedules.

ld_header_add_data_relevant = some text here
ld_po_address = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_po_item_account_assignment to it_po_item_account_assignment.

ld_skip_items_with_error = some text here

"populate fields of struture and append to itab
append wa_po_item_text to it_po_item_text.

ld_item_add_data_relevant = some text here

"populate fields of struture and append to itab
append wa_return to it_return.

SELECT single LOG_SYS
FROM BBP_BACKEND_DEST
INTO ld_logical_system.


"populate fields of struture and append to itab
append wa_po_limits to it_po_limits.
ld_cuf_header = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_po_contract_limits to it_po_contract_limits.
ld_it_attach_be = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_po_services to it_po_services.

"populate fields of struture and append to itab
append wa_po_srv_accass_values to it_po_srv_accass_values.

"populate fields of struture and append to itab
append wa_po_services_text to it_po_services_text.

"populate fields of struture and append to itab
append wa_poaddrdelivery to it_poaddrdelivery.

"populate fields of struture and append to itab
append wa_cuf_item to it_cuf_item.

"populate fields of struture and append to itab
append wa_cuf_acc to it_cuf_acc.

"populate fields of struture and append to itab
append wa_control_record to it_control_record.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name B45A_PO_CREATE or its description.