0% found this document useful (0 votes)
27 views37 pages

Chapter 01 - Background Processing

The document outlines the objectives and processes related to background processing in the SAP system, including job scheduling, job creation, and job analysis using transactions SM36 and SM37. It covers the phases of background processing, methods for passing data between job steps, and how to trigger events for job execution. Additionally, it provides examples of ABAP programs for job management and emphasizes the importance of understanding job logs and spools for job analysis.

Uploaded by

Aniruddha_Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views37 pages

Chapter 01 - Background Processing

The document outlines the objectives and processes related to background processing in the SAP system, including job scheduling, job creation, and job analysis using transactions SM36 and SM37. It covers the phases of background processing, methods for passing data between job steps, and how to trigger events for job execution. Additionally, it provides examples of ABAP programs for job management and emphasizes the importance of understanding job logs and spools for job analysis.

Uploaded by

Aniruddha_Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 37

IBM Global Services

Background Processing

Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Objectives

 The participants will be able to:


 Describe how the SAP system handles background processing.
 Create variants for ABAP programs.
 Create, schedule, and analyze a job using transactions SM36 and SM37.
 Explain the purpose of background processing.

2 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Background Processing

 Phases of Background Processing.


 Passing Data to Subsequent Job Steps.
 Scheduling Job within ABAP Program.

3 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services
Transaction
Work Processes SM50

Dispatcher

Background

Dialog Update Enqueue Spool

4 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

The Background Work Process

Background Background
Background Job
Job A
A

Step #1

Step #2

Defining a
background job (SM36)
5 Data Interfaces | Dec-2008 © 2005 IBM Corporation
IBM Global Services

Phases of Background Processing

Job
Job
Scheduling
Scheduling

Job
Job
Processing
Processing

Job
Job
Overview
Overview

6 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Scheduling a Background Job

Transaction
SM36

Job
Job
Scheduling
Scheduling

7 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Creating Step for Background Job

Steps Job
Job
Scheduling
Scheduling

ABAP External program

8 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Start Criteria for Background Job

Job
Job
Start Condition Scheduling
Scheduling

Immediate Date/Time After Job After Event

Jobs can be
Jobs can be scheduled to Jobs can be scheduled
scheduled to run after
run immediately or at a to run after an event has
another job has been
particular date/time. been “triggered/raised”.
completed.

If you start a job based on a date/time or an event, you


can schedule the job to run at regular intervals, not just
at a particular time.

9 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Scheduling a Periodic Job


Job
Job
Scheduling
Scheduling
Start date
Period values

X Periodic job With the ‘Period


Values’ pushbutton,
you can schedule
the job to run hourly,
By checking the daily, weekly,
‘Periodic Job’ option, monthly, etc.
you can specify
that the job run at
regular intervals.

10 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Scheduling Job After Another Job


Job
Job
Scheduling
Scheduling
Start date After Job

After clicking on the


‘After Job’ pushbutton,
you must specify the
name of the job that must
be completed before this
job will run.
X Start status-depend.

If you check the ‘Start status-depend.’


option, this job will run only if the
specified job ends successfully.

11 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Scheduling Job After an Event

Job
Job
Start date Scheduling
Scheduling
After Event

After clicking on the ‘After Event’


pushbutton, you must specify the
name of the event that must be
raised before this job will run. You
can distinguish between different
occurrences of a particular event
by specifying a parameter.

If you check the ‘Periodic Job’ option, the


system starts a new job each time the
specified event is raised.

12 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Triggering/Raising Events

To trigger/raise an event from within an ABAP program, you


must call the ‘BP_EVENT_RAISE’ function module.

CALL FUNCTION ‘BP_EVENT_RAISE’


EXPORTING
EVENTID = <event name>
EVENTPARM =‘ ’
TARGET_INSTANCE =‘ ’
EXCEPTIONS
BAD_EVENTID =1
EVENTID_DOES_NOT_EXIST =2
The only required
EVENTID_MISSING =3
RAISE_FAILED =4 exporting parameter is the
OTHERS = 5. name of the event to raise.

