05-30-2007 12:12 PM
HI
There is an internal table itab1.
how can i copy all these fields to another itab2.
itab 2 contains extra fields.
ex: itab1 : x,y,z.
itab2 : x,y,z,l,m,n.
how can i copy all itab1 fields to itab2.
Regards
SAISRI
05-30-2007 12:14 PM
move-corresponding itab1 to itab2.
append itab2.
clear: itab2.
reward with points if its helpful
05-30-2007 12:16 PM
data: itab1 type table of XXX,
wa1 type XXX,
itab2 type table of ZZZ,
wa2 type ZZZ
loop at itab1 into wa1.
move corresponding fields of wa1 to wa2.
append wa2 to itab2.
endloop.
05-30-2007 12:19 PM
HI,
loop at itab1 into struc1
MOVE-CORRESPONDING struc1 TO struc2.
append struc2 to itab2
endloop
regards,
Sooness
05-30-2007 12:20 PM
if two tables are identical then use
itab2[] = itab1[]
not identical then
loop at itab1.
move-corresponding itab1 to itab2.
append itab2.
endloop.
regards
05-30-2007 12:22 PM
Hi,
Declare two separate TYPES for two internal tables.
U can do like this.
<b>TYPES: BEGIN OF ty1,
x,y,
END OF ty1.
TYPES: BEGIN OF ty2,
a,b,c,
END OF ty2.
DATA: ty TYPE ty1.
DATA: typ TYPE ty2.
DATA: itab1 TYPE STANDARD TABLE OF ty1 WITH HEADER LINE.
DATA: BEGIN OF itab2 OCCURS 0.
INCLUDE STRUCTURE ty.
INCLUDE STRUCTURE typ.
DATA: END OF itab2.</b>
05-30-2007 12:24 PM
Hi sai
If u want to move only one field in internal table then use
transport itab1-field1 to itab2
or u want to move the entire table then use
move statement
move itab1 to itab2.
append itab1 to itab2.
Rewards if helpfull
Regards
Pavan
05-30-2007 12:26 PM
hi,
first of all u declare aii fileds in itab2 [ fileds in itab1 + extra fileds ] and a work area for itab2 wa_itab2
loop at itab1.
move-coresponding itab1 to wa_itab2 or move itab1[] itab2[]. { based on your requirement } use any st
append wa_itab2 to itab2.
clear wa_itab2.
endloop.
if helpful reward some points.
with regards,
suresh babu aluri.