10-09-2007 7:44 PM
call function 'BAPI_COSTCENTERGROUP_GETDETAIL'
exporting
controllingarea = p_kokrs
groupname = p_ksgru
tables
hierarchynodes = itab_nodes
hierarchyvalues = gt_cgrp.
if sy-subrc = 0.
refresh s_kostl.
move: 'I' to s_kostl-sign,
'BT' to s_kostl-option.
loop at gt_cgrp.
move gt_cgrp-valfrom to s_kostl-low.
move gt_cgrp-valto to s_kostl-high.
append s_kostl.
endloop.
endif.
In the above code even though the BAPI returns 33 values
S_KOSTL has 66 values ( values are replicated into it).
How to fix this problem.......
10-09-2007 7:48 PM
Hi,
Please try this.
call function 'BAPI_COSTCENTERGROUP_GETDETAIL'
exporting
controllingarea = p_kokrs
groupname = p_ksgru
tables
hierarchynodes = itab_nodes
hierarchyvalues = gt_cgrp.
if sy-subrc = 0.
refresh s_kostl.
move: 'I' to s_kostl-sign,
'BT' to s_kostl-option.
loop at gt_cgrp.
move gt_cgrp-valfrom to s_kostl-low.
move gt_cgrp-valto to s_kostl-high.
append s_kostl.
endloop.
endif.
sort s_kostl.
delete adjacent duplicates from s_kostl.
Regards,
Ferry Lianto
10-09-2007 8:07 PM
Karthik - your code works with no problems in our system.
On the other hand, you are checking the return code after the BAPI call. You should be checking the BAPI return structure instead. So it may be that the BAPI is not returning values, and you have tables that are filled with old values.
Rob
Message was edited by:
Rob Burbank