Application Development 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: 

how the modify statement works for database table of all key fields

Former Member
0 Kudos

hi,

Can any one tell me that, if we use MODIFY statement to update database table from an internal table then if the database table contains all key fields then it will be modifying the exxisting values from a module pool transaction. becuse when i am doing that the table is getting appending,instead of modifying the values

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Basically the way it works is that if you are using the FROM addition, like

MODIFY <db_table> from <workarea>

The system will look at the key values from the DB table, and if they patch the field values in the workarea, then this record will be modfied, meaning any non-key fields will be updated from the workarea, if the runtime does not find a key match, then the record will be INSERTed into the db table.

Regards,

Rich Heilman

former_member230674
Contributor
0 Kudos

hai

kiran,

MODIFY = UPDATE + INSERT.

it means wgen modify is used, it first checks the key fields of existing records.

if matches, then checks with non-key fields.

if matches, no modifications are done.

if not matches , then modify the non-key fields.

if not matches,

then it insert new record into db table.

so, Modify should work with both insert and modifying functionalities.

reward points , if useful

thank you

prasad

Edited by: PRASAD GVK on Apr 17, 2008 7:48 AM

Former Member
0 Kudos

When You are using MODIFY statement to update the DB table then, if all the key fields are there it should modify the existing record otherwise it will append a new record. Make sure that all the key fields are there in your case.

Former Member
0 Kudos

Hi Kiran,

MODIFY statement can act as both update and insert.

First it checks whether the record is present for that particular key ,if it is present it will update the record.

If it is not present , then it will insert a new record.

Reward points if useful.

Thanks & Regards,

AMK.