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

Regarding modifying database from internal table

Former Member
0 Likes
681

Hi ABAP Experts,

I am facing an issue regarding modifying DB table from itab.

All the records of itab are not getting reflected in DB table using Modify statement.

Syntax is as follows -

Locking DB table using enque FM

MODIFY abc FROM TABLE i_abc.

Unlocking DB table using deques FM

Please suggest what could be wrong with this. Helpful suggestion will be appreciated.

Thanks in adv,

Akash

6 REPLIES 6
Read only

Former Member
0 Likes
659

Hi

it will works n=based on primary key

Plese check u r primary key of the tabe with internal table..

Kiran

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
659

Hi,

First Delete entries from the table(hope it is a custom table),

for example

DELETE  FROM <DatabaseTable name> WHERE <primarykey = 'somevalue'>.

'After deleting those records.....then use insert statement

 IF sy-subrc = 0.
   INSERT <DatabaseTable name> FROM TABLE  <InternalTable name> ACCEPTING DUPLICATE KEYS.
  ENDIF.

Thanks & REgards

Read only

Former Member
0 Likes
659

Hi,

Use Sy-Subrc after modify statment. If sy-Subrc equals to Zero then use commit statement.

Check in debug mode.

Regards

Md.MahaboobKhan

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
659

Hi,

Use:-


MODIFY <db_table> FROM TABLE <itab>.

IF sy-subrc = 0.
  "sy-dbcnt will contain the number of records effected in db table
  COMMIT WORK.
ENDIF.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
659

Hi all,

Already tried by checking sy-subrc and doing commit work but no success. Also SY-DBCNT contains the value as total number of entries of itab.

Thanks,

Akash

Read only

Former Member
0 Likes
659

Hi,

If the primary key fields have same value as the records present in internal table then for these records the modify statement is not worked. We can check it using SY-SUBRC & SY-DBCNT.