Application Development and Automation 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: 
Read only

Debugging in FM started in background

Former Member
0 Likes
2,526

Dear Colleagues !

I start an FM in background (it must be started there). I'd like to debug it. At the command for starting this FM I have a debugging point. Here I can set the property check box "TRFC (In background Task): Block Sending". Thereafter I go forward with F8. If I start afterwards the tx SM66, I don't see my FM in the list.

What do I make wrong ? What is my error ? Can You give me any advice ?

Thanks a lot and kind regards

Peter

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,343

Hi Peter,

Are you talking about Outbound or Inbound Queue.

If so, Start the FM in debug mode then goto Menu Setting->Display/Change debugger settings there you check the TRFC (In Background Task):Block Sending. open one more session goto SMQ1 or SMQ2. Now hit F8 to run the FM.

In SMQ1 session, Double click the queue as soon as it appears in the queue list then in the next screen select the queue and hit Lock Queue button.

Your queue will be stopped. Otherwise, your queue will disappear within minutes.

Thanks,

Sampath.

6 REPLIES 6
Read only

Former Member
0 Likes
1,343

Try schedule the program in SM37 without releasing it. Then use ok-code "JDBG" to copy it into the debugger (place your cursor on the scheduled job).

Cheers,

Julius

Read only

Former Member
0 Likes
1,343

Hi,

If it is a custom function module.. Try to code a infinite looping before the code which u want to debug as below:

DATA: int type i.

WHILE int = 0.

CLEAR int. (it doesn't make any sense.. but still just to have infinite looping.. write any code which doesn't change the value of int.

ENDWHILE.

Now execute the FM in bacground. Go to SM50.. You will see the your FM execution in the process overview.

Process will list the processes being run in the current application server.

Select your specific process & go to PROGRAM/SESSION ---> Program ---> Debugging

This should open a debugging screen in another session which will point to the infinite looping line. Now change the value of INT in the debugging mode.. & proceed further to debug your subsequent main code..

If its a standard function module, then Schedule a job & select the job & type "JDBG" in the command field. You should be able to get into the debugging mode..

Plz let me know if you have questions..

Thanks

Geetha

Read only

0 Likes
1,343

Another option (a combination of your and my post) is to copy the job with a break-point ahead of the FM call, and then (perhaps temporarily...) using a destination parameter (NONE) to step (F5) into the FM in the system debug mode (if permitted...).

At the TechEd Berlin, there was also a session on "layered debugging" which can be attached to the terminal. In higher releases, that might be a better option.

Cheers,

Julius

Read only

Former Member
0 Likes
1,344

Hi Peter,

Are you talking about Outbound or Inbound Queue.

If so, Start the FM in debug mode then goto Menu Setting->Display/Change debugger settings there you check the TRFC (In Background Task):Block Sending. open one more session goto SMQ1 or SMQ2. Now hit F8 to run the FM.

In SMQ1 session, Double click the queue as soon as it appears in the queue list then in the next screen select the queue and hit Lock Queue button.

Your queue will be stopped. Otherwise, your queue will disappear within minutes.

Thanks,

Sampath.

Read only

0 Likes
1,343

I agree with you, but as it is tRFC, we may do a little bit different. It works for me (I just tested), but I am not sure if it works in all cases (give us a feedback if not) :

- add breakpoint in YYYY which calls CALL FUNCTION 'XXXX' IN BACKGROUND TASK ...

- start YYYY

- when you arrive at the breakpoint, change debugger settings, set the flag as said by Sampath (this flag means that, when the commit work occurs, the background task (FMs + parameters) is stored into database but not executed)

- run SM58

- Select the background task, and choose menu edit + debug LUW, the "background task" will start interactively and the debugger will stop at predefined points by sap, and in FM XXXX automatically.

Hope it's clear !

Read only

Former Member
0 Likes
1,343

Hi Sandra !

I have chosen Your suggestion, it works fine.

Thanks a lot and kind regards

Peter