2012 Nov 02 9:36 PM
Hi,
I have one table and it has a 1000 entries
I'd like to take the records from it and split it across to tables so that each of them will have 500 entries.
** /abs/tbl_Exec_Rec is a standard table from the Table Types in the Dictionary
whole type /abs/tbl_Exec_Rec "This one has 1000 entries
part1 type /abs/tbl_Exec_Rec "This one will have 500 entries
part2 type /abs/tbl_Exec_Rec "This one will have 500 entries
In JAVA I don't need a loop to do this I can simply do:
T[] subArray Arrays.copyOfRange(T[] array, int start, int end)
so for my table it'll be something like that:
T[] part1 Arrays.copyOfRange(T[] big, 0, 499)
T[] part2 Arrays.copyOfRange(T[] big, 500, 999)
How can do it in SAP I don't want to use any loops?
Thanks .
2012 Nov 02 10:48 PM
Hello izhak
In abap it you can do is:
Example
Table_1 has 1000 rows
Table_2 and Table_3 are auxiliar tables.
*..In table_2 you can copy the rows from 1 to 499
APPEND LINES OF Table_1 FROM 1 TO 499 TO Table_2 .
In table_3 you can copy the rows from 500 to 1000
APPEND LINES OF Table_1 FROM 500 TO 1000 TO Table_3 .
2012 Nov 02 10:48 PM
Hello izhak
In abap it you can do is:
Example
Table_1 has 1000 rows
Table_2 and Table_3 are auxiliar tables.
*..In table_2 you can copy the rows from 1 to 499
APPEND LINES OF Table_1 FROM 1 TO 499 TO Table_2 .
In table_3 you can copy the rows from 500 to 1000
APPEND LINES OF Table_1 FROM 500 TO 1000 TO Table_3 .
2012 Nov 04 8:30 PM
2012 Nov 02 11:18 PM
Hi,
Well the answer is already given...I was just wondering what could be hidden in this java method copyOfRange? Looks a bit like an abap method or a macro where some loop occurs
cheers,
Manu.
2012 Nov 03 11:26 PM
Hi Manu
The method copyOfRange is a method in java . That method use the class System.ArrayCopy and this routine use a method
public static native void arraycopy.
This method is writing in code native for best performance.
2012 Nov 04 4:05 AM
Hello Manu,
there are some differences from other languages, so we don't find same things in ABAP. and ABAP has limitations and Flexibilities when compared to others.. when talking about its always good to have scenario which is related to business. so that there would be some better alternative than in the lines your thinking about.
so have some business scenario always..
Regards,
Andrew