‎2011 Sep 15 8:54 AM
Hi All,
I have a requiremenet to create a notification for a work order at the time of releasing and saving the order. I tried using the BAPI_ALM_NOTIF_CREATE with a save user exit and it worked fine. But failed in 1 case which is, if I manually enter another notification in the object list tab and then release and save the order, there would be an update termination error. In the requirement I have to have all the manually entered notifications as well as the newly created notification.
So what I did is, I found out an enhancement section wherein the order is actually getting saved by a FM CO_ZV_ORDER_POST (which exists already in the enh. point) This FM is internally using a commit work. After this FM call, I am using a Submit program to call a report that i created which uses BAPI to create a notification. And I'm also using a Commit work within this report. WIthout this commit, I will not be able to create the notification. Now my question is that, I'm aware that a commit should not be written in the enhancement point. But since a commit work is already encountered in the FM to save the order, am I safe to use a commit work within the submit program?
‎2011 Sep 15 9:37 AM
No..not recommended.
Check with link:[CALL FUNCTION - IN BACKGROUND TASK|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_BACKGROUND_TASK.htm]
Try to use this before the actual commit of the transaction.
kesav
‎2011 Sep 15 10:15 AM
But the actual commit is happening within a FM CV_ZV_ORDER_POST which was already present in the enhancement section. Do you mean I have to create another FM with my logic in it and call this FM before the order post FM? Can I use a commit in my custom FM? ANd also I have to make sure that even if I have manually entered notifications in the object list tab, all these notifications have to be committed to the database table before I can create a notif. in the background. I'm not getting how this Call FM in background task works. Could you please explain in simple terms?
Thanks
‎2011 Sep 15 10:25 AM
Hi,
First of all did you check for standard badi methods available for this ?
But the actual commit is happening within a FM CV_ZV_ORDER_POST which was already present in the enhancement section. Do you mean I have to create another FM with my logic in it and call this FM before the order post FM?
Create a Remote enabled FM with your logic in it
Can I use a commit in my custom FM?
Not required. But has to be called just before the commit of CV_ZV_ORDER_POST.
Call the RFC in background task as seperate unit. You will find several examples( search in SCN )
ANd also I have to make sure that even if I have manually entered notifications in the object list tab, all these notifications have to be committed to the database table before I can create a notif
Could you explain this more clearly. What do you mean by manually entered notifications ?
I'm not getting how this Call FM in background task works
SAP help explains it clearly. For examples search in SCN
Kesav
‎2011 Sep 15 10:41 AM
If I have to call the FM just before CO_ZV_ORDER_POST FM commit, then i will have to enhance this FM. But I do not want to modify this FM.
By manually entering notifications, I mean that, earlier I had implemented my logic in a save user exit and it worked fine if the notifications in the object list tab are already saved in the database. But it failed when I release the order, then enter some notifications manually in the object list and then save. This is the time my logic of creating a new notification should should meet. But the new notification is over writing the manually entered notification and in some cases, an update termination error happens. Hence I made a decision to write my logic after the commit in the order post FM and then use a commit again in my logic.
Now as per what you said, if i write my logic before the actual commit, then I will be facing the same problem as before i.e., my new notification overwriting the manually entered notification at the time of saving a released order. Hope I'm clear this time.