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

MODIFY

Former Member
0 Likes
1,576

HI,

WHAT IS THE DIFF B/W MODIFY AND UPDATE

THANK YOU

ASHOK KUMAR

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,549
16 REPLIES 16
Read only

former_member491305
Active Contributor
0 Likes
1,549

Hi Ashok,

Update:It will update the table records only if there is entry in the table.

Modify:It will update the table records ,if there is entry in the table.If not then it will insert that record.

Read only

Former Member
0 Likes
1,549

hi,

Modify will update already exitsing record, create a new record if it not already exits in databse.(it work both functional create ,update)

Update will update if it already exits in databse.

Regards,

Richa

Read only

0 Likes
1,549

HI ,

I MY TABLE NO DATA IS FOUND . BUT IA USING UPDATE WHAT WILL HAPPENS

Read only

0 Likes
1,549

If there is no record, and you are using update

it will not update . ( Coz there is no entry )

here sy-subrc will be set other than zero .

Here you need to use 'modify'.

it will insert the same record .

modify = update + insert

~ Laxmi

  • Reward helpful answers

Read only

0 Likes
1,549

Hi Ashok,

If you are updating a table using <b>Update</b> statement and assume that no records is there in that table,then the update statement willl return sy-subrc = 4 which means that no record is updated or inserted.

Read only

0 Likes
1,549

Hi,

Data will be inserted.Sy-subrc eq 4.

If you use modify,data will inserted in such a situtation.

data : itab type standard table of mara,

wa type mara,

wa1 type mara.

select * from mara into table itab.

loop at itab into wa.

wa-matnr = '12345'.

modify mara from wa.

commit work.

exit.

endloop.

Read only

Former Member
0 Likes
1,549

HI.

Modify:it will update already exitsing record,create new one if it not already exits in databse.(it work both functional create ,update)

Update:update if it already exits in databse.

Rewards all helpfull answers.

Regards.

Jay

Read only

Former Member
0 Likes
1,549

Hi,

<b>Update</b>

It will update the table records only if there is entry in the table.

<b>Modify</b>

It will update the table records ,if there is entry in the table.If not then it will insert that record.

Regards,

Ranjit Thakur.

<b>Please Mark The Helpful Answer.</b>

Read only

Former Member
0 Likes
1,550
Read only

Former Member
0 Likes
1,549

Hi.

It will insert a new record.

Reward if helpful.

Regards,

Umasankar.

Read only

Former Member
0 Likes
1,549

Update:It will update the table records only if there is entry in the table.

Modify:It will update the table records ,if there is entry in the table.If not then it will insert that record.

Read only

Former Member
0 Likes
1,549

Hello Ashok,

update is to update table entries.

modify is also to update the table entries... if no record is there it will insert new record.

Regards

--

Sasidhar Reddy Matli.

Read only

0 Likes
1,549

h

Read only

Former Member
0 Likes
1,549

sounds that MODIFY is better and should always be used, but that is not true. Why not?

Read only

0 Likes
1,549

Because MODIFY is a bit more expensive because it has to check whether the record exists or not before it tries to update or insert it? But I would have thought that the extra time taken would be miniscule and hardly noticeable. Though that would depend on the number of records you were updating..

In some situations, you need to do different things when you insert or update, and MODIFY wouldn't be any good then.

Read only

Former Member
0 Likes
1,549

If the report you are creating will be used for changing values in a table and you aren't sure if the record exist in a table, you should user MODIFY. You have to be aware that MODIFY only changes values in fields that aren't key fields, otherwise the record would be inserted in the table instead of be updated.

But, if the report will be used only for changing values in a table, you should use UPDATE.