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

Function K_KKB_COST_OBJECT_TREE 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_KKB_COST_OBJECT_TREE'".
EXPORTING
* I_DATBI = '99991231' "Validity date
* I_OBART = "Object type
I_KOKRS = "Controlling area
* I_ANZART = 'V' "V: Summarization texts S: Master record texts
* I_STATUS = '0' "0:Output 1:With input 3:With values
* I_WINDOW = 'X' "' ':Popup 'X': Full screen
* I_BEGROW = 5 "First line of dialog box
* I_BEGCOL = 10 "First column of dialog box
* I_ENDROW = 25 "Last line of dialog box
* I_ENDCOL = 70 "Last column of dialog box
* I_ANWEND = '1' "Application for reporting
* I_KSTRG = "Hierarchy ID
* I_AUFTRAG = ' ' "Import single objects? (Yes: 'X')
* I_TOTAL = ' ' "'X': Also imports higher nodes
* I_TAB = 'X' "Justifies values to a height
* I_ROOT = 0 "Index: Highest node of the display (detail)
* I_FORM = ' ' "Form routines for own function codes
* I_PRG = ' ' "Program that contains I_Form
* I_OBJW = ' ' "'X': Object currency, ' ': Controlling area currency
* I_MATER = "Material number
* I_VERID = "Production version
* I_PLNNR = "Task list group key
* I_PLNAL = "Group counter
* I_WERK = "Plant
* I_SAFNR = "Run schedule header number
* I_AUFNR = "Order number
IMPORTING
E_MODIFY = "Was data changed? (Yes: 'Y')
E_F15 = "Was F15 pressed w/o end of application? Yes:Y
E_VARHIBG = "Var. hierarchy term for F4 help
E_UCOMM = "User command
E_INDEX = "Index of selected node
E_AUSSCHNITT = "Index of node set on detail
TABLES
* TBL_KKHIE_E = "Table with hierarchy nodes
* TBL_COOBJ_E = "Table with summarization hierarchy nodes
* TBL_EXCLUDE = "Table with inactive function codes
* GLOBALS = "Report parameters
EXCEPTIONS
NO_OBJECT_FOUND = 1
IMPORTING Parameters details for K_KKB_COST_OBJECT_TREE
I_DATBI - Validity date
Data type: CKPH-DATBIDefault: '99991231'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_OBART - Object type
Data type: KKHIE-OBARTOptional: Yes
Call by Reference: No ( called with pass by value option)
I_KOKRS - Controlling area
Data type: TKA01-KOKRSOptional: No
Call by Reference: No ( called with pass by value option)
I_ANZART - V: Summarization texts S: Master record texts
Data type:Default: 'V'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_STATUS - 0:Output 1:With input 3:With values
Data type:Default: '0'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_WINDOW - ' ':Popup 'X': Full screen
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BEGROW - First line of dialog box
Data type: IDefault: 5
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_BEGCOL - First column of dialog box
Data type: IDefault: 10
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ENDROW - Last line of dialog box
Data type: IDefault: 25
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ENDCOL - Last column of dialog box
Data type: IDefault: 70
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ANWEND - Application for reporting
Data type: TKKB1-ANWDefault: '1'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_KSTRG - Hierarchy ID
Data type: CKPH-KSTRGOptional: Yes
Call by Reference: No ( called with pass by value option)
I_AUFTRAG - Import single objects? (Yes: 'X')
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TOTAL - 'X': Also imports higher nodes
Data type: SY-INPUTDefault: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_TAB - Justifies values to a height
Data type:Default: 'X'
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_ROOT - Index: Highest node of the display (detail)
Data type: SY-TABIXOptional: Yes
Call by Reference: No ( called with pass by value option)
I_FORM - Form routines for own function codes
Data type:Default: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_PRG - Program that contains I_Form
Data type: SY-REPIDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_OBJW - 'X': Object currency, ' ': Controlling area currency
Data type:Default: ' '
Optional: Yes
Call by Reference: No ( called with pass by value option)
I_MATER - Material number
Data type: MARA-MATNROptional: Yes
Call by Reference: No ( called with pass by value option)
I_VERID - Production version
Data type: KKHIE-VERIDOptional: Yes
Call by Reference: No ( called with pass by value option)
I_PLNNR - Task list group key
Data type: KKHIE-PLNNROptional: Yes
Call by Reference: No ( called with pass by value option)
I_PLNAL - Group counter
Data type: KKHIE-PLNALOptional: Yes
Call by Reference: No ( called with pass by value option)
I_WERK - Plant
Data type: T001W-WERKSOptional: Yes
Call by Reference: No ( called with pass by value option)
I_SAFNR - Run schedule header number
Data type: SAFK-AUFNROptional: Yes
Call by Reference: No ( called with pass by value option)
I_AUFNR - Order number
Data type: AUFK-AUFNROptional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for K_KKB_COST_OBJECT_TREE
E_MODIFY - Was data changed? (Yes: 'Y')
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
E_F15 - Was F15 pressed w/o end of application? Yes:Y
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
E_VARHIBG - Var. hierarchy term for F4 help
Data type: CKRCO-VARHIEBGOptional: No
Call by Reference: No ( called with pass by value option)
E_UCOMM - User command
Data type: SY-UCOMMOptional: No
Call by Reference: No ( called with pass by value option)
E_INDEX - Index of selected node
Data type: SY-TABIXOptional: No
Call by Reference: No ( called with pass by value option)
E_AUSSCHNITT - Index of node set on detail
Data type: SY-TABIXOptional: No
Call by Reference: No ( called with pass by value option)
TABLES Parameters details for K_KKB_COST_OBJECT_TREE
TBL_KKHIE_E - Table with hierarchy nodes
Data type: KKHIEOptional: Yes
Call by Reference: No ( called with pass by value option)
TBL_COOBJ_E - Table with summarization hierarchy nodes
Data type: KKRVDCOOBJOptional: Yes
Call by Reference: No ( called with pass by value option)
TBL_EXCLUDE - Table with inactive function codes
Data type:Optional: Yes
Call by Reference: No ( called with pass by value option)
GLOBALS - Report parameters
Data type: KKB2Optional: Yes
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_OBJECT_FOUND - Cost object entered was not found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for K_KKB_COST_OBJECT_TREE 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_datbi | TYPE CKPH-DATBI, " '99991231' | |||
| lv_e_modify | TYPE CKPH, " | |||
| lt_tbl_kkhie_e | TYPE STANDARD TABLE OF KKHIE, " | |||
| lv_no_object_found | TYPE KKHIE, " | |||
| lv_i_obart | TYPE KKHIE-OBART, " | |||
| lv_i_kokrs | TYPE TKA01-KOKRS, " | |||
| lv_i_anzart | TYPE TKA01, " 'V' | |||
| lv_i_status | TYPE TKA01, " '0' | |||
| lv_i_window | TYPE TKA01, " 'X' | |||
| lv_i_begrow | TYPE I, " 5 | |||
| lv_i_begcol | TYPE I, " 10 | |||
| lv_i_endrow | TYPE I, " 25 | |||
| lv_i_endcol | TYPE I, " 70 | |||
| lv_i_anwend | TYPE TKKB1-ANW, " '1' | |||
| lv_e_f15 | TYPE TKKB1, " | |||
| lv_i_kstrg | TYPE CKPH-KSTRG, " | |||
| lt_tbl_coobj_e | TYPE STANDARD TABLE OF KKRVDCOOBJ, " | |||
| lv_i_auftrag | TYPE KKRVDCOOBJ, " ' ' | |||
| lv_i_total | TYPE SY-INPUT, " ' ' | |||
| lv_i_tab | TYPE SY, " 'X' | |||
| lv_i_root | TYPE SY-TABIX, " 0 | |||
| lv_i_form | TYPE SY, " SPACE | |||
| lv_i_prg | TYPE SY-REPID, " SPACE | |||
| lv_i_objw | TYPE SY, " ' ' | |||
| lv_i_mater | TYPE MARA-MATNR, " | |||
| lv_e_varhibg | TYPE CKRCO-VARHIEBG, " | |||
| lt_tbl_exclude | TYPE STANDARD TABLE OF CKRCO, " | |||
| lv_e_ucomm | TYPE SY-UCOMM, " | |||
| lt_globals | TYPE STANDARD TABLE OF KKB2, " | |||
| lv_i_verid | TYPE KKHIE-VERID, " | |||
| lv_e_index | TYPE SY-TABIX, " | |||
| lv_i_plnnr | TYPE KKHIE-PLNNR, " | |||
| lv_i_plnal | TYPE KKHIE-PLNAL, " | |||
| lv_e_ausschnitt | TYPE SY-TABIX, " | |||
| lv_i_werk | TYPE T001W-WERKS, " | |||
| lv_i_safnr | TYPE SAFK-AUFNR, " | |||
| lv_i_aufnr | TYPE AUFK-AUFNR. " |
|   CALL FUNCTION 'K_KKB_COST_OBJECT_TREE' " |
| EXPORTING | ||
| I_DATBI | = lv_i_datbi | |
| I_OBART | = lv_i_obart | |
| I_KOKRS | = lv_i_kokrs | |
| I_ANZART | = lv_i_anzart | |
| I_STATUS | = lv_i_status | |
| I_WINDOW | = lv_i_window | |
| I_BEGROW | = lv_i_begrow | |
| I_BEGCOL | = lv_i_begcol | |
| I_ENDROW | = lv_i_endrow | |
| I_ENDCOL | = lv_i_endcol | |
| I_ANWEND | = lv_i_anwend | |
| I_KSTRG | = lv_i_kstrg | |
| I_AUFTRAG | = lv_i_auftrag | |
| I_TOTAL | = lv_i_total | |
| I_TAB | = lv_i_tab | |
| I_ROOT | = lv_i_root | |
| I_FORM | = lv_i_form | |
| I_PRG | = lv_i_prg | |
| I_OBJW | = lv_i_objw | |
| I_MATER | = lv_i_mater | |
| I_VERID | = lv_i_verid | |
| I_PLNNR | = lv_i_plnnr | |
| I_PLNAL | = lv_i_plnal | |
| I_WERK | = lv_i_werk | |
| I_SAFNR | = lv_i_safnr | |
| I_AUFNR | = lv_i_aufnr | |
| IMPORTING | ||
| E_MODIFY | = lv_e_modify | |
| E_F15 | = lv_e_f15 | |
| E_VARHIBG | = lv_e_varhibg | |
| E_UCOMM | = lv_e_ucomm | |
| E_INDEX | = lv_e_index | |
| E_AUSSCHNITT | = lv_e_ausschnitt | |
| TABLES | ||
| TBL_KKHIE_E | = lt_tbl_kkhie_e | |
| TBL_COOBJ_E | = lt_tbl_coobj_e | |
| TBL_EXCLUDE | = lt_tbl_exclude | |
| GLOBALS | = lt_globals | |
| EXCEPTIONS | ||
| NO_OBJECT_FOUND = 1 | ||
| . " K_KKB_COST_OBJECT_TREE | ||
ABAP code using 7.40 inline data declarations to call FM K_KKB_COST_OBJECT_TREE
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 DATBI FROM CKPH INTO @DATA(ld_i_datbi). | ||||
| DATA(ld_i_datbi) | = '99991231'. | |||
| "SELECT single OBART FROM KKHIE INTO @DATA(ld_i_obart). | ||||
| "SELECT single KOKRS FROM TKA01 INTO @DATA(ld_i_kokrs). | ||||
| DATA(ld_i_anzart) | = 'V'. | |||
| DATA(ld_i_status) | = '0'. | |||
| DATA(ld_i_window) | = 'X'. | |||
| DATA(ld_i_begrow) | = 5. | |||
| DATA(ld_i_begcol) | = 10. | |||
| DATA(ld_i_endrow) | = 25. | |||
| DATA(ld_i_endcol) | = 70. | |||
| "SELECT single ANW FROM TKKB1 INTO @DATA(ld_i_anwend). | ||||
| DATA(ld_i_anwend) | = '1'. | |||
| "SELECT single KSTRG FROM CKPH INTO @DATA(ld_i_kstrg). | ||||
| DATA(ld_i_auftrag) | = ' '. | |||
| "SELECT single INPUT FROM SY INTO @DATA(ld_i_total). | ||||
| DATA(ld_i_total) | = ' '. | |||
| DATA(ld_i_tab) | = 'X'. | |||
| "SELECT single TABIX FROM SY INTO @DATA(ld_i_root). | ||||
| DATA(ld_i_form) | = ' '. | |||
| "SELECT single REPID FROM SY INTO @DATA(ld_i_prg). | ||||
| DATA(ld_i_prg) | = ' '. | |||
| DATA(ld_i_objw) | = ' '. | |||
| "SELECT single MATNR FROM MARA INTO @DATA(ld_i_mater). | ||||
| "SELECT single VARHIEBG FROM CKRCO INTO @DATA(ld_e_varhibg). | ||||
| "SELECT single UCOMM FROM SY INTO @DATA(ld_e_ucomm). | ||||
| "SELECT single VERID FROM KKHIE INTO @DATA(ld_i_verid). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_e_index). | ||||
| "SELECT single PLNNR FROM KKHIE INTO @DATA(ld_i_plnnr). | ||||
| "SELECT single PLNAL FROM KKHIE INTO @DATA(ld_i_plnal). | ||||
| "SELECT single TABIX FROM SY INTO @DATA(ld_e_ausschnitt). | ||||
| "SELECT single WERKS FROM T001W INTO @DATA(ld_i_werk). | ||||
| "SELECT single AUFNR FROM SAFK INTO @DATA(ld_i_safnr). | ||||
| "SELECT single AUFNR FROM AUFK INTO @DATA(ld_i_aufnr). | ||||
Search for further information about these or an SAP related objects