Skip to Content
avatar image
Former Member

Background RFC

Hello all,

I am executing a RFC in background via a report, but the RFC is running in dialog work process.

I want the RFC to run in background work process.

I am using the below code, in this case the background job is getting finished in 0 secs.

CALL FUNCTION 'ZFM_USAGE' in BACKGROUND TASK

                                          DESTINATION  wa_rfc-rfc_name

how to run a RFC in Background work process ?

Regards,

Shony KJ

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Oct 26, 2015 at 12:27 PM

    AFAIK If you actually want a background job (SM37, background processes) you must use some JOB_OPEN/SUBMIT/JOB_CLOSE in your FM)

    Regards,

    Raymond

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 23, 2015 at 12:41 PM

    "BACKGROUND TASK" makes the process as tRFC which uses Dialogue work process.

    What you try to achieve can be achieved if you wrap the RFC in a JOB ( You can create a separate executable report and use "SUBMIT VIA BACKGROUND JOB option), then only it will consume a background work process instead of dialogue work process.

    R

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      So create another program(Program 2) and submit that in a job and inside program 2 call your RFC normally CALL FUNCTION 'ZFM_USAGE'       DESTINATION  wa_rfc-rfc_name

  • Oct 23, 2015 at 01:22 PM

    Hi Shony,

    Are you trying to call this FM in Multi threaded mode ?  If yes you can call as below :

    CALL FUNCTION 'ZFM_USAGE'

             STARTING NEW TASK <your task name>

             DESTINATION IN GROUP <your logon group name>

             PERFORMING get_data ON END OF TASK

             EXPORTING

               lv_start              = lv_start

               lv_end                = lv_end

             EXCEPTIONS

               communication_failure = 1

               system_failure        = 2

               resource_failure      = 3

               OTHERS                = 4.


    And then you need to create one Subroutine with name 'get_data' (based on above code)


    *--> Here we are receiveing data so only receiving table will be here..

       RECEIVE RESULTS FROM FUNCTION 'ZFM_USAGE'

       IMPORTING

         ev_bool       = lv_bool

       TABLES

         lt_output     = it_data_temp1

       EXCEPTIONS

         communication_failure = 1

         system_failure        = 2

         resource_failure      = 3

         OTHERS                = 4.

       APPEND LINES OF it_data_temp1 TO it_data.

       CLEAR it_data_temp1[].

    But before calling you need to find out how many Worker Processes are available in system.

    This can be done using API: SPBT_INITIALIZE which takes logon group name and returns Total and Available WPs.

    Hope this will help.

    Thanks-

    Abhishek

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Abhishek Sharma

      Thanks Abhishek,

      As you suggested , I have used the FM 'START_OF_BACKGROUNDTASK'  also.

      but the jobs are finished in 0 secs in the source system and in the target system there is no job scheduled or finished.

      Thanks

      Shony

  • avatar image
    Former Member
    Oct 23, 2015 at 01:31 PM

    Good day Shony,

    Article from scn regarding the parallel processing. calling the function module inside a report on a background job will use background process but will process function module inside report using the dialog work process.

    http://wiki.scn.sap.com/wiki/display/ABAP/Parallel+Processing

    Regards,

    Tumelo Modise

    Add comment
    10|10000 characters needed characters exceeded