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

Regarding background job.

Former Member
0 Likes
1,577

Hi All,

I have to debug background job which is currently running.

I know how to get the job in debug mode, that is through SM51 transaction...But once i m done with seeing some values in debug mode. I need to put this job back again in the background. Becasue since this is long running job i can not run it in forground.

Plase guide me in this regards.

-Sanjay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,529

Hi,

You can debug batch jobs by going to 'SM37', type in 'JDBG' in the

command line ( no '/' ), put the cursor on the job and press enter - will

take you to the job in debug mode.

You can do this only after the job has finished execution. This will simulate the exact background scenario with the same selection screen values as used in the job also sy-batch will set to 'X'.

So type in the transaction code 'JDBG' and place your cursor on the job after It has finished. It will take you to a SAP program in debug mode. Step through this program which is about 10 lines, after this your program will be executed in the debug mode.

Steps

1. Create variant called BACKGROUND for program to be debugged.

2. Execute ZDEBUGBG (pgm code below) in background for immediate processing.

3. Execute transaction SM50.

4. Select process that runs ZDEBUGBG.

5. Goto 'Program/Session' 'Program' 'Debugging'.

A se80 debug session will open.

6. Change variable W_EXIT to 'E'.

7. Step thru (F6) until ZWBTEST comes up.

1. Go to Transaction SM66 and find your work porocess.

Select the line work process is on and click on the Debugging button.

If this is a custom program, you can put a wait statement in the code to buy yourself sometime.

2. Go to Transaction SM50. From the tool bar "Program/session"->Program->Debugging.

goto SM37 and from Program menu(not sure.. try other menu's)

-->Catchjob . it will goto the active job in debugging mode.

Regards,

Raj.

10 REPLIES 10
Read only

Former Member
0 Likes
1,529

Hi,

I searched the forum with the terms 'debug background job' and found loads of answers.

You may want to do the same.

Regards,

Nick

Read only

Former Member
0 Likes
1,530

Hi,

You can debug batch jobs by going to 'SM37', type in 'JDBG' in the

command line ( no '/' ), put the cursor on the job and press enter - will

take you to the job in debug mode.

You can do this only after the job has finished execution. This will simulate the exact background scenario with the same selection screen values as used in the job also sy-batch will set to 'X'.

So type in the transaction code 'JDBG' and place your cursor on the job after It has finished. It will take you to a SAP program in debug mode. Step through this program which is about 10 lines, after this your program will be executed in the debug mode.

Steps

1. Create variant called BACKGROUND for program to be debugged.

2. Execute ZDEBUGBG (pgm code below) in background for immediate processing.

3. Execute transaction SM50.

4. Select process that runs ZDEBUGBG.

5. Goto 'Program/Session' 'Program' 'Debugging'.

A se80 debug session will open.

6. Change variable W_EXIT to 'E'.

7. Step thru (F6) until ZWBTEST comes up.

1. Go to Transaction SM66 and find your work porocess.

Select the line work process is on and click on the Debugging button.

If this is a custom program, you can put a wait statement in the code to buy yourself sometime.

2. Go to Transaction SM50. From the tool bar "Program/session"->Program->Debugging.

goto SM37 and from Program menu(not sure.. try other menu's)

-->Catchjob . it will goto the active job in debugging mode.

Regards,

Raj.

Read only

0 Likes
1,529

Actually i know how to bring the job in to bedugg mode, but dont know how to resume that job again in the background.

Read only

0 Likes
1,529

In transaction code SM51 go to Debugging menu, then choose Debugging Off option. That's all.

Regards.

Rafael Rojas.

Read only

0 Likes
1,529

There is no option for Debuggin off in sm51. If you know can u pls tell me where is that option.

-Sanjay

Read only

0 Likes
1,529

What SAP version do you have in your system?

I have used transaction code SM51 since SAP ERP 4.7. That option is inside Debugging menu.

Regards.

Rafael.

Read only

0 Likes
1,529

I m using SAp version 4.6c . I can see the option for debugging On but no option to make it off.

Read only

0 Likes
1,529

I just executed transaction code SM51 in a SAP 4.6C version. Unfortunately i can not attach here an image of that.

I imagine you have executed transaction code SM51, then you double click on Server name which is shown there (or what you want to select). An ALV with process types is shown. Then you select the process you want to debug. Now, you select menu Program/Session -> Program -> Debugging.

A windows with a question appears. You answer Yes because you want to debug the program you have selected before.

Now, the debugger window appears. Look at menu bar. There you can see Debugging menu. Inside this menu you can find the Debugging off option. This option is what you need to select to continue you process after you enter in debugging mode.

Regards.

Rafael Rojas.

Read only

0 Likes
1,529

That solves the problem thanx for ur help.

-Sanjay

Read only

GauthamV
Active Contributor
0 Likes
1,529

HI,

Goto sm37 give ur job name and give JDBG in command and execute,then u can debugg ur job.

if u want to delete long running job goto sm04 and click on end session.

reward points if hlpful.