Application Development and Automation 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: 
Read only

Internal table

Former Member
0 Likes
835

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
Read only

Former Member
0 Likes
819

Hello,

try this:

loop at hq_inrec into hq_inrec1 .

append hq_inrec1.

endloop.

Read only

0 Likes
819

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

Read only

RahulKeshav
Active Contributor
0 Likes
819

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

Read only

Former Member
0 Likes
819

>

> 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.

Read only

0 Likes
819

Use ITAB1[] = ITAB2[]

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

Read only

Former Member
0 Likes
819

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.

Read only

Former Member
0 Likes
819

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

Read only

Former Member
0 Likes
819

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.

Read only

Former Member
0 Likes
819

Best way is

hq_inrec1[[]] = hq_inrec1[[]]

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

Regards,

Chintan