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 or UPDATE + with/without Commit Work

kiran_k8
Active Contributor
0 Likes
12,266

I am modifyng a ztable using Modify Ztable within a subroutine.(not using any workarea or internal table).

Sometimes it doesn't modify the ztable.I think it is because I am not using the Commit work

after the modify statement.

ADD 1         TO zmff-fileno.
  g_fno = zmff-fileno.   "zmff is the ztable
  MODIFY zmff.

Now,my question is

1.can we avoid this kind of issue without using COMMIT WORK and WAIT ?

2.Instead of Modify if I use UPDATE can I avoid such kind of issues ?

3.As I am using this within a subroutine using COMMIT is a MUST ? (read in one of the threads in SDN)

Thanks,

K.Kiran.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,683

Hi,

1.can we avoid this kind of issue without using COMMIT WORK and WAIT ?

A. If you use COMMIT WORK after MODIFY statement, the Ztable is updated with immediate effect. If you don't use COMMIT WORK after MODIFY statement, the Ztable is udated once COMMIT WORK to the data base has done by the system.

2.Instead of Modify if I use UPDATE can I avoid such kind of issues ?

A. It is not statement dependent, either you use MODIFY or UPDATE, you need to use COMMIT WORK statement to immediate updation of Ztable

3.As I am using this within a subroutine using COMMIT is a MUST ? (read in one of the threads in SDN)

A. It is not subroutine dependent. Where ever you use MODIY or UPDATE, you need to use COMMIT WORK statement to immediate updation of Ztable

Regards

Dande

4 REPLIES 4
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
3,683

> 1.can we avoid this kind of issue without using COMMIT WORK and WAIT ? -

No. If you want the data to be "committed" to the database, you've to trigger the (Database) commit.

> 2.Instead of Modify if I use UPDATE can I avoid such kind of issues ? - N.O.

> 3.As I am using this within a subroutine using COMMIT is a MUST ? (read in one of the threads in SDN) - Completely misleading information! This has nothing to do with the MODIFY being inside a subroutine.

You should read the SAP documentation on [COMMIT WORK|http://help.sap.com/abapdocu_702/en/abapcommit.htm] if you've any further qns.

BR,

Suhas

Read only

kiran_k8
Active Contributor
0 Likes
3,683

Does it have the same effect even if we use before or after sy-subrc check on MODIFY/INSERT statements ?

ie

modify ztable.

if sy-subrc = 0.

commit work.

else.

message.

endif.

Thanks,

K.Kiran.

Read only

Former Member
0 Likes
3,683

Hi,

modify ztable.

if sy-subrc = 0.

*Ztable has been successfully modified but updation will not reflect immediately in the database

commit work.

*Ztable updation will reflect in the database with immediate effect.

else.

*Updation of Ztable failed

message.

endif.

Regards

Dande

Read only

Former Member
0 Likes
3,684

Hi,

1.can we avoid this kind of issue without using COMMIT WORK and WAIT ?

A. If you use COMMIT WORK after MODIFY statement, the Ztable is updated with immediate effect. If you don't use COMMIT WORK after MODIFY statement, the Ztable is udated once COMMIT WORK to the data base has done by the system.

2.Instead of Modify if I use UPDATE can I avoid such kind of issues ?

A. It is not statement dependent, either you use MODIFY or UPDATE, you need to use COMMIT WORK statement to immediate updation of Ztable

3.As I am using this within a subroutine using COMMIT is a MUST ? (read in one of the threads in SDN)

A. It is not subroutine dependent. Where ever you use MODIY or UPDATE, you need to use COMMIT WORK statement to immediate updation of Ztable

Regards

Dande