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

Database Table Updation

Former Member
0 Likes
872

Hi guys,

I am using the MODIFY statement in my program to insert/update records in the Database table. Initially it used to insert all 5 records from my excel sheet into the database table. But when i converted a key field of the database table into a non-key field, only one record ( last one ) of the Excel sheet gets updated. Kindly let me know as to why is this happening.

<removed_by_moderator>

Thanks and regards,

frank

Edited by: Julius Bussche on Dec 10, 2008 11:47 AM

7 REPLIES 7
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
841

Hello frank,

Check the DB table design and find if you are using unique primary keys or not..

Edited by: Sandeep Kumar on Dec 10, 2008 4:07 PM

Read only

Former Member
0 Likes
841

Hi,

if you don´t define it as an key and you have allways the same field in the excel-shield, sap identify it as the same record and update it instead of insert

Regards

Nicole

Read only

Former Member
0 Likes
841

Hi

What doesn "But when i converted a key field of the database table into a non-key field" mean?

Probably the problem is here, check all values of the keys: u make sure they are correct.

Max

Read only

0 Likes
841

Hi Max,

What i meant was initially the ZTABLE that i am updating had PERNR as the key field. Later on, i changed PERNR to a non-key field and this occured. What could be the problem with that??

Kindly help

Thanks and regards,

frank

Read only

0 Likes
841

Hi

So now which is/are the key fields for your ZTABLE?

If now there's only MANDT as key field u can store only one record: that could explain why u can update the data of the last record of your file.

Max

Read only

Former Member
0 Likes
841

Hi,

If you have one primary key you can have only one reocrd for each unique value

if you have 2 primary key fields you can have n number of records for the first field as long as the value of second field is unique. and it goes on so.

if you have 3 primary key fields you can have n number of records for the first 2 fields as long as the value of 3 key field is unique and it goes on

Please check key field combination carefully

Best Regards

Ramchander Rao.K

Read only

Former Member
0 Likes
841

hi Frank

There should be two ways

1.) MODIFY <table> from TABLE itab.

2.)MODIFY DBTAB/ (DBTAB) FROM WA/ITAB.

(DBTAB) -


represents dbtab at runtime

The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.

System fields

The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.

Regards

Sachin