‎2008 Dec 26 11:15 AM
Hi All,
How to split large internal table into smaller ones of fixed number of lines.
The total number of lines are not known and is subjected to vary.
Regards,
Naba
‎2008 Dec 26 11:23 AM
HI,
Check below logic.
DESCRIBE TABLE i_main LINES l_lines.
IF l_lines GT 100.
l_num = l_lines / 100.
ENDIF.
l_start = 1.
l_end = 100.
DO l_num TIMES.
APPEND LINES OF i_main FROM l_start TO l_end INTO i_subtab.
Process ur subtab.
ADD 100 TO: l_start, l_end.
IF l_end GT l_lines.
l_end = l_lines.
ENDIF.
CHECK l_start GT l_lines.
EXIT.
ENDDO.
Thanks,
Vinod.
‎2008 Dec 26 11:29 AM
I am not sure about your requirements, you try with the below solution
Itab : contains all entries let us say 3000
Itab1
itab2
itab3
No.of entries to be split based on 3000/n ( 3000/3) = 1000
split_val = 1000
N_split_from = 1
N_split_to = 1000
APPEND LINES OF ITAB1 FROM N_split_from TO N_split TO ITAB1.
N_split_from = 1 + split_val
N_split_to = 1000 + split_val
APPEND LINES OF ITAB1 FROM N_split_from TO N_split TO ITAB2.
N_split_from = 1 + split_val
N_split_to = 1000 + split_val
APPEND LINES OF ITAB1 FROM N_split_from TO N_split TO ITAB3.
Regards
Sasi