SAP MSR1_SO_CREATE Function Module for Create Sales Order
MSR1_SO_CREATE is a standard msr1 so 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 Sales 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 msr1 so create FM, simply by entering the name MSR1_SO_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: MSR1_SO
Program Name: SAPLMSR1_SO
Main Program:
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:

Function MSR1_SO_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 'MSR1_SO_CREATE'"Create Sales Order.
EXPORTING
PI_ORDER_HEADER = "MSR: Sales Order Header
* PI_BILLTO = "Partner function: Bill-to Party
* PI_PAYER = "Partner function: Payer
* PI_SALEMP = "Partner function: Sales Employee
* PI_PRICING_TYPE = ' ' "Pricing type
* PI_TAX_CONDITION = "Condition type
* PI_UNIT_SPLIT = 50 "Byte value
* PI_TEXT_ID = '0001' "Text ID
* PI_LANGU = "Language key
* PI_CREDIT_DOCTYPE = "Document Type for Credit Memo
* PI_SOLDTO = "Partner function: Sold-to Party
* PI_SHIPTO = "Partner function: Ship-to Party
IMPORTING
PO_ORDER_NUMBER = "Sales document
TABLES
PIT_ORDER_ITEM = "MSR: Sales Order Item
RETURN = "Return parameter
IMPORTING Parameters details for MSR1_SO_CREATE
PI_ORDER_HEADER - MSR: Sales Order Header
Data type: MSR1_ORDER_HEADEROptional: No
Call by Reference: No ( called with pass by value option)
PI_BILLTO - Partner function: Bill-to Party
Data type: KNVP-PARVWOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_PAYER - Partner function: Payer
Data type: KNVP-PARVWOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_SALEMP - Partner function: Sales Employee
Data type: KNVP-PARVWOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_PRICING_TYPE - Pricing type
Data type: BAPISDLS-PRICINGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
PI_TAX_CONDITION - Condition type
Data type: BAPICOND-COND_TYPEOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_UNIT_SPLIT - Byte value
Data type: MSR1_ORDER_HEADER-UNIT_SPLITDefault: 50
Optional: Yes
Call by Reference: No ( called with pass by value option)
PI_TEXT_ID - Text ID
Data type: BAPISDTEXT-TEXT_IDDefault: '0001'
Optional: Yes
Call by Reference: No ( called with pass by value option)
PI_LANGU - Language key
Data type: SY-LANGUOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_CREDIT_DOCTYPE - Document Type for Credit Memo
Data type: TVAK-AUARTOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_SOLDTO - Partner function: Sold-to Party
Data type: KNVP-PARVWOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_SHIPTO - Partner function: Ship-to Party
Data type: KNVP-PARVWOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for MSR1_SO_CREATE
PO_ORDER_NUMBER - Sales document
Data type: MSR1_ORDER_HEADER-SALESDOCUMENTOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for MSR1_SO_CREATE
PIT_ORDER_ITEM - MSR: Sales Order Item
Data type: MSR1_ORDER_ITEMOptional: No
Call by Reference: Yes
RETURN - Return parameter
Data type: BAPIRET2Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for MSR1_SO_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_pit_order_item | TYPE STANDARD TABLE OF MSR1_ORDER_ITEM, " | |||
| lv_pi_order_header | TYPE MSR1_ORDER_HEADER, " | |||
| lv_po_order_number | TYPE MSR1_ORDER_HEADER-SALESDOCUMENT, " | |||
| lv_pi_billto | TYPE KNVP-PARVW, " | |||
| lv_pi_payer | TYPE KNVP-PARVW, " | |||
| lv_pi_salemp | TYPE KNVP-PARVW, " | |||
| lt_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_pi_pricing_type | TYPE BAPISDLS-PRICING, " SPACE | |||
| lv_pi_tax_condition | TYPE BAPICOND-COND_TYPE, " | |||
| lv_pi_unit_split | TYPE MSR1_ORDER_HEADER-UNIT_SPLIT, " 50 | |||
| lv_pi_text_id | TYPE BAPISDTEXT-TEXT_ID, " '0001' | |||
| lv_pi_langu | TYPE SY-LANGU, " | |||
| lv_pi_credit_doctype | TYPE TVAK-AUART, " | |||
| lv_pi_soldto | TYPE KNVP-PARVW, " | |||
| lv_pi_shipto | TYPE KNVP-PARVW. " |
|   CALL FUNCTION 'MSR1_SO_CREATE' "Create Sales Order |
| EXPORTING | ||
| PI_ORDER_HEADER | = lv_pi_order_header | |
| PI_BILLTO | = lv_pi_billto | |
| PI_PAYER | = lv_pi_payer | |
| PI_SALEMP | = lv_pi_salemp | |
| PI_PRICING_TYPE | = lv_pi_pricing_type | |
| PI_TAX_CONDITION | = lv_pi_tax_condition | |
| PI_UNIT_SPLIT | = lv_pi_unit_split | |
| PI_TEXT_ID | = lv_pi_text_id | |
| PI_LANGU | = lv_pi_langu | |
| PI_CREDIT_DOCTYPE | = lv_pi_credit_doctype | |
| PI_SOLDTO | = lv_pi_soldto | |
| PI_SHIPTO | = lv_pi_shipto | |
| IMPORTING | ||
| PO_ORDER_NUMBER | = lv_po_order_number | |
| TABLES | ||
| PIT_ORDER_ITEM | = lt_pit_order_item | |
| RETURN | = lt_return | |
| . " MSR1_SO_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM MSR1_SO_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 SALESDOCUMENT FROM MSR1_ORDER_HEADER INTO @DATA(ld_po_order_number). | ||||
| "SELECT single PARVW FROM KNVP INTO @DATA(ld_pi_billto). | ||||
| "SELECT single PARVW FROM KNVP INTO @DATA(ld_pi_payer). | ||||
| "SELECT single PARVW FROM KNVP INTO @DATA(ld_pi_salemp). | ||||
| "SELECT single PRICING FROM BAPISDLS INTO @DATA(ld_pi_pricing_type). | ||||
| DATA(ld_pi_pricing_type) | = ' '. | |||
| "SELECT single COND_TYPE FROM BAPICOND INTO @DATA(ld_pi_tax_condition). | ||||
| "SELECT single UNIT_SPLIT FROM MSR1_ORDER_HEADER INTO @DATA(ld_pi_unit_split). | ||||
| DATA(ld_pi_unit_split) | = 50. | |||
| "SELECT single TEXT_ID FROM BAPISDTEXT INTO @DATA(ld_pi_text_id). | ||||
| DATA(ld_pi_text_id) | = '0001'. | |||
| "SELECT single LANGU FROM SY INTO @DATA(ld_pi_langu). | ||||
| "SELECT single AUART FROM TVAK INTO @DATA(ld_pi_credit_doctype). | ||||
| "SELECT single PARVW FROM KNVP INTO @DATA(ld_pi_soldto). | ||||
| "SELECT single PARVW FROM KNVP INTO @DATA(ld_pi_shipto). | ||||
Search for further information about these or an SAP related objects