Skip to Content
avatar image
Former Member

How to debug a function module called in background task ?

I have a custom function module, which is called in during a standard process at Work Order SAVE.
The FM is called by using statement : 'Call Function <FM name> in Background task'.

To analyze the issue, I need to go inside this FM during debugging when the process is executed. I have also tried endless loops as well, the flow is stuck there but it is not visible in transaction SM50. As a result, I am not able to debug the same, and also the Order is not getting opened in Change mode.

Is there any way of doing this ?

Add comment
10|10000 characters needed characters exceeded

  • If you do an endless loop and you don't see the process in SM50, then it's because:

    • Either it's run by another application server. Use SM66 instead of SM50 to see workprocesses of all application servers.
    • Or you use WAIT UP TO n SECONDS which makes it disappear from the active workprocesses during this N second(s). Instead, use an empty endless loop DO ENDDO (in debug you can jump after the ENDDO).
  • Sandra,

    Does that mean in this case,if it is not showing up in SM50,it will show up in SM66 ?

    Do we have the option of switching into Debugging Mode by choosing the concerned workprocess in SM66,similar to what we do in SM50 ?

    Thanks,

    K.Kiran.

  • I said EITHER try SM66 if you have several application servers, OR you used WAIT UP TO n SECONDS. So, I can't tell you if it will show up in SM66, especially if the issue is the other option.

    The debug option is available in SM66 from Basis 7.40. If you have a previous release, then you need to check on which application server is running your endless loop via SM66, then you switch to this server via SM51, then you start SM50.

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 30, 2017 at 12:02 PM

    Hi,

    Turn on the "tRFC (In Background Task): Block Sending" flag in the debugger settings

    Go to SM58, select the tRFC

    EDIT -> debug LUW

    Add comment
    10|10000 characters needed characters exceeded

  • May 31, 2017 at 07:12 AM
    -1

    Hi!

    You can try to put endless loop DO... ENDDO and then go to SM51 and find your process and then choose Administration->Program->Debugging

    Hope it's helpful

    Evgeny

    Add comment
    10|10000 characters needed characters exceeded

  • May 30, 2017 at 03:29 PM

    Hi,

    in de abap editor go to utilities-->settings

    Then tab ABAP editor-->Debugging.

    Type here the user id that is used when you call the fm in background task. Now place an external break-point in the code and reproduce the behaviour.

    If the user is a background user, then temporarily change it to dialog.

    Kind regards, Rob Dielemans

    Add comment
    10|10000 characters needed characters exceeded