‎2009 Mar 30 3:33 AM
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
‎2009 Mar 30 4:41 AM
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
‎2009 Mar 30 5:12 AM
Can you explain me ...when we need to use MODIFY directly & when we need to use PERFORM with UPDATE TASK.
‎2009 Mar 30 3:28 PM
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.
‎2009 Mar 30 4:47 AM
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
‎2010 Feb 04 7:39 PM