13 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Phases of Background Processing

Job
Job
Scheduling
Scheduling

Job
Job
Processing
Processing

Job
Job
Overview
Overview

14 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Processing a Background Job

Scheduler Job
Job Dispatcher

Job
Job
Background

Job
Job
Processing
Processing

15 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Processing a Background Job


Application
Application Server
Server Job
Job
Work
Work Processes
Processes Processing
Processing
8 Online 1 Spool 3 Background
Transaction
SM50

16 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Processing a Background Job


Job Log
Entries from start and end
Scheduler modules.
All messages issued by job
steps and system.

Start Module
PRINT SPOOL

Job Step #1 Job


Job Step #2
Job List
Job Step #3 Processing
Processing All “WRITE”
statement output
from job step.
End Module

17 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Phases of Background Processing

Job
Job
Scheduling
Scheduling

Job
Job
Processing
Processing

Job
Job
Overview
Overview

18 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Job Overview

Transaction
SM37

Job Status

Job
Job
Overview
Overview

Spool List

19 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Job Analysis Using Job Log

System and Program


Job
Job
Messages Overview
Overview

You can use this Job Log to analyze each step of a “finished” or
“cancelled” background job.

20 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Job Analysis Using Job Spool

Display
Report

21 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Other Background Processing Topics

 Scheduling Job within ABAP Program

 Passing Data to Subsequent Job Steps

22 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Scheduling Job within ABAP Program

Open
Open Background
Background Job
Job

JOB_OPEN

JOB_SUBMIT is
called for each
step that is to be Insert
Insert Job
Job Step
Step
added to the job
JOB_SUBMIT

Close
Close Background
Background Job
Job

JOB_CLOSE

23 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

JOB_OPEN

JOB_OPEN Background Job

Exporting: <job name>


jobname = <job name>

<job #>

Importing:
jobcount = <job #>

24 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

JOB_SUBMIT

