‎2019 Feb 25 6:27 AM
Hello All,
I need your expertise on this issue.
I have a custom remote enable function module which is having one export parameter and one return table in the tables section to get the return messages from FM. I am calling this FM in background task in a report, basic business functionality working fine but not getting return messages in the calling program.
If we execute this FM normally, we are getting return messages but my requirement is to expect the FM in background task.
exact calling ... CALL FUNCTION 'XXXXX' IN BACKGROUND TASK.
Regards,
‎2019 Feb 25 7:08 AM
Have you tried reading all the documentation of CALL FUNCTION ... IN BACKGROUND? You'll see there are no IMPORTING parameters. This is a bit of a clue. You can't get info back from BACKGROUND.
Try asynchronous instead of background, using STARTING NEW TASK. That will meet your requirements.
‎2019 Feb 25 7:38 AM
Your FM will be executed asynchronously in another luw, so you cannot RECEIVE any returned parameter if you don't use matthew.billingham's proposal.
Hint: Nevertheless, as you may already know, there is an execution log in SM58, to get it in your program, get the unique TID associated to the call with a call of FM ID_OF_BACKGROUNDTASK after the IN BACKGROUND call. Then use (in some LOOP¨waiting til end of execution) the FM STATUS_OF_BACKGROUNDTASK to get any message generated by the call. (Of course you must change your RETURN table to some MESSAGE statements)