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

Call function in background task.

Former Member
0 Likes
10,780

Hi,

I am calling one function module in background and with RFC destination. I am using IMPORTING parameter there. Using this importing parameter's value I am performing further action.

Actually I have received one warning message when I checked is 'Function in background task can't IMPORT any values.'

I wanted to know when I will run this program, shall I get value in IMPORTING parameter ?

Thanks.

6 REPLIES 6
Read only

RaymondGiuseppi
Active Contributor
4,945

To use importing parameter in the CALL FUNCTION statement, you must use a synchronous call.

Calling this FM IN BACKGROUND TASK will execute it in another LUW after the end of update tasks triggered by COMMIT WORK and you wont get the result back (Your transaction will be already completed at that time)

Are you sure you want to execute the FM with this mode, were you  trying to execute an asynchronous call and get the result later for performance problem, if yes, look for syntax of CALL FUNCTION STARTING NEW TASK, in this mode you can trigger a form or method to RECEIVE results later in the caller program. Also manage a counter in global area to keep trace of the number of asynchronous call not yet completed, increment when starting a new task, and decrement after the RECEIVE statement, you could then wait in your code until this value reaches zero, no more task currently active.

Don't hesitate to use F1 key on Abap editor when you try new statements.

Regards,

Raymond

Read only

0 Likes
4,945

Hi,

Previously I have written function module like below.

Call function 'ABC' in background task

      destination XYZ

          EXPORTING

               .

               .

          IMPORTING

               .

          TABLES

               .

               .

IF sy-subrc = 0.

     COMMIT WORK.

ENDIF.

Now...I have removed in background task and tested and got abap dump. After that I have removed COMMIT WORK also but got the same abap dump.

How I should write my code now ?

Thanks.    

Read only

0 Likes
4,945

Great Explanation Raymond !

Read only

Former Member
0 Likes
4,945

This message was moderated.

Read only

Former Member
0 Likes
4,945

Hi,

You wont be getting any values in IMPORTING parameter in background mode.

Suggest you not to execute RFC in background as you have do further processing after getting IMPORTING parameter

Read only

former_member188251
Active Participant
0 Likes
4,945

Can you post the dump ?