cancel
Showing results for 
Search instead for 
Did you mean: 

internal table records

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Former Member
0 Kudos

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