‎2008 Jan 04 11:45 AM
Hi Abapers,
there are 20 fields in a ztable 'ymassn'. I have 4 fields in my internal table 'itab' from ztable. I have populated the internal table. now i want to update the ztable with one of my internal table field 'A'. How can i achieve this without effecting performance much.
I can do this using below logic. but if there are 100records in my internal table then it will db for 100 times.
loop at itab into wa.
update ymassn
set A = wa-A.
endloop.
please help me.
thanks.
‎2008 Jan 04 11:56 AM
UPDATE dbtab FROM TABLE itab
Try this
awrd points if useful
Bhupal
‎2008 Jan 04 11:59 AM
This will work only if the structure of db table and internal table is same.
‎2008 Jan 04 12:00 PM
the best thing is to declare ur internal table as Z table type and then use UPDATE ZTABLE FROM ITAB.
‎2008 Jan 04 12:05 PM
I dont require other fields.. in other cr, i have 100 fields in ztable. then how can i?
‎2008 Jan 04 12:10 PM
Get the data in ITAB1.
Declare an internal table ITAB2 as Z table type.
copy the data from ITAB1 to ITAB2.
UPDATE table from ITAB2.
This will avoid UPDATE inside a LOOP.
‎2008 Jan 04 12:14 PM
Hi Prem,
Then u can do one thing.
First Declare 2 itabs as type ur Ztable.
Assign the itab2 with the values selected from ZTable.
In First itab do the changes.
Modify the Second itab using first itab in which u have done changes.
Now update ztable using the second itab which is having the final data.
awrd points if useful
Bhupal