SAP K_KKR_ACTIVE_HIERARCHY_GET Function Module for
K_KKR_ACTIVE_HIERARCHY_GET is a standard k kkr active hierarchy get 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 k kkr active hierarchy get FM, simply by entering the name K_KKR_ACTIVE_HIERARCHY_GET into the relevant SAP transaction such as SE37 or SE38.
Function Group: KKRR
Program Name: SAPLKKRR
Main Program:
Appliation area: K
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function K_KKR_ACTIVE_HIERARCHY_GET 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 'K_KKR_ACTIVE_HIERARCHY_GET'".
EXPORTING
HIART = "Hierarchy type
* KOKRS = "Selected controlling area
* HIEID = "Selected hierarchy ID
* NO_BUFFER = "
* AHIE_LIST = "
* KOKRS_LIST = "
* I_ROBART = "
IMPORTING
HIEID = "Selected hierarchy ID
KOKRS = "Selected controlling area
TABLES
* AHIE_TBL = "
* KOKRS_TBL = "
EXCEPTIONS
HIERARCHY_TYPE_NOT_EXIST = 1 NO_ACTIVE_HIERARCHY = 2 NO_HIERARCHY_PICKED = 3 SYSTEM_FAILURE = 4 WRONG_HIERARCHY_TYPE = 5 NO_ACTIVE_KOKRS = 6 NO_KOKRS_PICKED = 7 WRONG_INPUT = 8
IMPORTING Parameters details for K_KKR_ACTIVE_HIERARCHY_GET
HIART - Hierarchy type
Data type: KKRDYN00-HIEARTOptional: No
Call by Reference: No ( called with pass by value option)
KOKRS - Selected controlling area
Data type: KKRDYN00-KOKRSOptional: Yes
Call by Reference: No ( called with pass by value option)
HIEID - Selected hierarchy ID
Data type: KKRDYN00-HIERIDOptional: Yes
Call by Reference: No ( called with pass by value option)
NO_BUFFER -
Data type: SY-BATCHOptional: Yes
Call by Reference: No ( called with pass by value option)
AHIE_LIST -
Data type: SY-BATCHOptional: Yes
Call by Reference: No ( called with pass by value option)
KOKRS_LIST -
Data type: SY-BATCHOptional: Yes
Call by Reference: No ( called with pass by value option)
I_ROBART -
Data type: TKKR4-ROBARTOptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_KKR_ACTIVE_HIERARCHY_GET
HIEID - Selected hierarchy ID
Data type: KKRDYN00-HIERIDOptional: No
Call by Reference: No ( called with pass by value option)
KOKRS - Selected controlling area
Data type: KKRDYN00-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for K_KKR_ACTIVE_HIERARCHY_GET
AHIE_TBL -
Data type: KKR_AHIE_STROptional: Yes
Call by Reference: No ( called with pass by value option)
KOKRS_TBL -
Data type: KKR_AKOKRS_STROptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
HIERARCHY_TYPE_NOT_EXIST -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_ACTIVE_HIERARCHY - There is no active hierarchy ID
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_HIERARCHY_PICKED - No hierarchy was selected
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
SYSTEM_FAILURE - Internal system error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
WRONG_HIERARCHY_TYPE - Hierarchy type is not supported
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_ACTIVE_KOKRS -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NO_KOKRS_PICKED - No controlling area was selected
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
WRONG_INPUT -
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_KKR_ACTIVE_HIERARCHY_GET 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_hiart | TYPE KKRDYN00-HIEART, " | |||
| lv_hieid | TYPE KKRDYN00-HIERID, " | |||
| lt_ahie_tbl | TYPE STANDARD TABLE OF KKR_AHIE_STR, " | |||
| lv_hierarchy_type_not_exist | TYPE KKR_AHIE_STR, " | |||
| lv_kokrs | TYPE KKRDYN00-KOKRS, " | |||
| lv_kokrs | TYPE KKRDYN00-KOKRS, " | |||
| lt_kokrs_tbl | TYPE STANDARD TABLE OF KKR_AKOKRS_STR, " | |||
| lv_no_active_hierarchy | TYPE KKR_AKOKRS_STR, " | |||
| lv_hieid | TYPE KKRDYN00-HIERID, " | |||
| lv_no_hierarchy_picked | TYPE KKRDYN00, " | |||
| lv_no_buffer | TYPE SY-BATCH, " | |||
| lv_system_failure | TYPE SY, " | |||
| lv_ahie_list | TYPE SY-BATCH, " | |||
| lv_wrong_hierarchy_type | TYPE SY, " | |||
| lv_kokrs_list | TYPE SY-BATCH, " | |||
| lv_no_active_kokrs | TYPE SY, " | |||
| lv_i_robart | TYPE TKKR4-ROBART, " | |||
| lv_no_kokrs_picked | TYPE TKKR4, " | |||
| lv_wrong_input | TYPE TKKR4. " |
|   CALL FUNCTION 'K_KKR_ACTIVE_HIERARCHY_GET' " |
| EXPORTING | ||
| HIART | = lv_hiart | |
| KOKRS | = lv_kokrs | |
| HIEID | = lv_hieid | |
| NO_BUFFER | = lv_no_buffer | |
| AHIE_LIST | = lv_ahie_list | |
| KOKRS_LIST | = lv_kokrs_list | |
| I_ROBART | = lv_i_robart | |
| IMPORTING | ||
| HIEID | = lv_hieid | |
| KOKRS | = lv_kokrs | |
| TABLES | ||
| AHIE_TBL | = lt_ahie_tbl | |
| KOKRS_TBL | = lt_kokrs_tbl | |
| EXCEPTIONS | ||
| HIERARCHY_TYPE_NOT_EXIST = 1 | ||
| NO_ACTIVE_HIERARCHY = 2 | ||
| NO_HIERARCHY_PICKED = 3 | ||
| SYSTEM_FAILURE = 4 | ||
| WRONG_HIERARCHY_TYPE = 5 | ||
| NO_ACTIVE_KOKRS = 6 | ||
| NO_KOKRS_PICKED = 7 | ||
| WRONG_INPUT = 8 | ||
| . " K_KKR_ACTIVE_HIERARCHY_GET | ||
ABAP code using 7.40 inline data declarations to call FM K_KKR_ACTIVE_HIERARCHY_GET
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 HIEART FROM KKRDYN00 INTO @DATA(ld_hiart). | ||||
| "SELECT single HIERID FROM KKRDYN00 INTO @DATA(ld_hieid). | ||||
| "SELECT single KOKRS FROM KKRDYN00 INTO @DATA(ld_kokrs). | ||||
| "SELECT single KOKRS FROM KKRDYN00 INTO @DATA(ld_kokrs). | ||||
| "SELECT single HIERID FROM KKRDYN00 INTO @DATA(ld_hieid). | ||||
| "SELECT single BATCH FROM SY INTO @DATA(ld_no_buffer). | ||||
| "SELECT single BATCH FROM SY INTO @DATA(ld_ahie_list). | ||||
| "SELECT single BATCH FROM SY INTO @DATA(ld_kokrs_list). | ||||
| "SELECT single ROBART FROM TKKR4 INTO @DATA(ld_i_robart). | ||||
Search for further information about these or an SAP related objects