cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to debug a function module called in background task ?

0 Likes
15,249

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 ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

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

Go to SM58, select the tRFC

EDIT -> debug LUW

0 Likes

Hi,

Thanks for the response. I have already tried the same, but it didn't work in my case.
No entry present in SM58.

Process :-
Work order is created in ECC from the CRM Web UI.
And during Update process, our scenario is executed. The custom FM is called in a BADI that is executed in update task. 'Update debugging' and 'tRFC (In Background Task)' setting also didn't help us in getting into the FM.

Sandra_Rossi
Active Contributor

So, you need first to enter Update Debugging (debugger options). When you enter the update task, you need to make sure "tRFC block sending" is activated, then use SM58 and so on.

0 Likes

Hi Sandra,

Thanks for the suggestion. We have already tried both these settings : 'Update debugging' and 'tRFC block sending'.
But we still didn't get any entry in SM58.

Regards,
Tapas

Sandra_Rossi
Active Contributor
0 Likes

Maybe there's an authorization issue or a bug in the kernel? For the first case, use SU53 ou ST01; for the second one, you should check the SAP notes, and if none fits the issue, then contact the SAP support.

Sandra_Rossi
Active Contributor
0 Likes

Addendum: are you sure it's a "local" tRFC call ? Don't tell me that there's a DESTINATION defined in the CALL FUNCTION IN BACKGROUND TASK. In that case, you should check in the target system.

Answers (2)

Answers (2)

former_member400468
Active Participant

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

0 Likes

Hi Evgeny,

I have tried the endless loop, the background FM is stuck at the point. But it's not visible in SM50, as a result I am not able to debug the same.

Regards,
Tapas

matt
Active Contributor
0 Likes

If your system has more than one appserver, perhaps you're logged on to the wrong server. Use SM51.

Former Member

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

0 Likes

Hi Rob,

We have debugged the scenario by putting an external breakpoint in the code. But we are not able to drill down into the custom FM that is called in 'Background task'.

Regards,
Tapas

harald_lesche-holzbecher
Product and Topic Expert
Product and Topic Expert
0 Likes

Did you try setting the external breakpoint in the custom FM that is called in 'Background task'?