SAP UPDATE_SCRSTACK_USING Function Module for Update screen stack in both directions
UPDATE_SCRSTACK_USING is a standard update scrstack using SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Update screen stack in both directions 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 update scrstack using FM, simply by entering the name UPDATE_SCRSTACK_USING into the relevant SAP transaction such as SE37 or SE38.
Function Group: LMGT
Program Name: SAPLLMGT
Main Program: SAPLLMGT
Appliation area: L
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function UPDATE_SCRSTACK_USING 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 'UPDATE_SCRSTACK_USING'"Update screen stack in both directions.
EXPORTING
I_CURRENT_SCREEN = "Screen number to add
* I_OPERATION = 'IN' "Add or delete a screen from stack
I_INT_TABLE_NAME = "
I_SCRSTACK_INDEX = "
* I_CURRENT_LINE = "Internal table, current line index
IMPORTING
O_PREV_SCREEN = "ABAP program, number of current screen
O_INT_TABLE_NAME = "
O_SCRSTACK_INDEX = "
O_CURRENT_LINE = "Internal table, current line index
Customer Function user exits
Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.EXIT_SAPLLMGT_001 Extension for barcode translation
EXIT_SAPLLMGT_083 User exit for print
IMPORTING Parameters details for UPDATE_SCRSTACK_USING
I_CURRENT_SCREEN - Screen number to add
Data type: SY-DYNNROptional: No
Call by Reference: No ( called with pass by value option)
I_OPERATION - Add or delete a screen from stack
Data type:Default: 'IN'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_INT_TABLE_NAME -
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
I_SCRSTACK_INDEX -
Data type: SY-TABIXOptional: No
Call by Reference: Yes
I_CURRENT_LINE - Internal table, current line index
Data type: SY-TABIXOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for UPDATE_SCRSTACK_USING
O_PREV_SCREEN - ABAP program, number of current screen
Data type: SY-DYNNROptional: No
Call by Reference: No ( called with pass by value option)
O_INT_TABLE_NAME -
Data type: COptional: No
Call by Reference: No ( called with pass by value option)
O_SCRSTACK_INDEX -
Data type: SY-TABIXOptional: No
Call by Reference: Yes
O_CURRENT_LINE - Internal table, current line index
Data type: SY-TABIXOptional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for UPDATE_SCRSTACK_USING 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_o_prev_screen | TYPE SY-DYNNR, " | |||
| lv_i_current_screen | TYPE SY-DYNNR, " | |||
| lv_i_operation | TYPE SY, " 'IN' | |||
| lv_o_int_table_name | TYPE C, " | |||
| lv_i_int_table_name | TYPE C, " | |||
| lv_o_scrstack_index | TYPE SY-TABIX, " | |||
| lv_o_current_line | TYPE SY-TABIX, " | |||
| lv_i_scrstack_index | TYPE SY-TABIX, " | |||
| lv_i_current_line | TYPE SY-TABIX. " |
|   CALL FUNCTION 'UPDATE_SCRSTACK_USING' "Update screen stack in both directions |
| EXPORTING | ||
| I_CURRENT_SCREEN | = lv_i_current_screen | |
| I_OPERATION | = lv_i_operation | |
| I_INT_TABLE_NAME | = lv_i_int_table_name | |
| I_SCRSTACK_INDEX | = lv_i_scrstack_index | |
| I_CURRENT_LINE | = lv_i_current_line | |
| IMPORTING | ||
| O_PREV_SCREEN | = lv_o_prev_screen | |
| O_INT_TABLE_NAME | = lv_o_int_table_name | |
| O_SCRSTACK_INDEX | = lv_o_scrstack_index | |
| O_CURRENT_LINE | = lv_o_current_line | |
| . " UPDATE_SCRSTACK_USING | ||
ABAP code using 7.40 inline data declarations to call FM UPDATE_SCRSTACK_USING
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 DYNNR FROM SY INTO @DATA(ld_o_prev_screen). | ||||
| "SELECT single DYNNR FROM SY INTO @DATA(ld_i_current_screen). | ||||
| DATA(ld_i_operation) | = 'IN'. | |||
| "SELECT single TABIX FROM SY INTO @DATA(ld_o_scrstack_index). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_o_current_line). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_i_scrstack_index). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_i_current_line). | ||||
Search for further information about these or an SAP related objects