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: 

how to debug the background job in ABAP

Former Member
0 Kudos

Hi Guys,

Can anyone let me know how to debug the background job in ABAP.

Thanks in advance

peter

1 ACCEPTED SOLUTION

0 Kudos

Follow the steps

  • Place a session debug break-point in your code
  • Go to SM37->Enter job name->Execute
  • Enter JDBG(no / before JDBG) in command field and place the cursor on the job name. Now press ENTER button.
  • It takes you to debug mode
  • F8 and you will hit your break point. If this does not work, place the cursor in the program/function module and press F7 three times. It takes you to the program

Hope this helps.

10 REPLIES 10

Former Member
0 Kudos

In the code put

data l.

while L <> '1'.

endwhile.

at transaction sm50, you will see the process , select it and go to program / mode - > program ->debug.

Former Member
0 Kudos

Hi Peter,

the process would be vague but I used to do this for debugging any Background Jobs. You can create a Temporary Table. then you can update or insert values from the program to this table and varous location where you feel to check for values. once the proces is completed go to the table and check if the values entered there are correct if not you'll know the position where it has ended up with error so you can then fix it up.

Thanks,

Prashanth

Former Member
0 Kudos

Hi,

Goto SM37 and see the log if any is there and based on that you can check the code.

you can't debug background job.

Create a Variant for the Program and

Schedule JOB in background:

Go to SM36 create a Job

enter Program and Variant for that program in STEP..

click on Start Condition

Click on DATE and TIME enter date scheduled Start and END times

click on Period Values

Click on HOURLY/WEEKLY etc

CLick on RESTRICTIONS also to use further criteria.

so your job will be scheduled and run as per your requirement.

and in SM37 Transaction check the status of that JOB

Check this link for scheduling jobs..

http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm

Check this

http://jplamontre.free.fr/SAP/Debug%20background%20process.htm

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abap+debugger&;

Regards,

Padmam.

0 Kudos

Guys,

Thanks for the quick replies.

We however are facing a problem. as wen fetching data into BI system trhough RFC call. BI logs into R/3 using ALEREMOTE and starts a job in background.

we tried endless while loop and debug the code through SM50 it didnt get into debugging. surprisingly system let me debug all dialog programs through SM50.

apart from writing values in table, is there any better way?

Thanks

Murali

0 Kudos

The best way to do it is SM66, then click on "Debugging", this works for the various process thread types.

It usually depends if the program is at a point where it will support debugging (ie if it's spending minutes waiting for a return from the database, then the debugger has to wait as well)

Give that a try

0 Kudos

Follow the steps

  • Place a session debug break-point in your code
  • Go to SM37->Enter job name->Execute
  • Enter JDBG(no / before JDBG) in command field and place the cursor on the job name. Now press ENTER button.
  • It takes you to debug mode
  • F8 and you will hit your break point. If this does not work, place the cursor in the program/function module and press F7 three times. It takes you to the program

Hope this helps.

former_member188282
Active Participant
0 Kudos

Hi Bog Peter,

if you want debug the background job then you have to create infinite loop in your programme.

  • Goto SM50
  • Select the work processor executing this processor.
  • Select Program/Mode -> Program -> Debugging. Now the execution of the program would be opened in debug mode.
  • Change the value of the variable, causing the program executing in endless loop and click F8. Now the program execution would successfully be completed

Regards,

Rajesh

former_member592035
Discoverer
0 Kudos

SAP has standard F'tn C160_HOLD_FOR_DEBUG which you can use in combination with Parameter ESN to create endless loop. If you set the User-Parameter ESN = 'X' (EHS: (developers only) = 'X': activate INC14Z_HOLD_FOR_DEBUG) then endless loop starts and via TRx SM50 you can get the process in debugging mode.

former_member1716
Active Contributor
0 Kudos

Hello,

As suggest by all above reach out to the required Job first.

Place the cursor on the Job and type JDBG in the command Bar.

Now once the Debugger screen triggers you will not find the relevant program for the Job. You have to pass through the initial Debugger screen by pressing F7 (Nearly 7-10 Times you have to press F7). The initial debugger screens are part of standard execution. keep pressing the F7 until you reach the desired program.

Cheers!!!

Satish

0 Kudos

If you give the same answer as someone else, but maybe you want to add something constructive, probably it's better to just "comment" on the existing answer so that to complete it?