Skip to Content
-1

How to update specific fields of the database table from itab?

May 15 at 02:33 PM

80

avatar image

I have an internal table and want to update specific fields of the DB table based on values of the internal table. I tried both UPDATE and MODIFY clauses but it doesn't work.

The issue is that UPDATE accepts itab as a data source but doesn't allow specifying wanted fields, while MODIFY allows doing that with TRANSPORTING, but accepts only work area.

How can I update specific fields of the database table from itab?

Thanks.

10 |10000 characters needed characters left characters exceeded

"MODIFY allows doing that with TRANSPORTING"

Not in Open SQL ...

0

If «Not in Open SQL» then where?

Is there any way to use MODIFY with itab to update a DB table?

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Venkatramesh V May 15 at 05:17 PM
1

Hi,

UPDATE Table name SET field name = 'modify'

WHERE key fields = '100'.

Regards,

Venkat

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks, I actually tried this approach but here we update just single row at one time and if I have to update multiple rows, I have to use a loop with UPDATE inside and it is very expensive due to extra DB I/O operations.

Is there any way to update a DB table based on itab values just with one DB I/O batch-operation?

0

Internal table and DB table should be of same structure. after modifying internal table.

MODIFY DBTAB:E From table itab.

commitwork.

0
Raymond Giuseppi May 16 at 06:14 AM
1

Did you consider

  • Selection of the whole structure in internal table (with some for all entries) then modify the internal table and last update the database
  • Creation of a view in database, and update this view
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Do you mean under «Selection of the whole structure in internal table (with some for all entries) then modify the internal table and last update the database» a loop over itab and update DB at every iteration?

0

No, I mean read all current values in db for key values of your itab, modify records of itab (merge itabs), update database from modified itab which has every field of db table

0