Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent Internal Tables

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

move-corresponding itab1 to itab2.

append itab2.

clear: itab2.

reward with points if its helpful

Former Member
0 Kudos

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.

dev_parbutteea
Active Contributor
0 Kudos

HI,

loop at itab1 into struc1

MOVE-CORRESPONDING struc1 TO struc2.

append struc2 to itab2

endloop

regards,

Sooness

Former Member
0 Kudos

if two tables are identical then use

itab2[] = itab1[]

not identical then

loop at itab1.

move-corresponding itab1 to itab2.

append itab2.

endloop.

regards

Former Member
0 Kudos

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>

Former Member
0 Kudos

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

Former Member
0 Kudos

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.