SAP SCENARIO_DATA_FOR_S012 Function Module for Dynamic set up of internal S012 table from planning scenario
SCENARIO_DATA_FOR_S012 is a standard scenario data for s012 SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Dynamic set up of internal S012 table from planning scenario 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 scenario data for s012 FM, simply by entering the name SCENARIO_DATA_FOR_S012 into the relevant SAP transaction such as SE37 or SE38.
Function Group: MD01
Program Name: SAPLMD01
Main Program: SAPLMD01
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function SCENARIO_DATA_FOR_S012 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 'SCENARIO_DATA_FOR_S012'"Dynamic set up of internal S012 table from planning scenario.
EXPORTING
IPLSC = "Planning scenarios in long-term planning
* VRSIO = ' ' "Version number in the information structure
* DATE_FROM = "ABAP System Field: Current Date of Application Server
* DATE_TO = "ABAP System Field: Current Date of Application Server
* LFPP = "Transf.struct.; order value calculation type LTP-info record
* TYPE_OF_RATE = "DE-EN-LANG-SWITCH-NO-TRANSLATION
TABLES
S012_TAB = "Purchasing
* SL_EKORG = "Range Structure for Selection of Arrangements by Purch. Org.
* SL_MATNR = "Range table for material number - general use
* SL_WERKS = "Range for WERKS
* SL_LAND1 = "Range table for country 1 of vendor
* SL_MATKL = "Range table for goods group - general use
* SL_LIFNR = "Range table for vendor - general use
IMPORTING Parameters details for SCENARIO_DATA_FOR_S012
IPLSC - Planning scenarios in long-term planning
Data type: PLSCOptional: No
Call by Reference: No ( called with pass by value option)
VRSIO - Version number in the information structure
Data type: P44V-VRSIODefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
DATE_FROM - ABAP System Field: Current Date of Application Server
Data type: SY-DATUMOptional: Yes
Call by Reference: No ( called with pass by value option)
DATE_TO - ABAP System Field: Current Date of Application Server
Data type: SY-DATUMOptional: Yes
Call by Reference: No ( called with pass by value option)
LFPP - Transf.struct.; order value calculation type LTP-info record
Data type: MDLFPPOptional: Yes
Call by Reference: No ( called with pass by value option)
TYPE_OF_RATE - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for SCENARIO_DATA_FOR_S012
S012_TAB - Purchasing
Data type: S012Optional: No
Call by Reference: No ( called with pass by value option)
SL_EKORG - Range Structure for Selection of Arrangements by Purch. Org.
Data type: EKORG_RANOptional: Yes
Call by Reference: No ( called with pass by value option)
SL_MATNR - Range table for material number - general use
Data type: MATNR_RANGOptional: Yes
Call by Reference: No ( called with pass by value option)
SL_WERKS - Range for WERKS
Data type: WERKS_RANGOptional: Yes
Call by Reference: No ( called with pass by value option)
SL_LAND1 - Range table for country 1 of vendor
Data type: LAND1_RANGOptional: Yes
Call by Reference: No ( called with pass by value option)
SL_MATKL - Range table for goods group - general use
Data type: MATKL_RANGOptional: Yes
Call by Reference: No ( called with pass by value option)
SL_LIFNR - Range table for vendor - general use
Data type: LIFNR_RANGOptional: Yes
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for SCENARIO_DATA_FOR_S012 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_iplsc | TYPE PLSC, " | |||
| lt_s012_tab | TYPE STANDARD TABLE OF S012, " | |||
| lv_vrsio | TYPE P44V-VRSIO, " SPACE | |||
| lt_sl_ekorg | TYPE STANDARD TABLE OF EKORG_RAN, " | |||
| lt_sl_matnr | TYPE STANDARD TABLE OF MATNR_RANG, " | |||
| lv_date_from | TYPE SY-DATUM, " | |||
| lv_date_to | TYPE SY-DATUM, " | |||
| lt_sl_werks | TYPE STANDARD TABLE OF WERKS_RANG, " | |||
| lv_lfpp | TYPE MDLFPP, " | |||
| lt_sl_land1 | TYPE STANDARD TABLE OF LAND1_RANG, " | |||
| lt_sl_matkl | TYPE STANDARD TABLE OF MATKL_RANG, " | |||
| lv_type_of_rate | TYPE MATKL_RANG, " | |||
| lt_sl_lifnr | TYPE STANDARD TABLE OF LIFNR_RANG. " |
|   CALL FUNCTION 'SCENARIO_DATA_FOR_S012' "Dynamic set up of internal S012 table from planning scenario |
| EXPORTING | ||
| IPLSC | = lv_iplsc | |
| VRSIO | = lv_vrsio | |
| DATE_FROM | = lv_date_from | |
| DATE_TO | = lv_date_to | |
| LFPP | = lv_lfpp | |
| TYPE_OF_RATE | = lv_type_of_rate | |
| TABLES | ||
| S012_TAB | = lt_s012_tab | |
| SL_EKORG | = lt_sl_ekorg | |
| SL_MATNR | = lt_sl_matnr | |
| SL_WERKS | = lt_sl_werks | |
| SL_LAND1 | = lt_sl_land1 | |
| SL_MATKL | = lt_sl_matkl | |
| SL_LIFNR | = lt_sl_lifnr | |
| . " SCENARIO_DATA_FOR_S012 | ||
ABAP code using 7.40 inline data declarations to call FM SCENARIO_DATA_FOR_S012
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 VRSIO FROM P44V INTO @DATA(ld_vrsio). | ||||
| DATA(ld_vrsio) | = ' '. | |||
| "SELECT single DATUM FROM SY INTO @DATA(ld_date_from). | ||||
| "SELECT single DATUM FROM SY INTO @DATA(ld_date_to). | ||||
Search for further information about these or an SAP related objects