Normally when any button is clicked in FPM application(OVP,GAF,OIF) having any UIBBs, some event is triggered and application does certain processing(synchronously) ( during this time we can’t do any action on the application ,Of course this action processing takes very little time ) and then the application screen appears.
Consider the case when user processes huge records with some action and the processing takes 50-60 secs of times or even more . Now if we process this event synchronously then the user can’t do any activity as the small round processing symbol appears on the screen.
Now to avoid such long running processes, we can start using asynchronous function module which processes the huge records and the user can do parallel work without waiting for the processing to finish on the fpm application.
Now the question is how the FPM application receives the message of from the asynchronous job(FM). For this we can use the concept of asynchronous event in fpm application. The post describes how to work with asynchronous event in an ovp application with list uibb.
The list uibb displays the sales order header info. So here we have the list feeder class.
Create an ovp application.
Add list uibb and create a configuration.
Add few fields to the list.
Create a button.
So here how the application looks like. Now consider the case that user selects all sales orders and click on the Button Generate Bill.
Go to the PROCESS_EVENT method of the feeder class.
Here we can just call a asynchronous FM and pass all the sales documents to generate the bill but how our fpm application later would receives the result of the asynchronous FM. Here we can make use of asynchronous event. Generate an event and register the event for asynchronous processing .
Code inside the FM.It should make use of CL_WD_NOTIFICATION_SERVICE class to trigger the asynchronous event with the notification ID so that the fpm application can receive the result of the asynchronous job.
Here the diagram can make us understand of the flow.
Here we receive the message from the asynchronous event.