on 06-26-2009 1:22 PM
Hello Friends,
I have to move specified number of records of one internal table to other internal table. Suppose i required to move only first 10 records of one intetnal table to onter internal table. How can i proceed? i am not allowed to use loop statement here.
Kumar.
hi
Try the below code. Here the below code is based on Vendor Master (LFA1 table).
DATA itab TYPE TABLE OF lfa1 WITH HEADER LINE.
DATA htab TYPE TABLE OF lfa1 WITH HEADER LINE.
SELECT * FROM lfa1 INTO TABLE itab UP TO 50 ROWS.
DO.
READ TABLE itab INDEX sy-index.
IF sy-index <= 10.
MOVE itab TO htab.
APPEND htab.
ELSE.
EXIT.
ENDIF.
ENDDO.
Ganesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Kumar,
you can use
DO.
READ TABLE ITAB INDEX SY-INDEX.
IF SY-SUBRC 0. EXIT. ENDIF.
MOVE ITAB-FIELD4 TO ITAB2-FIELD4.
APPEND ITAB2.
ENDDO.
or ...
use indexing method for reading and assigning particular record -
TYPES: BEGIN OF TT ,
F1 TYPE CHAR1,
F2 TYPE CHAR1,
END OF TT.
DATA: IT TYPE STANDARD TABLE OF TT,
WA TYPE TT,
IT2 TYPE STANDARD TABLE OF TT,
WA2 TYPE TT.
WA-F1 = 'K'.
WA-F2 = 'I'.
APPEND WA TO IT.
WA-F1 = 'R'.
WA-F2 = 'A'.
APPEND WA TO IT.
WA-F1 = 'N'.
WA-F2 = 'P'.
APPEND WA TO IT.
IT2 = IT.
regards,
rajeev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.