2013 Oct 03 7:36 PM
hi experts
i am calling 2 FM's in my program . one FM is updating a table zabc and other FM is inserting into table zxyz.
my requirement is either both ztables should be updated or none should be updated so i call the FM's in update task
and use commit work at end.
however issue comes in the following case -
1. FM1 - updated record fine in zabc
2. FM2 - here i try to insert with key field that is already existing
as second FM did not insert the values in the table zxyz , i think even the record in zabc should not be inserted.
but when the commit work is executed record is updated in first table but not in the second table.
should it not be a single LUW and NOT insert entry in the first table ? how do i achieve this ?
hi experts
i am calling 2 FM's in my program . one FM is updating a table zabc and other FM is inserting into table zxyz.
my requirement is either both ztables should be updated or none should be updated so i call the FM's in update task
and use commit work at end.
however issue comes in the following case -
1. FM1 - updated record fine in zabc
2. FM2 - here i try to insert with key field that is already existing
as second FM did not insert the values in the table zxyz , i think even the record in zabc should not be inserted.
but when the commit work is executed record is updated in first table but not in the second table.
should it not be a single LUW and NOT insert entry in the first table ? how do i achieve this ?
2013 Oct 03 7:41 PM
I think you've got this a little backwards. Don't put them in update task. run them synchronously back to back. If they both succeed, then commit, else rollback.
Neal
2013 Oct 04 3:20 AM
2013 Oct 04 4:32 AM
but my question is as per the concept ...all the FM which are in update task should be called in same LUW when commit work is triggered.
So if 1 FM has a insert statement that works and other FM has insert statement that does not work then when commit work executes should it not rollback the first insert and then send an error through sapmail and then i should be able to monitor that error in sm13???
This is what the documentation says
2013 Oct 04 4:36 AM
2013 Oct 04 4:38 AM
did u put breakpoin for update task.? plz do the same anc check for sy-subrc i strongly feel it is an issue there because 1 table is upated and other is not seems to me is not possible,
2013 Oct 04 4:59 AM
Dear Hema,
The update process will not terminate by itself if some table update just fails(unless an exception is triggered by system). So, you have to terminate it by yourself. This is how it should be ideally done.
Check for sy-subrc value during the insertion. If it fails, trigger a message of any type except 'S' inside the update FM itself.
This will terminate the update task and roll back the entries in the first table as well.
Cheers,
Mahesh
Message was edited by: Mahesh Madhavan
2013 Oct 04 5:49 AM
Hi Hema,
As others said,
Process both the FM Synchronously one after the other.
Thanks
Pavan.N
2013 Oct 04 11:32 AM
Hi Hema,
It will be working fine if you check for the SY-SUBRC after the database update statement and error message should be shown after that.
Regards
Alex
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |