‎2005 May 13 3:41 PM
Hi, everybody.
In order to the transaction effect of update for mutiple tables, I create a update type function, and insert/update several tables in it.
And I call it like this:
CALL FUNCTION 'ZTEST_UPDATE'
IN UPDATE TASK
EXPORTING ...
EXCEPTIONS ...
COMMIT WORK.
After commit, update will do,
when a update in 'ZTEST_UPDATE' fail, all of the action will be cancel, it goes well.
But my question is how can I get the call function result? in this UPDATE TASK mode
I want to know after commit, if the 'ZTEST_UPDATE' is success or fail. Can I only reference sy-subrc?
Hope your reply, and any suggestion is welcome.
thanks
‎2005 May 13 5:32 PM
At first, thanks a lot.
Brad, your reply is very valuable.
But I also thought about validate the data before update, it is a good way to avoid most of error when update. But anyway, it is still possible that occur some issue in the update action. So get the result is necessary.(there is also some requirement by client for result report)
COMMIT WORK AND WAIT. is a good way, though its poor synchronize, it can meet the requirement in my object.
And thank for your remind on V1.
‎2005 May 13 3:50 PM
‎2005 May 13 3:51 PM
Hi Zhenglin,
As the update task runs in a seperate thread, then it becomes difficult to determine its success from within your program (and not really desirable anyway).
You should design your program so that the only activities that occur within the UPDATE function are database inserts/updates/deletes.
All the data should be validated and checked prior to calling your UPDATE function.
If you want to check the success of your UPDATE function you can do so via transaction SM13, but this should only have errors if you have encountered system / database problems- not logic issues.
Cheers,
Brad
‎2005 May 13 3:54 PM
Hi Zhenglin,
If you really want to know the success of the update, you can also use the command:
COMMIT WORK <b>AND WAIT</b>.
The sy-subrc will be non zero if you have a problem.
BUT, this defeats the whole purpose of calling the function in UPDATE TASK in the first place (you get a seperate thread, but your first thread waits for the second one to finish anyway). You might as well call the function within your own task.
Cheers,
Brad
‎2005 May 13 3:59 PM
Please note, however, that only V1 update functions are captured using these techniques, V2 update functions will not be affected (and hence you wont be able to determine the return codes).
To determine which type of function you have (V1,V2) then check the FM attributes:
V1 is for Start Immed. and Immediate start, no restart
V2 is for Start delayed and Coll. run
Cheers,
Brad
‎2005 May 13 5:25 PM
Thanks Zhenglin,
Has your question been addressed?
If so, please close the thread - either "solved it on my own" or "solved problem".
Have a good weekend.
Brad
‎2005 May 13 5:32 PM
At first, thanks a lot.
Brad, your reply is very valuable.
But I also thought about validate the data before update, it is a good way to avoid most of error when update. But anyway, it is still possible that occur some issue in the update action. So get the result is necessary.(there is also some requirement by client for result report)
COMMIT WORK AND WAIT. is a good way, though its poor synchronize, it can meet the requirement in my object.
And thank for your remind on V1.
‎2005 May 13 5:39 PM
No problem zhenglin,
It'd be really great if you could close off the thread now though.
It really helps people when they see if a thread is closed:
1. People looking to help others will know that this thread is closed, and won't need to waste time solving problems that are already solved.
2. When people are searching the forums for their problem they can filter by those that have been solved. This should mean that they only get useful information for their problem.
Its a constant problem for SDN but you can help by closing off a thread each time it has been solved to your satisfaction (either by yourself or someone else).
Cheers,
Brad