SAP GET_CALLED_FROM_ENVIRONMENT Function Module for NOTRANSL: Get callstack + analyze caller;CATT mode,GUI
GET_CALLED_FROM_ENVIRONMENT is a standard get called from environment SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for NOTRANSL: Get callstack + analyze caller;CATT mode,GUI 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 get called from environment FM, simply by entering the name GET_CALLED_FROM_ENVIRONMENT into the relevant SAP transaction such as SE37 or SE38.
Function Group: OIL1
Program Name: SAPLOIL1
Main Program:
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function GET_CALLED_FROM_ENVIRONMENT 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 'GET_CALLED_FROM_ENVIRONMENT'"NOTRANSL: Get callstack + analyze caller;CATT mode,GUI.
EXPORTING
* I_CALLPGM = "Program
* I_CALLEVENT = "DE-EN-LANG-SWITCH-NO-TRANSLATION
* I_CALLINDX = "DE-EN-LANG-SWITCH-NO-TRANSLATION
IMPORTING
E_REQU_CSLEVEL = "DE-EN-LANG-SWITCH-NO-TRANSLATION
E_CALL_W_GUI = "DE-EN-LANG-SWITCH-NO-TRANSLATION
E_CALL_FR_WEB = "DE-EN-LANG-SWITCH-NO-TRANSLATION
E_CALL_CATT = "DE-EN-LANG-SWITCH-NO-TRANSLATION
E_CALL_IN_WAN = "DE-EN-LANG-SWITCH-NO-TRANSLATION
E_CALL_BY_RFC = "DE-EN-LANG-SWITCH-NO-TRANSLATION
E_CALLER_SWCOMP = "Software Component
TABLES
* TE_CALLSTACK = "DE-EN-LANG-SWITCH-NO-TRANSLATION
* TE_WORKPROCESS_INFO = "DE-EN-LANG-SWITCH-NO-TRANSLATION
EXCEPTIONS
REQUESTED_CALLER_NOT_FOUND = 1 PARAMETER_ERROR = 2 OTHER_ERROR = 3
IMPORTING Parameters details for GET_CALLED_FROM_ENVIRONMENT
I_CALLPGM - Program
Data type: DBGLPROGOptional: Yes
Call by Reference: Yes
I_CALLEVENT - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: DBGLEVENTOptional: Yes
Call by Reference: Yes
I_CALLINDX - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: SY-TABIXOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for GET_CALLED_FROM_ENVIRONMENT
E_REQU_CSLEVEL - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: SYS_CALLSOptional: No
Call by Reference: Yes
E_CALL_W_GUI - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: SY-BATCHOptional: No
Call by Reference: Yes
E_CALL_FR_WEB - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: CHAR01Optional: No
Call by Reference: Yes
E_CALL_CATT - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: CHAR01Optional: No
Call by Reference: Yes
E_CALL_IN_WAN - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: AS4FLAGOptional: No
Call by Reference: Yes
E_CALL_BY_RFC - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: CHAR01Optional: No
Call by Reference: Yes
E_CALLER_SWCOMP - Software Component
Data type: DLVUNITOptional: No
Call by Reference: Yes
TABLES Parameters details for GET_CALLED_FROM_ENVIRONMENT
TE_CALLSTACK - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: SYS_CALLSTOptional: Yes
Call by Reference: Yes
TE_WORKPROCESS_INFO - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type: WPINFOOptional: Yes
Call by Reference: Yes
EXCEPTIONS details
REQUESTED_CALLER_NOT_FOUND - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: Yes
PARAMETER_ERROR - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: Yes
OTHER_ERROR - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: Yes
Copy and paste ABAP code example for GET_CALLED_FROM_ENVIRONMENT 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_i_callpgm | TYPE DBGLPROG, " | |||
| lt_te_callstack | TYPE STANDARD TABLE OF SYS_CALLST, " | |||
| lv_e_requ_cslevel | TYPE SYS_CALLS, " | |||
| lv_requested_caller_not_found | TYPE SYS_CALLS, " | |||
| lv_i_callevent | TYPE DBGLEVENT, " | |||
| lv_e_call_w_gui | TYPE SY-BATCH, " | |||
| lv_parameter_error | TYPE SY, " | |||
| lt_te_workprocess_info | TYPE STANDARD TABLE OF WPINFO, " | |||
| lv_i_callindx | TYPE SY-TABIX, " | |||
| lv_other_error | TYPE SY, " | |||
| lv_e_call_fr_web | TYPE CHAR01, " | |||
| lv_e_call_catt | TYPE CHAR01, " | |||
| lv_e_call_in_wan | TYPE AS4FLAG, " | |||
| lv_e_call_by_rfc | TYPE CHAR01, " | |||
| lv_e_caller_swcomp | TYPE DLVUNIT. " |
|   CALL FUNCTION 'GET_CALLED_FROM_ENVIRONMENT' "NOTRANSL: Get callstack + analyze caller;CATT mode,GUI |
| EXPORTING | ||
| I_CALLPGM | = lv_i_callpgm | |
| I_CALLEVENT | = lv_i_callevent | |
| I_CALLINDX | = lv_i_callindx | |
| IMPORTING | ||
| E_REQU_CSLEVEL | = lv_e_requ_cslevel | |
| E_CALL_W_GUI | = lv_e_call_w_gui | |
| E_CALL_FR_WEB | = lv_e_call_fr_web | |
| E_CALL_CATT | = lv_e_call_catt | |
| E_CALL_IN_WAN | = lv_e_call_in_wan | |
| E_CALL_BY_RFC | = lv_e_call_by_rfc | |
| E_CALLER_SWCOMP | = lv_e_caller_swcomp | |
| TABLES | ||
| TE_CALLSTACK | = lt_te_callstack | |
| TE_WORKPROCESS_INFO | = lt_te_workprocess_info | |
| EXCEPTIONS | ||
| REQUESTED_CALLER_NOT_FOUND = 1 | ||
| PARAMETER_ERROR = 2 | ||
| OTHER_ERROR = 3 | ||
| . " GET_CALLED_FROM_ENVIRONMENT | ||
ABAP code using 7.40 inline data declarations to call FM GET_CALLED_FROM_ENVIRONMENT
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 BATCH FROM SY INTO @DATA(ld_e_call_w_gui). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_i_callindx). | ||||
Search for further information about these or an SAP related objects