Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to capture return messages from function module which is executing in background task

Former Member
0 Likes
2,688

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,

2 REPLIES 2
Read only

matt
Active Contributor
0 Likes
1,491

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.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,491

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)