‎2016 Sep 27 6:12 AM
Hi,
what is correct way to call SRM from ECC program asynchronously ? so that the ECC program gets over even if SRM code is running.
call RFC function module in update task
or
PI scenario to trigger SRM code
ECC needs results so SRM needs to send results once SRM task is completed.
thanks for any inputs
bhakti
‎2016 Sep 27 12:01 PM
Hi Bhakti,
"CALL FUNCTION IN UPDATE TASK" is basically a synchronous call, the difference being only that all inserts/updates to database tables are not performed directly on the tables, but in a temporary "update area", so they can be committed/rolled back later in one unit by the "update work process".
If you want an asynchronous communication to a different system, you need to use "CALL FUNCTION STARTING NEW TASK", e.g.
CALL FUNCTION 'MY_FUNC' STARTING NEW TASK 'my_task'
PERFORMING MY_FORM ON END OF TASK
DESTINATION 'my_dest'
EXPORTING ...
IMPORTING...
TABLES...
EXCEPTIONS...
And then you need a form routine like this, which will be triggered asynchronously, when the results from the target system arrive:
FORM MY_FORM USING TASKNAME.
RECEIVE RESULTS FROM FUNCTION 'MY_FUNC'
IMPORTING ...
TABLES ...
EXCEPTIONS ...
....
ENDFORM.
See the ABAP doc of the CALL FUNCTION statement for more details and samples.
Best Regards, Ulrich
‎2016 Sep 27 12:01 PM
Hi Bhakti,
"CALL FUNCTION IN UPDATE TASK" is basically a synchronous call, the difference being only that all inserts/updates to database tables are not performed directly on the tables, but in a temporary "update area", so they can be committed/rolled back later in one unit by the "update work process".
If you want an asynchronous communication to a different system, you need to use "CALL FUNCTION STARTING NEW TASK", e.g.
CALL FUNCTION 'MY_FUNC' STARTING NEW TASK 'my_task'
PERFORMING MY_FORM ON END OF TASK
DESTINATION 'my_dest'
EXPORTING ...
IMPORTING...
TABLES...
EXCEPTIONS...
And then you need a form routine like this, which will be triggered asynchronously, when the results from the target system arrive:
FORM MY_FORM USING TASKNAME.
RECEIVE RESULTS FROM FUNCTION 'MY_FUNC'
IMPORTING ...
TABLES ...
EXCEPTIONS ...
....
ENDFORM.
See the ABAP doc of the CALL FUNCTION statement for more details and samples.
Best Regards, Ulrich
‎2016 Sep 27 10:16 PM
hi Ulrich
we are already calling the same way
but my requirement is that the ECC program shud get 'completed'
the background job in sm37 should be completed, finished.
the program in SRM should have got started. and when it will get finished, then the results shud be sent back to ECC.
Starting new task is asynchronous in way of connection but as a functionality, the calling program is not finished while the RFC is running.
thanks
bhakti
‎2016 Sep 30 3:47 PM
Hi Ulrich and other gurus
do comment on the requirement how to achieve it.
Would this be another option - call remote function from ABAP in SRM, trigger an ABAP OOPS event, start another process as event handler , the remote function is completed so the ABAP process is complete. once the event handler is completed in SRM , it will update the Ztable in ECC with its results.
is it correct or feasible or is there a better approach ?
any comments, anything, any thoughts are welcome
thanks in advance
‎2016 Sep 30 3:58 PM
Hi Bhakti,
ok, as far as I understand the requirement now, you are looking for some kind of "messaging infrastructure": ECC sends a message to SRM, where it is stored in a queue. At some point of time a scheduler in SRM processes the message, and when it is finished, it sends a "response message" back to ECC. Here again a scheduler processes the response and updates the table.
Not sure, whether that can be achieved with out-of-the-box ABAP features. Perhaps the closest you can get would be to use "Background RFC" (bgRFC) with two queues (one outgoing, one incoming) on each of the two systems?!
An old-style approach would be to use ALE and exchange IDocs between the two systems?!
Best Regards, Ulrich
‎2016 Sep 30 5:11 PM
hi Ulrich
no my requirement is not messaging infrastructure
but from your description it could be one of the solutions to my requirement
I will check the bgRFC and ALE IDoc options
my only requirement is that my ECC program need not wait till the SRM work is finished because its taking too long. but then ofcourse I need the results of the SRM activity to log in ECC.
I don't have too much time and resource and need simplistic solution
thanks very much for sharing your knowledge, its very useful for me to design the solution to have your thoughts and ideas
thanks
bhakti