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 in user exit

Former Member
0 Likes
2,104

Hi,

I developed the code to update the custom table in user exit, for this i have used MODIFY statement. One of my co-worker is telling that we should not use MODIFY statement in user exits directly since it will trigger the implicit COMMIT WORK.

Due to this COMMIT WORK other previous MODIFY statements also may trigger and try to update the corresponding standard tables too. Is it true?

I wrote INSERT statements in user exits several times, everything is working fine in the production. Alternatively he is suggesting to use the PERFORM statement with 'UPDATE TASK' and in that i can use MODIFY statement. Is it correct ?

Which approach is correct? and can you please explain what will happen in both cases.

Thanks in advance.

Jaya

5 REPLIES 5
Read only

uwe_schieferstein
Active Contributor
0 Likes
1,222

Hello Jaya

When look at the ABAP keyword documentation for MODIFY you can see that your colleague is wrong:


Syntax 
MODIFY target FROM source. 



Effect 
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. 



sy-subrc Meaning 
0 All lines were inserted or changed. 
4 At least one line could not be processed as there is already a line 
with the same unique name secondary index in the database table. 
 


The MODIFY statement sets sy-dbcnt to the number of processed lines. 



Note 
The changes are finally transferred to the database table 
with the next database commit. Up to that point, they can be reversed with a database rollback. 

If the user-exit (I guess CMOD/SMOD) would be called via RFC then you would get an implicit COMMIT WORK.

Regards

Uwe

Read only

0 Likes
1,222

Can you explain me ...when we need to use MODIFY directly & when we need to use PERFORM with UPDATE TASK.

Read only

0 Likes
1,222

when u are using MODIFY statement it perform both the function insert and update.

e.g. if there exists any value then it will update else it will insert a new record.

where as UPDATE works on the existing value only.

Regards.

Kusum.

Read only

Former Member
0 Likes
1,222

Hi,

You can use modify statement in user exit to update ur table, and it does triggers implicit commit work you have to write explicitly .

you can press F1 in modify statement to read more abt this and LUW.

Amresh

Read only

Former Member
0 Likes
1,222

Got my own