SAP COD_SALESORDER_CREATEFROMDAT2 Function Module for Sales order: Create Sales Order
COD_SALESORDER_CREATEFROMDAT2 is a standard cod salesorder createfromdat2 SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Sales order: 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 cod salesorder createfromdat2 FM, simply by entering the name COD_SALESORDER_CREATEFROMDAT2 into the relevant SAP transaction such as SE37 or SE38.
Function Group: CFC_ORDER_INT
Program Name: SAPLCFC_ORDER_INT
Main Program: SAPLCFC_ORDER_INT
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function COD_SALESORDER_CREATEFROMDAT2 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 'COD_SALESORDER_CREATEFROMDAT2'"Sales order: Create Sales Order.
EXPORTING
* SALESDOCUMENTIN = "Sales Document
* CONVERT = ' ' "Single-Character Flag
* ITEMS_LCTI = 'X' "Boolean Variable (X=True, -=False, Space=Unknown)
* STATUS_BUFFER_REFRESH = 'X' "Boolean Variable (X = True, - = False, Space = Unknown)
ORDER_HEADER_IN = "Communication Fields: Sales and Distribution Document Header
* ORDER_HEADER_INX = "Checkbox Fields for Sales and Distribution Document Header
* SENDER = "Logical system of sender
* BINARY_RELATIONSHIPTYPE = "Relationship type
* INT_NUMBER_ASSIGNMENT = "Single-Character Flag
* BEHAVE_WHEN_ERROR = "Single-Character Flag
* LOGIC_SWITCH = "SD Checkbox for the Logic Switch
* TESTRUN = "Single-Character Flag
IMPORTING
SALESDOCUMENT = "Sales Document
TABLES
* RETURN = "Return Parameter
* ORDER_CFGS_INST = "Instances of Several Configurations
* ORDER_CFGS_PART_OF = "Part_Of Information for Several Configurations
* ORDER_CFGS_VALUE = "Characteristic Value Assignments for Several Configurations
* ORDER_CFGS_BLOB = "BLOB Internal Configuration Data (SCE)
* ORDER_CFGS_VK = "Variant Condition Key for Configurations
* ORDER_CFGS_REFINST = "CU: Reference Order Item / Instance in Configuration
* ORDER_CCARD = "Communication Table: Means of Payment Order/Billing Document
* ORDER_TEXT = "Communication fields: SD texts
* ORDER_KEYS = "Key in Sales and Distribution Document
* EXTENSIONIN = "Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
* ORDER_ITEMS_IN = "Communication Fields: Sales and Distribution Document Item
* PARTNERADDRESSES = "BAPI Reference Structure for Addresses (Org./Company)
* ORDER_ITEMS_INX = "Communication Fields: Sales and Distribution Document Item
ORDER_PARTNERS = "Communications Fields: SD Document Partner: WWW
* ORDER_SCHEDULES_IN = "Communication Fields for Maintaining SD Doc. Schedule Lines
* ORDER_SCHEDULES_INX = "Checkbox List for Maintaining Sales Document Schedule Line
* ORDER_CONDITIONS_IN = "Communication Fields for Maintaining Conditions in the Order
* ORDER_CONDITIONS_INX = "Communication Fields for Maintaining Conditions in the Order
* ORDER_CFGS_REF = "CU: Configuration Data
EXCEPTIONS
NOT_FOUND = 1
IMPORTING Parameters details for COD_SALESORDER_CREATEFROMDAT2
SALESDOCUMENTIN - Sales Document
Data type: BAPIVBELN-VBELNOptional: Yes
Call by Reference: No ( called with pass by value option)
CONVERT - Single-Character Flag
Data type: BAPIFLAG-BAPIFLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
ITEMS_LCTI - Boolean Variable (X=True, -=False, Space=Unknown)
Data type: BOOLEANDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
STATUS_BUFFER_REFRESH - Boolean Variable (X = True, - = False, Space = Unknown)
Data type: BOOLEANDefault: 'X'
Optional: Yes
Call by Reference: Yes
ORDER_HEADER_IN - Communication Fields: Sales and Distribution Document Header
Data type: BAPISDHD1Optional: No
Call by Reference: No ( called with pass by value option)
ORDER_HEADER_INX - Checkbox Fields for Sales and Distribution Document Header
Data type: BAPISDHD1XOptional: Yes
Call by Reference: No ( called with pass by value option)
SENDER - Logical system of sender
Data type: BAPI_SENDEROptional: Yes
Call by Reference: No ( called with pass by value option)
BINARY_RELATIONSHIPTYPE - Relationship type
Data type: BAPIRELTYPE-RELTYPEOptional: Yes
Call by Reference: No ( called with pass by value option)
INT_NUMBER_ASSIGNMENT - Single-Character Flag
Data type: BAPIFLAG-BAPIFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
BEHAVE_WHEN_ERROR - Single-Character Flag
Data type: BAPIFLAG-BAPIFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
LOGIC_SWITCH - SD Checkbox for the Logic Switch
Data type: BAPISDLSOptional: Yes
Call by Reference: No ( called with pass by value option)
TESTRUN - Single-Character Flag
Data type: BAPIFLAG-BAPIFLAGOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for COD_SALESORDER_CREATEFROMDAT2
SALESDOCUMENT - Sales Document
Data type: BAPIVBELN-VBELNOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for COD_SALESORDER_CREATEFROMDAT2
RETURN - Return Parameter
Data type: BAPIRET2Optional: Yes
Call by Reference: Yes
ORDER_CFGS_INST - Instances of Several Configurations
Data type: BAPICUINSOptional: Yes
Call by Reference: Yes
ORDER_CFGS_PART_OF - Part_Of Information for Several Configurations
Data type: BAPICUPRTOptional: Yes
Call by Reference: Yes
ORDER_CFGS_VALUE - Characteristic Value Assignments for Several Configurations
Data type: BAPICUVALOptional: Yes
Call by Reference: Yes
ORDER_CFGS_BLOB - BLOB Internal Configuration Data (SCE)
Data type: BAPICUBLBOptional: Yes
Call by Reference: Yes
ORDER_CFGS_VK - Variant Condition Key for Configurations
Data type: BAPICUVKOptional: Yes
Call by Reference: Yes
ORDER_CFGS_REFINST - CU: Reference Order Item / Instance in Configuration
Data type: BAPICUREFOptional: Yes
Call by Reference: Yes
ORDER_CCARD - Communication Table: Means of Payment Order/Billing Document
Data type: BAPICCARDOptional: Yes
Call by Reference: Yes
ORDER_TEXT - Communication fields: SD texts
Data type: BAPISDTEXTOptional: Yes
Call by Reference: Yes
ORDER_KEYS - Key in Sales and Distribution Document
Data type: BAPISDKEYOptional: Yes
Call by Reference: Yes
EXTENSIONIN - Ref. structure for BAPI parameter ExtensionIn/ExtensionOut
Data type: BAPIPAREXOptional: Yes
Call by Reference: Yes
ORDER_ITEMS_IN - Communication Fields: Sales and Distribution Document Item
Data type: BAPISDITMOptional: Yes
Call by Reference: Yes
PARTNERADDRESSES - BAPI Reference Structure for Addresses (Org./Company)
Data type: BAPIADDR1Optional: Yes
Call by Reference: Yes
ORDER_ITEMS_INX - Communication Fields: Sales and Distribution Document Item
Data type: BAPISDITMXOptional: Yes
Call by Reference: Yes
ORDER_PARTNERS - Communications Fields: SD Document Partner: WWW
Data type: BAPIPARNROptional: No
Call by Reference: Yes
ORDER_SCHEDULES_IN - Communication Fields for Maintaining SD Doc. Schedule Lines
Data type: BAPISCHDLOptional: Yes
Call by Reference: Yes
ORDER_SCHEDULES_INX - Checkbox List for Maintaining Sales Document Schedule Line
Data type: BAPISCHDLXOptional: Yes
Call by Reference: Yes
ORDER_CONDITIONS_IN - Communication Fields for Maintaining Conditions in the Order
Data type: BAPICONDOptional: Yes
Call by Reference: Yes
ORDER_CONDITIONS_INX - Communication Fields for Maintaining Conditions in the Order
Data type: BAPICONDXOptional: Yes
Call by Reference: Yes
ORDER_CFGS_REF - CU: Configuration Data
Data type: BAPICUCFGOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
NOT_FOUND -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for COD_SALESORDER_CREATEFROMDAT2 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_return | TYPE STANDARD TABLE OF BAPIRET2, " | |||
| lv_not_found | TYPE BAPIRET2, " | |||
| lv_salesdocument | TYPE BAPIVBELN-VBELN, " | |||
| lv_salesdocumentin | TYPE BAPIVBELN-VBELN, " | |||
| lv_convert | TYPE BAPIFLAG-BAPIFLAG, " SPACE | |||
| lt_order_cfgs_inst | TYPE STANDARD TABLE OF BAPICUINS, " | |||
| lv_items_lcti | TYPE BOOLEAN, " 'X' | |||
| lt_order_cfgs_part_of | TYPE STANDARD TABLE OF BAPICUPRT, " | |||
| lt_order_cfgs_value | TYPE STANDARD TABLE OF BAPICUVAL, " | |||
| lv_status_buffer_refresh | TYPE BOOLEAN, " 'X' | |||
| lt_order_cfgs_blob | TYPE STANDARD TABLE OF BAPICUBLB, " | |||
| lt_order_cfgs_vk | TYPE STANDARD TABLE OF BAPICUVK, " | |||
| lt_order_cfgs_refinst | TYPE STANDARD TABLE OF BAPICUREF, " | |||
| lt_order_ccard | TYPE STANDARD TABLE OF BAPICCARD, " | |||
| lt_order_text | TYPE STANDARD TABLE OF BAPISDTEXT, " | |||
| lt_order_keys | TYPE STANDARD TABLE OF BAPISDKEY, " | |||
| lt_extensionin | TYPE STANDARD TABLE OF BAPIPAREX, " | |||
| lt_order_items_in | TYPE STANDARD TABLE OF BAPISDITM, " | |||
| lv_order_header_in | TYPE BAPISDHD1, " | |||
| lt_partneraddresses | TYPE STANDARD TABLE OF BAPIADDR1, " | |||
| lt_order_items_inx | TYPE STANDARD TABLE OF BAPISDITMX, " | |||
| lv_order_header_inx | TYPE BAPISDHD1X, " | |||
| lv_sender | TYPE BAPI_SENDER, " | |||
| lt_order_partners | TYPE STANDARD TABLE OF BAPIPARNR, " | |||
| lt_order_schedules_in | TYPE STANDARD TABLE OF BAPISCHDL, " | |||
| lv_binary_relationshiptype | TYPE BAPIRELTYPE-RELTYPE, " | |||
| lt_order_schedules_inx | TYPE STANDARD TABLE OF BAPISCHDLX, " | |||
| lv_int_number_assignment | TYPE BAPIFLAG-BAPIFLAG, " | |||
| lv_behave_when_error | TYPE BAPIFLAG-BAPIFLAG, " | |||
| lt_order_conditions_in | TYPE STANDARD TABLE OF BAPICOND, " | |||
| lv_logic_switch | TYPE BAPISDLS, " | |||
| lt_order_conditions_inx | TYPE STANDARD TABLE OF BAPICONDX, " | |||
| lv_testrun | TYPE BAPIFLAG-BAPIFLAG, " | |||
| lt_order_cfgs_ref | TYPE STANDARD TABLE OF BAPICUCFG. " |
|   CALL FUNCTION 'COD_SALESORDER_CREATEFROMDAT2' "Sales order: Create Sales Order |
| EXPORTING | ||
| SALESDOCUMENTIN | = lv_salesdocumentin | |
| CONVERT | = lv_convert | |
| ITEMS_LCTI | = lv_items_lcti | |
| STATUS_BUFFER_REFRESH | = lv_status_buffer_refresh | |
| ORDER_HEADER_IN | = lv_order_header_in | |
| ORDER_HEADER_INX | = lv_order_header_inx | |
| SENDER | = lv_sender | |
| BINARY_RELATIONSHIPTYPE | = lv_binary_relationshiptype | |
| INT_NUMBER_ASSIGNMENT | = lv_int_number_assignment | |
| BEHAVE_WHEN_ERROR | = lv_behave_when_error | |
| LOGIC_SWITCH | = lv_logic_switch | |
| TESTRUN | = lv_testrun | |
| IMPORTING | ||
| SALESDOCUMENT | = lv_salesdocument | |
| TABLES | ||
| RETURN | = lt_return | |
| ORDER_CFGS_INST | = lt_order_cfgs_inst | |
| ORDER_CFGS_PART_OF | = lt_order_cfgs_part_of | |
| ORDER_CFGS_VALUE | = lt_order_cfgs_value | |
| ORDER_CFGS_BLOB | = lt_order_cfgs_blob | |
| ORDER_CFGS_VK | = lt_order_cfgs_vk | |
| ORDER_CFGS_REFINST | = lt_order_cfgs_refinst | |
| ORDER_CCARD | = lt_order_ccard | |
| ORDER_TEXT | = lt_order_text | |
| ORDER_KEYS | = lt_order_keys | |
| EXTENSIONIN | = lt_extensionin | |
| ORDER_ITEMS_IN | = lt_order_items_in | |
| PARTNERADDRESSES | = lt_partneraddresses | |
| ORDER_ITEMS_INX | = lt_order_items_inx | |
| ORDER_PARTNERS | = lt_order_partners | |
| ORDER_SCHEDULES_IN | = lt_order_schedules_in | |
| ORDER_SCHEDULES_INX | = lt_order_schedules_inx | |
| ORDER_CONDITIONS_IN | = lt_order_conditions_in | |
| ORDER_CONDITIONS_INX | = lt_order_conditions_inx | |
| ORDER_CFGS_REF | = lt_order_cfgs_ref | |
| EXCEPTIONS | ||
| NOT_FOUND = 1 | ||
| . " COD_SALESORDER_CREATEFROMDAT2 | ||
ABAP code using 7.40 inline data declarations to call FM COD_SALESORDER_CREATEFROMDAT2
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 VBELN FROM BAPIVBELN INTO @DATA(ld_salesdocument). | ||||
| "SELECT single VBELN FROM BAPIVBELN INTO @DATA(ld_salesdocumentin). | ||||
| "SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_convert). | ||||
| DATA(ld_convert) | = ' '. | |||
| DATA(ld_items_lcti) | = 'X'. | |||
| DATA(ld_status_buffer_refresh) | = 'X'. | |||
| "SELECT single RELTYPE FROM BAPIRELTYPE INTO @DATA(ld_binary_relationshiptype). | ||||
| "SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_int_number_assignment). | ||||
| "SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_behave_when_error). | ||||
| "SELECT single BAPIFLAG FROM BAPIFLAG INTO @DATA(ld_testrun). | ||||
Search for further information about these or an SAP related objects