Professional Documents
Culture Documents
Input Parameters:
Output Parameters:
You can call this BAPI in your ABAP program or using an external system to create a PO in SAP. Make
sure to pass the necessary input parameters with correct values to create a valid PO.
Here's an example code snippet for using the BAPI_PO_CREATE1 to create a purchase order in SAP:
```
ls_poheader-doc_type = 'NB'.
ls_poheader-vendor = '10000001'.
ls_poheader-purch_org = '1000'.
ls_poheader-purch_group = '001'.
ls_poheader-comp_code = '1000'.
ls_poitem-po_item = '00010'.
ls_poitem-material = 'M-1001'.
ls_poitem-plant = '1000'.
ls_poitem-quantity = 10.
ls_poitem-net_price = 100.
EXPORTING
poheader = ls_poheader
TABLES
poitem = lt_poitem
poschedule = lt_poschedule
return = lt_return
IF sy-subrc EQ 0.
COMMIT WORK.
lv_po_number = lt_return-po_number.
ELSE.
ROLLBACK WORK.
ENDIF.
```
In this example, we are creating a PO with a header and one item. We first define the header and
item data in the appropriate structures (ls_poheader and ls_poitem), and then append the item to a
table (lt_poitem). We then call the BAPI_PO_CREATE1 function module, passing the header and item
data as input parameters. If the function call is successful, we commit the changes to the database
and display the newly created PO number. If the function call fails, we roll back the changes and
display the error message.