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

Function /SAPAPO/TS_DM_SUBST_ORD_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/TS_DM_SUBST_ORD_CREATE'"Create an APO Product Substitution Order.
EXPORTING
IV_PAREAID = "Name of DP/SNP Planning Area
IV_KEYFIG_REC = "InfoObject
IV_KEYFIG_DEM = "InfoObject
IT_SUBST_OLD = "Substitution Orders
IV_SNPDLTHEU = "Heuristic: Delta Mode for Order Update
IV_VERSION = "Transaction Data Version
CHANGING
CT_SUBST = "Substitution Orders
CT_SUBST_OUT = "Substitution Orders
CT_SUBST_GLOBAL = "Substitution Orders
EXCEPTIONS
AREA_INVALID = 1 CUSTOMIZING_ERROR = 2 SUBSTITUTION_FAILED = 3 MATERIAL_NOT_SUPPLIED = 4 LOCATION_NOT_SUPPLIED = 5 MATERIAL_NOT_IN_LOCATION = 6 ERROR_FINDING_PEGID = 7
IMPORTING Parameters details for /SAPAPO/TS_DM_SUBST_ORD_CREATE
IV_PAREAID - Name of DP/SNP Planning Area
Data type: /SAPAPO/TS_PAREAIDOptional: No
Call by Reference: Yes
IV_KEYFIG_REC - InfoObject
Data type: /SAPAPO/IOBJNMOptional: No
Call by Reference: Yes
IV_KEYFIG_DEM - InfoObject
Data type: /SAPAPO/IOBJNMOptional: No
Call by Reference: Yes
IT_SUBST_OLD - Substitution Orders
Data type: /SAPAPO/MSNP_SUBST_TABOptional: No
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
CHANGING Parameters details for /SAPAPO/TS_DM_SUBST_ORD_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
AREA_INVALID -
Data type:Optional: No
Call by Reference: Yes
CUSTOMIZING_ERROR -
Data type:Optional: No
Call by Reference: Yes
SUBSTITUTION_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/TS_DM_SUBST_ORD_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_ct_subst | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_iv_pareaid | TYPE /SAPAPO/TS_PAREAID, " | |||
| lv_area_invalid | TYPE /SAPAPO/TS_PAREAID, " | |||
| lv_ct_subst_out | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_iv_keyfig_rec | TYPE /SAPAPO/IOBJNM, " | |||
| lv_customizing_error | TYPE /SAPAPO/IOBJNM, " | |||
| lv_iv_keyfig_dem | TYPE /SAPAPO/IOBJNM, " | |||
| lv_ct_subst_global | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_substitution_failed | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_it_subst_old | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_material_not_supplied | TYPE /SAPAPO/MSNP_SUBST_TAB, " | |||
| lv_iv_snpdltheu | TYPE /SAPAPO/SNPDLTHEU, " | |||
| lv_location_not_supplied | TYPE /SAPAPO/SNPDLTHEU, " | |||
| lv_iv_version | TYPE /SAPAPO/SNPVERSION, " | |||
| lv_material_not_in_location | TYPE /SAPAPO/SNPVERSION, " | |||
| lv_error_finding_pegid | TYPE /SAPAPO/SNPVERSION. " |
|   CALL FUNCTION '/SAPAPO/TS_DM_SUBST_ORD_CREATE' "Create an APO Product Substitution Order |
| EXPORTING | ||
| IV_PAREAID | = lv_iv_pareaid | |
| IV_KEYFIG_REC | = lv_iv_keyfig_rec | |
| IV_KEYFIG_DEM | = lv_iv_keyfig_dem | |
| IT_SUBST_OLD | = lv_it_subst_old | |
| IV_SNPDLTHEU | = lv_iv_snpdltheu | |
| IV_VERSION | = lv_iv_version | |
| CHANGING | ||
| CT_SUBST | = lv_ct_subst | |
| CT_SUBST_OUT | = lv_ct_subst_out | |
| CT_SUBST_GLOBAL | = lv_ct_subst_global | |
| EXCEPTIONS | ||
| AREA_INVALID = 1 | ||
| CUSTOMIZING_ERROR = 2 | ||
| SUBSTITUTION_FAILED = 3 | ||
| MATERIAL_NOT_SUPPLIED = 4 | ||
| LOCATION_NOT_SUPPLIED = 5 | ||
| MATERIAL_NOT_IN_LOCATION = 6 | ||
| ERROR_FINDING_PEGID = 7 | ||
| . " /SAPAPO/TS_DM_SUBST_ORD_CREATE | ||
ABAP code using 7.40 inline data declarations to call FM /SAPAPO/TS_DM_SUBST_ORD_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