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: 

Internal table

Former Member
0 Kudos
90

Hi guys,

I have 2 internal tables(same fields but different lenght) as below .Currently I get data in internal table 2

(hq_inrec1) .I want to move all the data from internal table 2 (hq_inrec1)

to internal table 1(hq_inrec) but as th field leng is differnt the data is not properly transfered.Please guide.

1 DATA: BEGIN OF hq_inrec OCCURS 0,

destination(4), "Country key

imei_no(17), "IMEI No,

model_name(22), "Model Name

ship_date(10), "Shipping Date

serial_no(13), "Serial No.

hq_cust_name(40), "HQ customer name

gsm(3), "GSM

END OF hq_inrec.

2. DATA: BEGIN OF hq_inrec1 OCCURS 0,

destination(6), "Country key

imei_no(32), "IMEI No,

model_name(30), "Model Name

ship_date(18), "Shipping Date

serial_no(24), "Serial No.

hq_cust_name(43), "HQ customer name

gsm(3), "GSM

END OF hq_inrec1.

9 REPLIES 9

Former Member
0 Kudos
74

Hello,

try this:

loop at hq_inrec into hq_inrec1 .

append hq_inrec1.

endloop.

0 Kudos
74

Hi, This is the efficient way to transfer the data between two internal tables..

hq_inrec[] = hq_inrec1[]

Edited by: Mallika ... on Apr 7, 2009 11:52 AM

Edited by: Mallika ... on Apr 7, 2009 11:55 AM

RahulKeshav
Active Contributor
0 Kudos
74

try MOVE .....syntx....

Former Member
0 Kudos
74

>

> Hi guys,

>

> I have 2 internal tables(same fields but different lenght) as below .Currently I get data in internal table 2

> (hq_inrec1) .I want to move all the data from internal table 2 (hq_inrec1)

> to internal table 1(hq_inrec) but as th field leng is differnt the data is not properly transfered.Please guide.

>

> 1 DATA: BEGIN OF hq_inrec OCCURS 0,

> destination(4), "Country key

> imei_no(17), "IMEI No,

> model_name(22), "Model Name

> ship_date(10), "Shipping Date

> serial_no(13), "Serial No.

> hq_cust_name(40), "HQ customer name

> gsm(3), "GSM

> END OF hq_inrec.

>

> 2. DATA: BEGIN OF hq_inrec1 OCCURS 0,

> destination(6), "Country key

> imei_no(32), "IMEI No,

> model_name(30), "Model Name

> ship_date(18), "Shipping Date

> serial_no(24), "Serial No.

> hq_cust_name(43), "HQ customer name

> gsm(3), "GSM

> END OF hq_inrec1.

u can try this way.

loop at hq_inrec1.

move : hq_inrec1-destination+0(4) to hq_inrec-destination.

hq_inrec1-imei_no+0(17) to hq_inrec-imei_no.

'

''''''

do same for other fields

endloop.

0 Kudos
74

Use ITAB1[] = ITAB2[]

i.e move content of table 1 to table 2 directly.

Former Member
0 Kudos
74

well you need to think of a mapping strategy.

- what happens if data which is to transfer is longer than the field

and such.

do your mapping manually, assign each single field.

alternative: either adopt the structure of itab1 or itab2.

Former Member
0 Kudos
74

Thanks it worked.Pom=nits will be surely awarded to Mohamad Abdul

Former Member
0 Kudos
74

If the source field length is greater than the destination length

then your data will get truncated.

Change you internal table structure to map with the source internal table

if you want consistant data...

Regards,

Lalit Mohan Gupta.

Former Member
0 Kudos
74

Best way is

hq_inrec1[[]] = hq_inrec1[[]]

Here Destination fields are small then origin so rest of data will be truncated.

Regards,

Chintan