SAP REF_LOCATION_HIERARCHY Function Module for
REF_LOCATION_HIERARCHY is a standard ref location hierarchy SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, 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 ref location hierarchy FM, simply by entering the name REF_LOCATION_HIERARCHY into the relevant SAP transaction such as SE37 or SE38.
Function Group: ILO4
Program Name: SAPLILO4
Main Program:
Appliation area: I
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function REF_LOCATION_HIERARCHY 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 'REF_LOCATION_HIERARCHY'".
EXPORTING
* SPRAS = SY-LANGU "Language Key
* LEVEL_LIMIT = '0' "ABAP System Field: Loop Index
* TABSTRUCTURE = 'IRLOT' "Table Name
* INCLUDING_ROOT = ' ' "Yes/No (X/ )
* BUFFER_BYPASS = ' ' "Yes/No (X/ )
IMPORTING
LEVEL_FOUND = "ABAP System Field: Loop Index
TABLES
ROOT_TAB = "DE-EN-LANG-SWITCH-NO-TRANSLATION
IRLO_TAB = "DE-EN-LANG-SWITCH-NO-TRANSLATION
EXCEPTIONS
ROOT_NOT_FOUND = 1 STRUCTURE_NOT_POSSIBLE = 2
IMPORTING Parameters details for REF_LOCATION_HIERARCHY
SPRAS - Language Key
Data type: IRLO-SPRASDefault: SY-LANGU
Optional: Yes
Call by Reference: No ( called with pass by value option)
LEVEL_LIMIT - ABAP System Field: Loop Index
Data type: SY-INDEXDefault: '0'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABSTRUCTURE - Table Name
Data type: DD02D-TABNAMEDefault: 'IRLOT'
Optional: Yes
Call by Reference: No ( called with pass by value option)
INCLUDING_ROOT - Yes/No (X/ )
Data type: IREF-IINDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
BUFFER_BYPASS - Yes/No (X/ )
Data type: IREF-IINDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for REF_LOCATION_HIERARCHY
LEVEL_FOUND - ABAP System Field: Loop Index
Data type: SY-INDEXOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for REF_LOCATION_HIERARCHY
ROOT_TAB - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
IRLO_TAB - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
ROOT_NOT_FOUND - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
STRUCTURE_NOT_POSSIBLE - DE-EN-LANG-SWITCH-NO-TRANSLATION
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for REF_LOCATION_HIERARCHY 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_spras | TYPE IRLO-SPRAS, " SY-LANGU | |||
| lt_root_tab | TYPE STANDARD TABLE OF IRLO, " | |||
| lv_level_found | TYPE SY-INDEX, " | |||
| lv_root_not_found | TYPE SY, " | |||
| lt_irlo_tab | TYPE STANDARD TABLE OF SY, " | |||
| lv_level_limit | TYPE SY-INDEX, " '0' | |||
| lv_structure_not_possible | TYPE SY, " | |||
| lv_tabstructure | TYPE DD02D-TABNAME, " 'IRLOT' | |||
| lv_including_root | TYPE IREF-IIND, " SPACE | |||
| lv_buffer_bypass | TYPE IREF-IIND. " SPACE |
|   CALL FUNCTION 'REF_LOCATION_HIERARCHY' " |
| EXPORTING | ||
| SPRAS | = lv_spras | |
| LEVEL_LIMIT | = lv_level_limit | |
| TABSTRUCTURE | = lv_tabstructure | |
| INCLUDING_ROOT | = lv_including_root | |
| BUFFER_BYPASS | = lv_buffer_bypass | |
| IMPORTING | ||
| LEVEL_FOUND | = lv_level_found | |
| TABLES | ||
| ROOT_TAB | = lt_root_tab | |
| IRLO_TAB | = lt_irlo_tab | |
| EXCEPTIONS | ||
| ROOT_NOT_FOUND = 1 | ||
| STRUCTURE_NOT_POSSIBLE = 2 | ||
| . " REF_LOCATION_HIERARCHY | ||
ABAP code using 7.40 inline data declarations to call FM REF_LOCATION_HIERARCHY
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 SPRAS FROM IRLO INTO @DATA(ld_spras). | ||||
| DATA(ld_spras) | = SY-LANGU. | |||
| "SELECT single INDEX FROM SY INTO @DATA(ld_level_found). | ||||
| "SELECT single INDEX FROM SY INTO @DATA(ld_level_limit). | ||||
| DATA(ld_level_limit) | = '0'. | |||
| "SELECT single TABNAME FROM DD02D INTO @DATA(ld_tabstructure). | ||||
| DATA(ld_tabstructure) | = 'IRLOT'. | |||
| "SELECT single IIND FROM IREF INTO @DATA(ld_including_root). | ||||
| DATA(ld_including_root) | = ' '. | |||
| "SELECT single IIND FROM IREF INTO @DATA(ld_buffer_bypass). | ||||
| DATA(ld_buffer_bypass) | = ' '. | |||
Search for further information about these or an SAP related objects