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

Function K_HIERARCHY_UPDATE 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_HIERARCHY_UPDATE'".
EXPORTING
* E_CLASS = GLOBAL_CLASS "Set Class
* E_KOKRS = GLOBAL_KOKRS "
* E_KTOPL = GLOBAL_KTOPL "
* E_INFO = GLOBAL_HIER_INFO "
* E_UPDATE_ALL_NODES = ' ' "
* E_CLIENT = SY-MANDT "Client
* E_MODE = '01' "Maintenance mode
* E_WITH_MESSAGE = 'X' "
TABLES
T_NODES = "Hierarchy Node
T_VALUES = "
T_FORMULA = "Formulas
T_FIELD_INFO = "
* T_ALESETS = "
EXCEPTIONS
UPDATE_ERROR = 1
IMPORTING Parameters details for K_HIERARCHY_UPDATE
E_CLASS - Set Class
Data type: SETHIER-SETCLASSDefault: GLOBAL_CLASS
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_KOKRS -
Data type: TKA01-KOKRSDefault: GLOBAL_KOKRS
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_KTOPL -
Data type: TKA01-KTOPLDefault: GLOBAL_KTOPL
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_INFO -
Data type: GRPHINFODefault: GLOBAL_HIER_INFO
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_UPDATE_ALL_NODES -
Data type: SY-DATARDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_CLIENT - Client
Data type: SY-MANDTDefault: SY-MANDT
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_MODE - Maintenance mode
Data type: TACT-ACTVTDefault: '01'
Optional: Yes
Call by Reference: No ( called with pass by value option)
E_WITH_MESSAGE -
Data type: SY-DATARDefault: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for K_HIERARCHY_UPDATE
T_NODES - Hierarchy Node
Data type: GSETH_NODE_TABOptional: No
Call by Reference: No ( called with pass by value option)
T_VALUES -
Data type: GSETH_VAL_TABOptional: No
Call by Reference: No ( called with pass by value option)
T_FORMULA - Formulas
Data type: GSETH_FORM_TABOptional: No
Call by Reference: No ( called with pass by value option)
T_FIELD_INFO -
Data type: GSETH_INFO_TABOptional: No
Call by Reference: No ( called with pass by value option)
T_ALESETS -
Data type: ALESETSOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
UPDATE_ERROR - Error when saving
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_HIERARCHY_UPDATE 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_e_class | TYPE SETHIER-SETCLASS, " GLOBAL_CLASS | |||
| lt_t_nodes | TYPE STANDARD TABLE OF GSETH_NODE_TAB, " | |||
| lv_update_error | TYPE GSETH_NODE_TAB, " | |||
| lv_e_kokrs | TYPE TKA01-KOKRS, " GLOBAL_KOKRS | |||
| lt_t_values | TYPE STANDARD TABLE OF GSETH_VAL_TAB, " | |||
| lv_e_ktopl | TYPE TKA01-KTOPL, " GLOBAL_KTOPL | |||
| lt_t_formula | TYPE STANDARD TABLE OF GSETH_FORM_TAB, " | |||
| lv_e_info | TYPE GRPHINFO, " GLOBAL_HIER_INFO | |||
| lt_t_field_info | TYPE STANDARD TABLE OF GSETH_INFO_TAB, " | |||
| lt_t_alesets | TYPE STANDARD TABLE OF ALESETS, " | |||
| lv_e_update_all_nodes | TYPE SY-DATAR, " SPACE | |||
| lv_e_client | TYPE SY-MANDT, " SY-MANDT | |||
| lv_e_mode | TYPE TACT-ACTVT, " '01' | |||
| lv_e_with_message | TYPE SY-DATAR. " 'X' |
|   CALL FUNCTION 'K_HIERARCHY_UPDATE' " |
| EXPORTING | ||
| E_CLASS | = lv_e_class | |
| E_KOKRS | = lv_e_kokrs | |
| E_KTOPL | = lv_e_ktopl | |
| E_INFO | = lv_e_info | |
| E_UPDATE_ALL_NODES | = lv_e_update_all_nodes | |
| E_CLIENT | = lv_e_client | |
| E_MODE | = lv_e_mode | |
| E_WITH_MESSAGE | = lv_e_with_message | |
| TABLES | ||
| T_NODES | = lt_t_nodes | |
| T_VALUES | = lt_t_values | |
| T_FORMULA | = lt_t_formula | |
| T_FIELD_INFO | = lt_t_field_info | |
| T_ALESETS | = lt_t_alesets | |
| EXCEPTIONS | ||
| UPDATE_ERROR = 1 | ||
| . " K_HIERARCHY_UPDATE | ||
ABAP code using 7.40 inline data declarations to call FM K_HIERARCHY_UPDATE
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 SETCLASS FROM SETHIER INTO @DATA(ld_e_class). | ||||
| DATA(ld_e_class) | = GLOBAL_CLASS. | |||
| "SELECT single KOKRS FROM TKA01 INTO @DATA(ld_e_kokrs). | ||||
| DATA(ld_e_kokrs) | = GLOBAL_KOKRS. | |||
| "SELECT single KTOPL FROM TKA01 INTO @DATA(ld_e_ktopl). | ||||
| DATA(ld_e_ktopl) | = GLOBAL_KTOPL. | |||
| DATA(ld_e_info) | = GLOBAL_HIER_INFO. | |||
| "SELECT single DATAR FROM SY INTO @DATA(ld_e_update_all_nodes). | ||||
| DATA(ld_e_update_all_nodes) | = ' '. | |||
| "SELECT single MANDT FROM SY INTO @DATA(ld_e_client). | ||||
| DATA(ld_e_client) | = SY-MANDT. | |||
| "SELECT single ACTVT FROM TACT INTO @DATA(ld_e_mode). | ||||
| DATA(ld_e_mode) | = '01'. | |||
| "SELECT single DATAR FROM SY INTO @DATA(ld_e_with_message). | ||||
| DATA(ld_e_with_message) | = 'X'. | |||
Search for further information about these or an SAP related objects