Process with BAPI_SALESORDER_CREATEFROMDATA1 example
You can create a sales order document using the BAPI_SALESORDER_CREATEFROMDATA1 function.
Use the function to read from the Import fields and the Table input fields in the function. You specify the customer details and the ordered items to generate the sales order document.
As input, pass the order header, item details, and partner details. Order header contains fields such as number, doc type, sales organization, and division. The item details Table input contains fields such as item number, material, required quantity, sales unit, and required date. Assign the multiple input fields to a BAPI input field and pass the value to the BAPI_SALESORDER_CREATEFROMDATA1 function. SAP generates an unique sales number and creates the sales order based on your input details. The output of the BAPI is an unique sales document. You also get other details such as the party to whom the items are sold and the party that was billed for the items.
In this example, you can configure a service call to access the BAPI_SALESORDER_CREATEFROMDATA1 function and read the input details from an Oracle database. SAP generates multiple outputs such as the sales document, sold to party, ship to party, and bill to party details.
Perform the following steps to create the sales order:
1Create the SAP BAPI and JDBC connections in Application Integration.
2Create the input variables in the process properties. Create input fields for item details, order header, and partner details. Also, create a variable to provide the consolidated input the BAPI function.
3Create the output variables in the process properties. Create output fields such as sales document, sold to party, ship to party, bill to party to capture the BAPI output.
4Read the order header, item details, and partner details from the Oracle database and assign to the variables in the process.
5Because Table input can have multiple inputs, create a formula using the For loop to read all the items from the order items input table object and assign to the BAPI input field.
6To assign the partner details to the BAPI input field, create a formula using the For loop to read all the partner details.
7Configure the BAPI service call to connect to the BAPI using the SAP BAPI connection.
8Assign the BAPI input field to the BAPI_SALESORDER_CREATEFROMDATA1 input.
9Assign the output fields to the BAPI output.
10Run the process to print the sales order document.