05-17-2005 6:28 PM
here is my code:
declaration of select option.
SELECT-OPTIONS s_khinr FOR csks_itab_group-khinr no intervals.
at selection-screen on value-request for s_khinr-low.
at selection-screen on value-request for s_khinr-high.
************************************************************************
Initialization
************************************************************************
initialization.
perform build_group_option.
delete adjacent duplicates from csks_itab_group comparing all fields.
at initialization fir build my internal table called csks_itab_group, which gets the names for the coster center groups then I delect any duplicates.
still does work, any ideas.
thanks
05-17-2005 6:32 PM
05-17-2005 6:32 PM
05-17-2005 6:59 PM
form build_group_option.
select khinr from csks into csks_itab_group where kokrs eq 'NSCO'.
endselect.
endform.
05-17-2005 7:13 PM
This works.......
REPORT ZRICH_0001 .
tables: csks.
data: begin of itab occurs 0,
khinr type csks-khinr,
end of itab.
SELECT-OPTIONS s_khinr FOR csks-khinr no intervals.
initialization.
perform build_group_option.
sort itab ascending by khinr.
delete adjacent duplicates from itab comparing all fields.
at selection-screen on value-request for s_khinr-low.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'KHINR'
dynprofield = 'S_KHINR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = itab.
at selection-screen on value-request for s_khinr-high.
start-of-selection.
form build_group_option.
*** MAKE SURE YOU MODIFY THIS STATEMENT
select khinr from csks into table itab
where kokrs eq 'NSCO'.
endform.
Regards,
Rich Heilman
05-17-2005 7:16 PM
Jamie,
If you are trying to provide F4 help for Cost Center Group, try this:
at selection-screen on value-request for s_khinr-low.
data: l_ksgru like like rksb1-ksgru.
call function 'K_GROUP_SELECT'
exporting
class = '0101'
field_name = 'KOSTL'
importing
set_name = l_ksgru
exceptions
no_set_picked = 02.
s_khinr-low = l_ksgru.
If you are building your group list from CSKS, you will only get the groups that have cost centers (leafs) but not the groups that have other groups as nodes.
If you then have to find the Cost Centers in the selected groups, you will have to find all the groups first and then use BAPI_COSTCENTER_GETLIST1 for each group and then eliminate duplicate cost centers.
05-17-2005 7:16 PM
I do not have sufficient info to test your program. How have you defined csks_itab_group internal table?
Based on what all fields it has, the program will delete the duplicate entries.
One of the reason that it is not deleting duplicate entries is that you MUST issue a SORT command to sort the internal table. The program is executing the logic to delete "adjacent" records that are similar; hence write a:
SORT csks_itab_group
statement just before the DELETE statement that you have in your program - and you will get the correct results. Let me know if it still fails.