2009 Mar 02 11:46 AM
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
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.
2009 Mar 02 11:49 AM
Hi
it will works n=based on primary key
Plese check u r primary key of the tabe with internal table..
Kiran
2009 Mar 02 11:53 AM
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
2009 Mar 02 11:53 AM
Hi,
Use Sy-Subrc after modify statment. If sy-Subrc equals to Zero then use commit statement.
Check in debug mode.
Regards
Md.MahaboobKhan
2009 Mar 02 11:55 AM
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
2009 Mar 02 12:21 PM
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
2009 Mar 02 12:35 PM
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.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |