Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Topic Covered:
1) What is SAP Background Job?
2) How to create SAP Background Job?
3) Tips and steps to debug Background Job
1) What is SAP Background Job?
Background jobs: are jobs in the SAP system that run in the background without
affecting the normal operations in the system.
You can schedule the background job using SM36 and can be monitored using
SM37
Background jobs are used to reduce the manual effort and to automate the
process. They can run in the background without any user input and can be
scheduled to run when the system load is low.
2) How to create SAP Background Job?
Scenario: We have a requirement for a particular user who needs a report for all
supplier invoices created each week for the particular company (1710) and also
he wants to receive this report directly in his email id.
The first thing we are going to do is find the name of the program for transaction
code: MIR5
MIR5: is a transaction code used for Display List of Invoice Documents in SAP
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Now let’s create a variant
Variant: allow you to save your selection parameters in the input screen.
Go to se38 open the program and create a variant depend of your requirement
Save
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Copy the program name and go to SM36
Enter the Job name
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Choose Job Class
Background jobs can be divided into three categories −
Class A (High Priority) − this is used for urgent or critical task and must be
scheduled with class A priority job. Class A job reserves one or more
background work processes.
Class B (Medium Priority) − these jobs are executed after the completion of
Class A high priority jobs.
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Class C (Low Priority) − these job runs once class A and class B jobs are
completed.
Go to step
Select Variant that we created before
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Check and Save
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Now we will setup E-MAIL notification
Now we will create a condition
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Here we have different options
Immediate: If you press immediate, it means that you want to run the job in the
background immediately.
Date/Time: if you want to start it on a specific day and time
But for the test purpose I will run this immediately because I want to show you
the result right now
Now go to SM37 to monitoring it
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Execute
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
As you can see the Status is finished that means our report is ready
3) Tips and steps to debug Background Job
Now let's see how we can debug the SAP background job. A particular event may
cause us to debug the background work, for example when the output is incorrect
or we have no output at all.
a) How to debug a completed job?
Select the job and in the command line enter the background debug command
JDBG and hit enter
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
When you are in debug mode, the first thing to do is to look at the top of the
debug screen to see if it is the same name as the program we are running in the
background.
In our example you can notice that the name of the program is different
Now hit (F7 icon strip) until you reach in the name of the program you run in the
background job
Now you can see that we find our program
SY-BATCH: is the variable to check if your program is running in the background or
not. If it carries the value 'X', this means that the program is running in the
background.
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
b) How to debug a running job?
SM50 background debugging
If you want to debug a running job, you have to go to SM50 and select the
background process. Then choose the menu option Administration / Program /
Debugging. Confirm the prompt:
You will get this message
Debugging A Background Job
By
René Rodrigue Efila Minkoulou (SAP S/4HANA MM/SD Consultant)
Select Yes then the system will open the running job in debugging mode
Thank you