‎2009 Apr 07 10:46 AM
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.
‎2009 Apr 07 10:48 AM
Hello,
try this:
loop at hq_inrec into hq_inrec1 .
append hq_inrec1.
endloop.
‎2009 Apr 07 10:51 AM
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
‎2009 Apr 07 10:49 AM
‎2009 Apr 07 10:52 AM
>
> 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.
‎2009 Apr 07 10:55 AM
Use ITAB1[] = ITAB2[]
i.e move content of table 1 to table 2 directly.
‎2009 Apr 07 11:07 AM
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.
‎2009 Apr 07 11:30 AM
Thanks it worked.Pom=nits will be surely awarded to Mohamad Abdul
‎2009 Apr 07 11:33 AM
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.
‎2009 Apr 07 11:41 AM
Best way is
hq_inrec1[[]] = hq_inrec1[[]]
Here Destination fields are small then origin so rest of data will be truncated.
Regards,
Chintan