Application Development 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: 

Calling custom function module in background task

Former Member
0 Kudos


Hi All,

I need to call a custom function module in my program and run it as a background task. I used

      CALL FUNCTION 'Z_SD_SERV_ORDER_CREATE' IN BACKGROUND TASK

        TABLES

          T_FLTHDR       = LT_FLTHDR

               .

IF SY-BATCH EQ 0.

ENDIF.

But the SY - BATCH returns me SPACE . I checked in SM37 also. There was no background job running. Can anyone please help me out on this?

Regards,

Siju

8 REPLIES 8

nabheetscn
Active Contributor
0 Kudos

Hi Siju

If you call a function in background task it will not schedule a job in SM37/SM37. What exactly you want to happen?

Nabheet

0 Kudos

Hi Nabheet,

The custom function module 'Z_SD_SERV_ORDER_CREATE' which I am calling in my program has the code to create service orders. I want it to be executed in background . Any way to do this?

0 Kudos

Hi,

It is a trfc. The function will be registered in SM58. Kindly go through the basics on CALL FUNCTION IN BACKGROUND TASK before trying it. There are options to execute LUW.

Regards,

DPM

0 Kudos

The way you have done is a TRFC  call as mentioned will get triggered on commit. You can use syntax starting new task/receiveing results(if you want) for the same. Search on SCN for function module starting new task

Nabheet

0 Kudos

Hi DPM,

Now I used

CALL FUNCTION 'Z_SD_SERV_ORDER_CREATE' IN BACKGROUND TASK AS SEPARATE UNIT

        TABLES

          T_FLTHDR       = LT_FLTHDR

                .

COMMIT WORK.

And when I check in SM58 , it gives me an error that :

Function module "Z_SD_SERV_ORDER_CREATE" cannot be

used for 'remote' call   .

Any way to sort it out?

0 Kudos

Hi,

Check whether your FM is remote enabled. If not, kindly make it Remote function in the Function module attribute screen.

Regards,

DPM

0 Kudos

Goto Se37 and make your function module RFC enabled in attributes

Former Member
0 Kudos

Thanks everyone. Issue resolved.