‎2008 Dec 06 5:46 AM
experts,
i have a populated internal table with say 4 fields .
without using a loop operation can i get field4 values into an another internal table.
thanks in advance.
Edited by: Julius Bussche on Dec 6, 2008 10:52 AM
‎2008 Dec 06 5:56 AM
‎2008 Dec 06 6:08 AM
‎2008 Dec 06 6:54 AM
THID IS WITH TWO FIELDS IT ALSO WORKS FOR 4FIELDS
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.
LOOP AT IT2 INTO WA2 .
WRITE:/ WA2-F1 ,
WA2-F2.
ENDLOOP.
Regards,
Kiran Posanapalli.
‎2008 Dec 06 6:56 AM
Hi,
Use READ table statement with the specified index.
you will be able to see the record you want.
Thanks
Rajesh kumar
‎2008 Dec 06 7:23 AM
experts,
i need all the values at a single stretch nor with any indexing or with key specifications
‎2008 Dec 06 10:10 AM
Hi
No! U can't do it, u need LOOP or READ TABLE statament in order to read all records and then move the value of the field to the target table:
LOOP AT ITAB.
MOVE ITAB-FIELD4 TO ITAB2-FIELD4.
APPEND ITAB2.
ENDLOOP.or
DO.
READ TABLE ITAB INDEX SY-INDEX.
IF SY-SUBRC <> 0. EXIT. ENDIF.
MOVE ITAB-FIELD4 TO ITAB2-FIELD4.
APPEND ITAB2.
ENDDO.Max
‎2008 Dec 06 7:30 AM
Hi,
You can just use DESCRIBE statement for gettin number of rows in your internal table.
Then use DO statement for that number of times and move corresponding fields to other internal table.Thanks
Nitesh
‎2008 Dec 06 7:32 AM
Hi,
See this code snippet..
DATA n TYPE i.
DESCRIBE TABLE itab1 LINES n.
DO n TIMES.
MOVE-CORRESPONDING itab1 TO itab2.
ENDDO.Thanks
‎2008 Dec 06 8:03 AM
‎2008 Dec 06 9:44 AM
Hi,
2 ways you can transfer your data from 1 internal table(ITAB1) to other (ITAB2):
1. MOVE ITAB1 TO ITAB2.
2. ITAB2 = ITAB1.
Regards,
Suruchi.
‎2008 Dec 06 10:54 AM
what do u want exactly?
something like this?
itab2 = itab1
if yes check the statement in ur program it works
Edited by: amit kumar on Dec 6, 2008 4:24 PM
Edited by: amit kumar on Dec 6, 2008 4:25 PM
‎2008 Dec 06 11:11 AM
hi amit should be as follows :
itab2[] = itab1-fiel4 ,without looping itab1 or any loop operation as do..enddo etc is it possible with field symbols, ie can we avoid a loop operation to do this.
Edited by: rae z on Dec 6, 2008 12:12 PM
‎2008 Dec 06 11:46 AM