SAP /SAPAPO/DM_SUBST_ORDER_CREATE Function Module for Create Substitution Orders
/SAPAPO/DM_SUBST_ORDER_CREATE is a standard /sapapo/dm subst order 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 Substitution Orders 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 /sapapo/dm subst order create FM, simply by entering the name /SAPAPO/DM_SUBST_ORDER_CREATE into the relevant SAP transaction such as SE37 or SE38.
Function Group: /SAPAPO/DM_SUBST
Program Name: /SAPAPO/SAPLDM_SUBST
Main Program: /SAPAPO/SAPLDM_SUBST
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function /SAPAPO/DM_SUBST_ORDER_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 '/SAPAPO/DM_SUBST_ORDER_CREATE'"Create Substitution Orders.
EXPORTING
* IT_SUBST_OLD = "Substitution Orders
IV_SNPDLTHEU = "Heuristic: Delta Mode for Order Update
IV_VERSION = "Transaction Data Version
IV_SUBST_CAT_DEM = "Category of Stock/Receipt/Requirement/Forecast
IV_SUBST_CAT_REC = "Category of Stock/Receipt/Requirement/Forecast
IV_SIMSESSION = "GUID for Identifying Transactional Simulation Session
CHANGING
CT_SUBST = "Substitution Orders
CT_SUBST_OUT = "Substitution Orders
CT_SUBST_GLOBAL = "Substitution Orders
EXCEPTIONS
FAILED = 1 MATERIAL_NOT_SUPPLIED = 2 LOCATION_NOT_SUPPLIED = 3 MATERIAL_NOT_IN_LOCATION = 4 ERROR_FINDING_PEGID = 5
IMPORTING Parameters details for /SAPAPO/DM_SUBST_ORDER_CREATE
IT_SUBST_OLD - Substitution Orders
Data type: /SAPAPO/MSNP_SUBST_TABOptional: Yes
Call by Reference: Yes
IV_SNPDLTHEU - Heuristic: Delta Mode for Order Update
Data type: /SAPAPO/SNPDLTHEUOptional: No
Call by Reference: Yes
IV_VERSION - Transaction Data Version
Data type: /SAPAPO/SNPVERSIONOptional: No
Call by Reference: Yes
IV_SUBST_CAT_DEM - Category of Stock/Receipt/Requirement/Forecast
Data type: /SAPAPO/ATPCATOptional: No
Call by Reference: Yes
IV_SUBST_CAT_REC - Category of Stock/Receipt/Requirement/Forecast
Data type: /SAPAPO/ATPCATOptional: No
Call by Reference: Yes
IV_SIMSESSION - GUID for Identifying Transactional Simulation Session
Data type: /SAPAPO/OM_SIMSESSIONOptional: No
Call by Reference: Yes
CHANGING Parameters details for /SAPAPO/DM_SUBST_ORDER_CREATE
CT_SUBST - Substitution Orders
Data type: /SAPAPO/MSNP_SUBST_TABOptional: No
Call by Reference: Yes
CT_SUBST_OUT - Substitution Orders
Data type: /SAPAPO/MSNP_SUBST_TABOptional: No
Call by Reference: Yes
CT_SUBST_GLOBAL - Substitution Orders
Data type: /SAPAPO/MSNP_SUBST_TABOptional: No
Call by Reference: Yes
EXCEPTIONS details
FAILED -
Data type:Optional: No
Call by Reference: Yes
MATERIAL_NOT_SUPPLIED -
Data type:Optional: No
Call by Reference: Yes
LOCATION_NOT_SUPPLIED -
Data type:Optional: No
Call by Reference: Yes
MATERIAL_NOT_IN_LOCATION -
Data type:Optional: No
Call by Reference: Yes
ERROR_FINDING_PEGID -
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for /SAPAPO/DM_SUBST_ORDER_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: | ||||
| lv_failed | TYPE STRING, " | |||
| lv_ct_subst | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_it_subst_old | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_ct_subst_out | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_iv_snpdltheu | TYPE /SAPAPO/SNPDLTHEU, " | |||
| lv_material_not_supplied | TYPE /SAPAPO/SNPDLTHEU, " | |||
| lv_iv_version | TYPE /SAPAPO/SNPVERSION, " | |||
| lv_ct_subst_global | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_location_not_supplied | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_iv_subst_cat_dem | TYPE /SAPAPO/ATPCAT, " | |||
| lv_material_not_in_location | TYPE /SAPAPO/ATPCAT, " | |||
| lv_iv_subst_cat_rec | TYPE /SAPAPO/ATPCAT, " | |||
| lv_error_finding_pegid | TYPE /SAPAPO/ATPCAT, " | |||
| lv_iv_simsession | TYPE /SAPAPO/OM_SIMSESSION. " |
|   CALL FUNCTION '/SAPAPO/DM_SUBST_ORDER_CREATE' "Create Substitution Orders |
| EXPORTING | ||
| IT_SUBST_OLD | = lv_it_subst_old | |
| IV_SNPDLTHEU | = lv_iv_snpdltheu | |
| IV_VERSION | = lv_iv_version | |
| IV_SUBST_CAT_DEM | = lv_iv_subst_cat_dem | |
| IV_SUBST_CAT_REC | = lv_iv_subst_cat_rec | |
| IV_SIMSESSION | = lv_iv_simsession | |
| CHANGING | ||
| CT_SUBST | = lv_ct_subst | |
| CT_SUBST_OUT | = lv_ct_subst_out | |
| CT_SUBST_GLOBAL | = lv_ct_subst_global | |
| EXCEPTIONS | ||
| FAILED = 1 | ||
| MATERIAL_NOT_SUPPLIED = 2 | ||
| LOCATION_NOT_SUPPLIED = 3 | ||
| MATERIAL_NOT_IN_LOCATION = 4 | ||
| ERROR_FINDING_PEGID = 5 | ||
| . " /SAPAPO/DM_SUBST_ORDER_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM /SAPAPO/DM_SUBST_ORDER_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.Search for further information about these or an SAP related objects