‎2009 Feb 24 5:09 PM
Hi.
I have a strange new requirement. I need to launch a process from an enhancement that begins after the commit of the transaction.
Suppose the user sets the status of a document in CV02n to A. Now the customer wants that as soon as the status is set to A...the status must be changed to B. But a log must exist of the status being set to A. And, this change must be done from an enhancement.
So in essence, I need to start a work process that begins just after a commit. All the update task options run before a commit. So they seem to be of no use.
Any idea how to do this? I thought one possible way is to call another FM in background task and then try to place a lock on the document in an infinite loop. However, this is as inefficient as it gets and I would like to try and avoid this for as much as possible.
Any suggestions?
No points will be given to any answers, no matter how helpful.
Edited by: Rob Burbank on Feb 24, 2009 1:55 PM
‎2009 Feb 24 5:16 PM
First, is the ECM implemented? This log all the changes which are being done for a specific transction. For your scenario I am thinking below possible solution.
Start changing the document (say set status to A)
Wait for a second(s) to commit the data in database
Then check the status, If the status A again, call another FM or BDC to change the status to B
You need to have the defined sets of status which will avoid the infinite loop.
Please try this.
Regards
Nagarajan
‎2009 Feb 24 5:16 PM
First, is the ECM implemented? This log all the changes which are being done for a specific transction. For your scenario I am thinking below possible solution.
Start changing the document (say set status to A)
Wait for a second(s) to commit the data in database
Then check the status, If the status A again, call another FM or BDC to change the status to B
You need to have the defined sets of status which will avoid the infinite loop.
Please try this.
Regards
Nagarajan
‎2009 Feb 24 7:23 PM
Hi!
You have to execute a FM in the exit in UPDATE TASK.
That means, after the commit is issued, your Function gets executed. I had the same problem and solve it like this.
Este
‎2009 Feb 24 11:01 PM
Hi!
Thanks for your replies.
Nagarajan: I should have mentioned it earlier. I am sorry for not doing so. I already proposed a wait - but as a rule waits are not allowed as per the dev standards in the project and they are not willing to change it. It seems stupid, but in this particular situation it actually makes sense. If the document is changed (and it can be), it can have potentially very serious impacts business wise. So a wait is out of the question unfortunately.
Este: I am sorry but an update task would not work here. This is because the function module that is called in update task is executed as soon as a commit statement is encountered. Once the FM runs successfully, then the control returns back to the commit statement and only after that does the commit take place. Should the FM fail and an exception is raised/ it encounters a exit statement etc. none of the changes that took place are committed. As a result, FMs are often called in update task in a transaction when their failure must stop the commit of a transaction or when a series of steps are to be called that need to be committed together or not committed at all.