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

how to debug the background job in ABAP

Former Member
0 Likes
34,188

Hi Guys,

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

Thanks in advance

peter

1 ACCEPTED SOLUTION
Read only

0 Likes
23,363

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.

Hi Guys,

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

Thanks in advance

peter

10 REPLIES 10
Read only

Former Member
0 Likes
23,363

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.

Read only

Former Member
0 Likes
23,363

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

Read only

Former Member
0 Likes
23,363

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.

Read only

0 Likes
23,363

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

Read only

0 Likes
23,363

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

Read only

0 Likes
23,364

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.

Read only

former_member188282
Active Participant
0 Likes
23,363

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

Read only

Former Member
0 Likes
23,363

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.

Read only

former_member1716
Active Contributor
23,363

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

Read only

0 Likes
23,363

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?