JOB_SUBMIT
Background Job`
Exporting:
authcknam = <user>
jobcount = <job #> <job name>
jobname = <job name>
report = <report>
variant = <variant> <job #>

Exporting: Step #1
authcknam = <user>
jobcount = <job #>
jobname = <job name>
report = <report> Step #2
variant = <variant>

25 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

JOB_CLOSE

JOB_CLOSE Background Job

Exporting: <job name>


jobcount = <job #>
jobname = <job name>
sdlstrtdt = <start date> <job #>
sdlstrttm = <start time>
strtimmed = <flag1>
Step #1

Importing:
job_was_released = Step #2
<flag2>

26 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

ABAP Program Example

REPORT YDI00001.
DATA: JOBNUM TYPE JOBCOUNT.
PARAMETERS: JOBNAME TYPE JOBNAME,
PROGRAM TYPE REPID,
VARIANT TYPE VARIANT,
USER TYPE UNAME.
Open CALL FUNCTION ‘JOB_OPEN’
Open Job
Job
EXPORTING JOBNAME = JOBNAME
IMPORTING JOBCOUNT = JOBNUM.
CALL FUNCTION ‘JOB_SUBMIT’
Submit
Submit Step
Step EXPORTING AUTHCKNAM = USER
CHECK
JOBCOUNT = JOBNUM
SY-SUBRC
JOBNAME = JOBNAME
REPORT = PROGRAM
VARIANT = VARIANT.
Close
Close Job
Job CALL FUNCTION ‘JOB_CLOSE’
EXPORTING JOBCOUNT = JOBNUM
JOBNAME = JOBNAME.

27 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Passing Data to Subsequent


Job Steps
Background
Background Job
Job

Step #1
...
EXPORT <obj1 … objn>TO DATABASE
DBTABLE
<dbtable> ID <id1>.
id1 data1
…. EXPORT < obj1 … objn>TO DATASET
…. <filename> ID <id2>.

FILENAME Step #2
… … ...
id2 data2 IMPORT < obj1 … objn> FROM DATABASE
… … <dbtable>ID <id1>.

IMPORT < obj1 … objn> FROM DATASET


<filename> ID <id2>.

28 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Passing Data to Subsequent


Job Steps (Contd.)
Background
Background Job
Job

Step #1
...
EXPORT <obj1 … objn>TO DATABASE
DBTABLE
<dbtable> ID <id1>.
id1 data1
…. EXPORT < obj1 … objn>TO DATASET
…. <filename> ID <id2>.

FILENAME Step #2
… … ...
id2 data2 IMPORT < obj1 … objn> FROM DATABASE
<dbtable>ID <id1>.
… …
IMPORT < obj1 … objn> FROM DATASET
<filename> ID <id2>.

29 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Using the Database to Pass Data between Job Steps

Step Background
Background Job
#1 Job
DATA: var1(9) TYPE p
DECIMALS 2.
...
EXPORT var1 TO DATABASE
indx(st) ID ‘12345’
INDX

MANDT RELID SRTFD .. CLUSTR CLUSTD

800 SP SPH_I 254 FF05010102


Step #2
800 ST 12345 53 FF05016876 DATA: var1(9) TYPE p
800 ST ABCL 73 FF05075372 DECIMALS 2.
...
800 TM KVERM 97 FF03578902
IMPORT var1 FROM
DATABASE indx(st) ID
‘12345’.

30 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Using the Database to Pass Data between Job Steps (Contd.)

Step Background
Background Job
#1 Job
DATA: var1(9) TYPE p
DECIMALS 2.
...
EXPORT var1 TO DATABASE
indx(st) ID ‘12345’
INDX

MANDT RELID SRTFD .. CLUSTR CLUSTD

800 SP SPH_I 254 FF05010102


Step #2
800 ST 12345 53 FF05016876 DATA: var1(9) TYPE p
800 ST ABCL 73 FF05075372 DECIMALS 2.
...
800 TM KVERM 97 FF03578902
IMPORT var1 FROM
DATABASE indx(st) ID
‘12345’.

31 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Structure of the Data Cluster Table

Key fields to Cluster


uniquely identify Length
Data Cluster
Cluster
Area
INDX Data

Client MANDT RELID SRTFD SRTF2 ... CLUSTR CLUSTD

800 SP SPH_I 0 254 FF0501010254787


800 ST 12345 0 53 FF0501687618710
800 ST ABCL 0 73 FF0507110005472
800 TM KVERM 0 97 FF0357890541472

Fields to store information pertaining to


cluster data, not automatically updated by
export, need to be explicitly set before the
export statement

32 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Structure of the Data Cluster Table (Contd.)

Key fields to Cluster


uniquely identify Length
Data Cluster
Cluster
Area
INDX Data

Client MANDT RELID SRTFD SRTF2 ... CLUSTR CLUSTD

800 SP SPH_I 0 254 FF0501010254787


800 ST 12345 0 53 FF0501687618710
800 ST ABCL 0 73 FF0507110005472
800 TM KVERM 0 97 FF0357890541472

Fields to store information pertaining to


cluster data, not automatically updated by
export, need to be explicitly set before the
export statement

33 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Demonstration

 Creation, scheduling and analyzing a background job using transactions SM36


and SM37.

34 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Practice

 Creation, scheduling and analyzing a background job using transactions SM36


and SM37.

35 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Summary

Job
Job Job
Job Job
Job
Scheduling
Scheduling Processing
Processing Overview
Overview

Job Log
Step #1

Spool List
Step #2

Background

36 Data Interfaces | Dec-2008 © 2005 IBM Corporation


IBM Global Services

Questions

 What are the various types of work processes present in the R/3 system ?
 What are the main phases of background processing ?
 What are the main function modules used to create background job through
ABAP program ?

37 Data Interfaces | Dec-2008 © 2005 IBM Corporation

You might also like