05-23-2011 5:28 AM
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.
05-23-2011 6:38 AM
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
05-23-2011 6:10 AM
> 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
05-23-2011 7:12 AM
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.
05-23-2011 8:16 AM
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
05-23-2011 6:38 AM
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