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

Function K_COPY_HIERARCHY_BY_CLASS 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_COPY_HIERARCHY_BY_CLASS'".
EXPORTING
E_SETID = "
E_COPY_CLASS = "
* E_INFO = "
* E_KOKRS = "
EXCEPTIONS
COPY_NOT_POSSIBLE = 1
IMPORTING Parameters details for K_COPY_HIERARCHY_BY_CLASS
E_SETID -
Data type: SETHIER-SETIDOptional: No
Call by Reference: No ( called with pass by value option)
E_COPY_CLASS -
Data type: SETHIER-SETCLASSOptional: No
Call by Reference: No ( called with pass by value option)
E_INFO -
Data type: RSDSEVENTS-FORMOptional: Yes
Call by Reference: No ( called with pass by value option)
E_KOKRS -
Data type: CSKS-KOKRSOptional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
COPY_NOT_POSSIBLE - You cannot copy
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_COPY_HIERARCHY_BY_CLASS 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_setid | TYPE SETHIER-SETID, " | |||
| lv_copy_not_possible | TYPE SETHIER, " | |||
| lv_e_copy_class | TYPE SETHIER-SETCLASS, " | |||
| lv_e_info | TYPE RSDSEVENTS-FORM, " | |||
| lv_e_kokrs | TYPE CSKS-KOKRS. " |
|   CALL FUNCTION 'K_COPY_HIERARCHY_BY_CLASS' " |
| EXPORTING | ||
| E_SETID | = lv_e_setid | |
| E_COPY_CLASS | = lv_e_copy_class | |
| E_INFO | = lv_e_info | |
| E_KOKRS | = lv_e_kokrs | |
| EXCEPTIONS | ||
| COPY_NOT_POSSIBLE = 1 | ||
| . " K_COPY_HIERARCHY_BY_CLASS | ||
ABAP code using 7.40 inline data declarations to call FM K_COPY_HIERARCHY_BY_CLASS
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 SETID FROM SETHIER INTO @DATA(ld_e_setid). | ||||
| "SELECT single SETCLASS FROM SETHIER INTO @DATA(ld_e_copy_class). | ||||
| "SELECT single FORM FROM RSDSEVENTS INTO @DATA(ld_e_info). | ||||
| "SELECT single KOKRS FROM CSKS INTO @DATA(ld_e_kokrs). | ||||
Search for further information about these or an SAP related objects