‎2013 Oct 08 3:23 PM
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.
‎2013 Oct 08 3:40 PM
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
‎2013 Oct 09 8:41 AM
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.
‎2013 Oct 09 8:52 AM
‎2013 Oct 08 3:40 PM
‎2013 Oct 08 3:41 PM
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
‎2013 Oct 09 8:56 AM