2007 Jun 01 4:51 PM
Hi,
is it possible to make an mass update without updating all Fields of the internal table?
The following Code does update all Fields.
UPDATE dbtab FROM TABLE itab.
But I want to update only some Fields. But different Fields in every record. So an
UPDATE dbtab SET f1 ... fn.
is not what I want. This does update indeed only a couple of Fields, but for each record the same value.
I want to avoid looping about the internal table and do single updates.
Sinan
2007 Jun 01 4:59 PM
Hi,
Try creating a projection view in SE11 for the corresponding table...
Create the projection view with the fields that you want to update along with the key fields..
Then try using
DATA: itab_view TYPE STANDARD TABLE OF z_viewname.
UPDATE z_viewname FROM TABLE itab_view.
Thanks,
Naren
2007 Jun 01 5:07 PM
Hi,
I have no experience with Projection Views. How does your hint work?
Can I make a View do my update and delete the View afterwards.
Sinan
2007 Jun 02 11:54 AM
Projection view is nothing but selection of few columns of existing table.
You must be aware that view is not a physical entity, it is just a window over the database table.
Suppose the table has 10 fields and you want to update only 2 fields of the table and also include the key fields to identify records uniquely, then create a projection view for only those 2 fields.
Follow this link for help in creating projection view:
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ed06446011d189700000e8322d00/frameset.htm
After creating view, define table with structure of view.
DATA: itab TYPE STANDARD TABLE OF <view>.
And update table using the internal table.
UPDATE <view> FROM TABLE itab.
View is an ABAP dictionary object. You should not delete it. Because if you run the program after deleting it, it will give an syntax error 'View does not exist'.
2007 Jun 02 12:00 PM
But if I want to update all fields. Maybe for the first record only the first 3 Fields. For the second the next 3 and so on.
Does this work, too.
Sinan
2007 Jun 02 9:12 PM
Hi Sinan!
Easiest way: read first all fields into an internal table, change the desired fields and update the database from your internal table.
Technically all fields can be changed, but by reading the current values, you will only do a few changes and the rest will stay the same.
Don't forget to enqueue the table before doing the select - otherwise some changes might be done before your update is done.
Regards,
Christian
2007 Jun 04 5:50 AM
Hi,
if u want to update some fields then use:
Update dbtab from table itab.
and if u want to update different fields in every reord then u hv no other way but to use loop.
so use:
update dbtab from wa_itab.
Jogdand M B