‎2007 Oct 03 12:12 PM
Hi,
This is my requirement.
the user will give a range of cost centre group on the selection screen as input.
take the first parent cost centre group and check whether it has any child cost centre groups and check if those child cost centre groups has any other subchilds. and find all the cost centres that exist for all the parent , child and subchilds.
for eg.
10000-->01
1000>10 1010>11 1011-->12
1001-->20
1020-->30.
20000-->40
2000-->50
2001-->60
2020-->70
here 10000 is the the parent cost centre group it has a child CCG has 1000,1010 and 1011 and 1000 has a child 1001 and 1001 has a child 1020.
All these CCG(Cost centre group) has cost centre like 01 for 10000 and 10 for 1000 and 11 for 1010 and 12 for 1011 and 20 for 1001 and 30 for 1020.
Like this hierarchy continues.
Now if the customer gives CCG 10000 alone as the input how can we find out all the child CCG for it and then their corresponding cost centres of them using a recursive function.
can anyone explain me the logic of this.
Regards,
Phyrose.
‎2007 Oct 03 12:22 PM
Hi
use the fun module
G_SET_TREE_IMPORT
pass the setid which is the concatenation of class, subclass and the CC group together
see the tables setnode and setleaf also.
Regards
Anji
‎2007 Oct 03 12:29 PM
HI,
Look at the function module <b>C13C_TREE_IMPORT</b> and look at the below link
Regards
Sudheer
‎2007 Oct 03 12:29 PM
Use the following function module
CALL FUNCTION 'K_COSTELEM_SELECT'
EXPORTING
kokrs = p-kokrs
ce_group = p-kagru
TABLES
it_result = t_cskb_ex
EXCEPTIONS
no_record_found = 1
group_not_found = 2
OTHERS = 3.call the module for each group input by user and merge the internal tables.
Regards
PS: you could also use FM K_COSTELEM_SELECT_TAB