chapter 01_background processing
DESCRIPTION
Chapter 01_Background ProcessingTRANSCRIPT
IBM Global Business Services
© IBM Corporation 2013Data Interfaces | Dec-2008
Background Processing
IBM Global Business Services
© IBM Corporation 20132 Dec-2008Data Interfaces |
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.
IBM Global Business Services
© IBM Corporation 20133 Dec-2008Data Interfaces |
Background Processing
Phases of Background Processing.
Passing Data to Subsequent Job Steps.
Scheduling Job within ABAP Program.
IBM Global Business Services
© IBM Corporation 20134 Dec-2008Data Interfaces |
Work Processes
Dispatcher
Background
EnqueueUpdate SpoolDialog
Transaction
SM50
IBM Global Business Services
© IBM Corporation 20135 Dec-2008Data Interfaces |
The Background Work Process
Background
Defining a background job (SM36)
Background Job ABackground Job ABackground Job ABackground Job A
Step #1
Step #2
IBM Global Business Services
© IBM Corporation 20136 Dec-2008Data Interfaces |
Phases of Background Processing
Job
Processing
Job
Processing
Job
Scheduling
Job
Scheduling
JobJobOverviewOverview
JobJobOverviewOverview
IBM Global Business Services
© IBM Corporation 20137 Dec-2008Data Interfaces |
Scheduling a Background Job
JobScheduling
JobScheduling
TransactionSM36
IBM Global Business Services
© IBM Corporation 20138 Dec-2008Data Interfaces |
Creating Step for Background Job
JobScheduling
JobScheduling
Steps
ABAP External program
IBM Global Business Services
© IBM Corporation 20139 Dec-2008Data Interfaces |
Start Criteria for Background Job
Jobs can be scheduled to run immediately or at a
particular date/time.
Jobs can be scheduled to run after another job has been
completed.
Jobs can be scheduled to run after an event has been “triggered/raised”.
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.
JobScheduling
JobScheduling
Immediate After EventAfter JobDate/Time
Start Condition
IBM Global Business Services
© IBM Corporation 201310 Dec-2008Data Interfaces |
Scheduling a Periodic JobJob
SchedulingJob
Scheduling
With the ‘Period Values’ pushbutton, you can schedule
the job to run hourly, daily, weekly, monthly, etc.
By checking the ‘Periodic Job’ option,
you can specify that the job run at regular intervals.
Periodic jobX
Start date
Period values
IBM Global Business Services
© IBM Corporation 201311 Dec-2008Data Interfaces |
Scheduling Job After Another Job
If you check the ‘Start status-depend.’ option, this job will run only if the specified job ends successfully.
After Job
Start status-depend.X
After clicking on the ‘After Job’ pushbutton, you must specify the
name of the job that must be completed before this
job will run.
Start date
JobScheduling
JobScheduling
IBM Global Business Services
© IBM Corporation 201312 Dec-2008Data Interfaces |
Scheduling Job After an Event
JobScheduling
JobSchedulingAfter EventStart date
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.
IBM Global Business Services
© IBM Corporation 201313 Dec-2008Data Interfaces |
Triggering/Raising Events
CALL FUNCTION ‘BP_EVENT_RAISE’EXPORTING
EVENTID = <event name>EVENTPARM = ‘ ’TARGET_INSTANCE = ‘ ’
EXCEPTIONSBAD_EVENTID = 1EVENTID_DOES_NOT_EXIST = 2EVENTID_MISSING = 3RAISE_FAILED = 4OTHERS = 5.
The only required exporting parameter is the name of the event to raise.
To trigger/raise an event from within an ABAP program, you must call the ‘BP_EVENT_RAISE’ function module.
IBM Global Business Services
© IBM Corporation 201314 Dec-2008Data Interfaces |
Phases of Background Processing
JobScheduling
JobScheduling
JobProcessing
JobProcessing
JobOverview
JobOverview
IBM Global Business Services
© IBM Corporation 201315 Dec-2008Data Interfaces |
Processing a Background Job
Background
Dispatcher
JobProcessing
JobProcessing
JobJobJobJobScheduler
JobJobJobJob
IBM Global Business Services
© IBM Corporation 201316 Dec-2008Data Interfaces |
Processing a Background Job
TransactionTransactionSM50SM50
JobProcessing
JobProcessing
Application Server Work Processes
Application Server Work Processes
1 Spool8 Online 3 Background
IBM Global Business Services
© IBM Corporation 201317 Dec-2008Data Interfaces |
Processing a Background Job
Scheduler
Start Module
Job Step #1Job Step #1Job Step #2Job Step #2Job Step #3Job Step #3
Job LogJob Log
Entries from start and end Entries from start and end modules.modules.
All messages issued by job All messages issued by job steps and system.steps and system.
JobProcessing
JobProcessing
ListAll “WRITE”
statement output from job step.
PRINT SPOOLPRINT SPOOL
End Module
IBM Global Business Services
© IBM Corporation 201318 Dec-2008Data Interfaces |
Phases of Background Processing
JobScheduling
JobScheduling
JobProcessing
JobProcessing
JobOverview
JobOverview
IBM Global Business Services
© IBM Corporation 201319 Dec-2008Data Interfaces |
TransactionSM37
JobOverview
JobOverview
Job Status
Job Overview
Spool List
IBM Global Business Services
© IBM Corporation 201320 Dec-2008Data Interfaces |
Job Analysis Using Job Log
JobOverview
JobOverview
System and Program Messages
You can use this Job Log to analyze each step of a “finished” or “cancelled” background job.
IBM Global Business Services
© IBM Corporation 201321 Dec-2008Data Interfaces |
Job Analysis Using Job Spool
Display Report
IBM Global Business Services
© IBM Corporation 201322 Dec-2008Data Interfaces |
Other Background Processing Topics
Scheduling Job within ABAP Program
Passing Data to Subsequent Job Steps
IBM Global Business Services
© IBM Corporation 201323 Dec-2008Data Interfaces |
Scheduling Job within ABAP Program
Open Background JobOpen Background Job
JOB_OPENJOB_OPEN
Insert Job StepInsert Job Step
JOB_SUBMITJOB_SUBMIT
Close Background JobClose Background Job
JOB_CLOSEJOB_CLOSE
JOB_SUBMIT is called for each
step that is to be added to the job
IBM Global Business Services
© IBM Corporation 201324 Dec-2008Data Interfaces |
JOB_OPEN
JOB_OPENJOB_OPEN Background JobBackground Job
Exporting:jobname = <job name>
Importing:jobcount = <job #>
<job name><job name>
<job #><job #>
IBM Global Business Services
© IBM Corporation 201325 Dec-2008Data Interfaces |
JOB_SUBMIT
JOB_SUBMITJOB_SUBMIT
Background Job`Background Job`Exporting:
authcknam = <user>jobcount = <job #>jobname = <job name>report = <report>variant = <variant>
<job name><job name>
<job #><job #>
Step #1
Step #2
Exporting:authcknam = <user>jobcount = <job #>jobname = <job name>report = <report>variant = <variant>
IBM Global Business Services
© IBM Corporation 201326 Dec-2008Data Interfaces |
JOB_CLOSE
JOB_CLOSEJOB_CLOSE Background JobBackground Job
Exporting:jobcount = <job #>jobname = <job name>sdlstrtdt = <start date>sdlstrttm = <start time>strtimmed = <flag1>
Importing:job_was_released = <flag2>
<job name><job name>
<job #><job #>
Step #1
Step #2
IBM Global Business Services
© IBM Corporation 201327 Dec-2008Data Interfaces |
ABAP Program Example
REPORT YDI00001.DATA: JOBNUM TYPE JOBCOUNT.PARAMETERS: JOBNAME TYPE JOBNAME,
PROGRAM TYPE REPID,VARIANT TYPE VARIANT,USER TYPE UNAME.
CALL FUNCTION ‘JOB_OPEN’EXPORTING JOBNAME = JOBNAMEIMPORTING JOBCOUNT = JOBNUM.
CALL FUNCTION ‘JOB_SUBMIT’EXPORTING AUTHCKNAM = USER
JOBCOUNT = JOBNUMJOBNAME = JOBNAMEREPORT = PROGRAMVARIANT = VARIANT.
CALL FUNCTION ‘JOB_CLOSE’EXPORTING JOBCOUNT = JOBNUM
JOBNAME = JOBNAME.
Open JobOpen JobOpen JobOpen Job
Submit StepSubmit StepSubmit StepSubmit Step
Close JobClose JobClose JobClose Job
SY-SUBRC
CHECK
IBM Global Business Services
© IBM Corporation 201328 Dec-2008Data Interfaces |
Passing Data to Subsequent Job Steps
Background JobBackground Job
Step #1. . .EXPORT <obj1 … objn>TO DATABASE <dbtable> ID <id1>.
EXPORT < obj1 … objn>TO DATASET <filename> ID <id2>.
Step #2. . .IMPORT < obj1 … objn> FROM DATABASE <dbtable>ID <id1>.
IMPORT < obj1 … objn> FROM DATASET <filename> ID <id2>.
DBTABLE
id1 data1…. ….
FILENAME… … id2 data2… …
IBM Global Business Services
© IBM Corporation 201329 Dec-2008Data Interfaces |
Passing Data to Subsequent Job Steps (Contd.)
Background JobBackground Job
Step #1. . .EXPORT <obj1 … objn>TO DATABASE <dbtable> ID <id1>.
EXPORT < obj1 … objn>TO DATASET <filename> ID <id2>.
Step #2. . .IMPORT < obj1 … objn> FROM DATABASE <dbtable>ID <id1>.
IMPORT < obj1 … objn> FROM DATASET <filename> ID <id2>.
DBTABLE
id1 data1…. ….
FILENAME… … id2 data2
… …
IBM Global Business Services
© IBM Corporation 201330 Dec-2008Data Interfaces |
Background JobBackground JobBackground JobBackground JobStep #1DATA: var1(9) TYPE p DECIMALS 2.. . .EXPORT var1 TO DATABASE indx(st) ID ‘12345’
Step #2DATA: var1(9) TYPE p DECIMALS 2.. . .IMPORT var1 FROM DATABASE indx(st) ID ‘12345’.
INDX
MANDT RELID SRTFD CLUSTR
800
800
800
800
SP
ST
ST
TM
.. CLUSTD
SPH_I
12345
ABCL
KVERM
254
53
73
97
FF05010102
FF05016876
FF05075372
FF03578902
Using the Database to Pass Data between Job Steps
IBM Global Business Services
© IBM Corporation 201331 Dec-2008Data Interfaces |
Background JobBackground JobBackground JobBackground JobStep #1DATA: var1(9) TYPE p DECIMALS 2.. . .EXPORT var1 TO DATABASE indx(st) ID ‘12345’
Step #2DATA: var1(9) TYPE p DECIMALS 2.. . .IMPORT var1 FROM DATABASE indx(st) ID ‘12345’.
INDX
MANDT RELID SRTFD CLUSTR
800
800
800
800
SP
ST
ST
TM
.. CLUSTD
SPH_I
12345
ABCL
KVERM
254
53
73
97
FF05010102
FF05016876
FF05075372
FF03578902
Using the Database to Pass Data between Job Steps (Contd.)
IBM Global Business Services
© IBM Corporation 201332 Dec-2008Data Interfaces |
INDX
MANDT RELID SRTFD CLUSTR
800800800800800
SP
STSTST
TM
... CLUSTD
SPH_I
1234512345
ABCL
KVERM
254 5353 73 97
FF0501010254787
FF0501687618710FF0501687618710
FF0507110005472
FF0357890541472
Structure of the Data Cluster Table
SRTF2
00000
Client
Area
Key fields to uniquely identify
Data Cluster
Cluster Length
Cluster Data
Fields to store information pertaining to cluster data, not automatically updated by export, need to be explicitly set before the
export statement
IBM Global Business Services
© IBM Corporation 201333 Dec-2008Data Interfaces |
Structure of the Data Cluster Table (Contd.)
INDX
MANDT RELID SRTFD CLUSTR
800800800800800
SP
STSTST
TM
... CLUSTD
SPH_I
1234512345
ABCL
KVERM
254 5353 73 97
FF0501010254787
FF0501687618710FF0501687618710
FF0507110005472
FF0357890541472
SRTF2
00000
Client
Area
Key fields to uniquely identify
Data Cluster
Cluster Length
Cluster Data
Fields to store information pertaining to cluster data, not automatically updated by export, need to be explicitly set before the
export statement
IBM Global Business Services
© IBM Corporation 201334 Dec-2008Data Interfaces |
Demonstration
Creation, scheduling and analyzing a background job using transactions SM36 and SM37.
IBM Global Business Services
© IBM Corporation 201335 Dec-2008Data Interfaces |
Practice
Creation, scheduling and analyzing a background job using transactions SM36 and SM37.
IBM Global Business Services
© IBM Corporation 201336 Dec-2008Data Interfaces |
Step #1
Step #2
Background
Job Log
Spool List
JobScheduling
JobScheduling
JobProcessing
JobProcessing
JobOverview
JobOverview
Summary
IBM Global Business Services
© IBM Corporation 201337 Dec-2008Data Interfaces |
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 ?