You are on page 1of 28

IBM Global Services

Background Processing
Phases of Background Processing Passing Data to Subsequent Job Steps Scheduling Job within ABAP Program

Slide 1

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Work Processes

Dispatcher

Dialog

Update

Enqueue

Spool

Background

Slide 2

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

The Background Work Process

Background Job A Step #1 Step #2


Defining a background job.
Slide 3 Data Interfaces | 2.01 | August 2003

Background

Copyright IBM Corporation 2003

IBM Global Services

Phases of Background Processing

Job Scheduling

Job Processing

Job Overview

Slide 4

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Scheduling a Background Job

Transaction SM36

Job Scheduling

Start date
General data Job name Job class Status Target host

Steps

<job name>

A
Scheduled <target system for processing>

Slide 5

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Creating Step for Background Job

Steps

Job Scheduling

ABAP

External program

ABAP program Name Variant Language


Slide 6

<name of report program> <name of variant> E


Copyright IBM Corporation 2003

Data Interfaces | 2.01 | August 2003

IBM Global Services

Start Criteria for Background Job


Job Scheduling

Start date

Immediate

Date/Time

After Job

After Event
Jobs can be scheduled to run after an event has been triggered/raised.

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.

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.
Slide 7 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

Scheduling a Periodic Job


Job Scheduling

Start date

Period values

Periodic job

Hourly
Daily

By checking the Periodic Job option, you can specify that the job run at regular intervals.

Weekly

With the Period Values pushbutton, you can schedule the job to run hourly, daily, weekly, monthly, etc.

Monthly
Other period
Copyright IBM Corporation 2003

Slide 8

Data Interfaces | 2.01 | August 2003

IBM Global Services

Scheduling Job After Another Job


Job Scheduling

Start date

After Job

Name <job name>

X Start status-depend.

After clicking on the After Job pushbutton, you must specify the name of the job that must be completed before this job will run.

If you check the Start status-depend. option, this job will run only if the specified job ends successfully.
Slide 9 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

Scheduling Job After an Event


Job Scheduling

Start date

After Event

Event Parameter

<event name> <parameter>

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.

X Periodic job
Slide 10 Data Interfaces | 2.01 | August 2003

If you check the Periodic Job option, the system starts a new job each time the specified event is raised.
Copyright IBM Corporation 2003

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 The only required EVENTID_DOES_NOT_EXIST = 2 exporting parameter is the EVENTID_MISSING =3 name of the event to raise. RAISE_FAILED =4 OTHERS = 5.

Slide 11

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Phases of Background Processing

Job Scheduling

Job Processing

Job Overview

Slide 12

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Processing a Background Job

Scheduler

Job

Dispatcher

Background Job Processing

Job

Slide 13

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Processing a Background Job


Application Server Work Processes
8 Online 1 Spool 3 Background

Job Processing Transaction SM50

Slide 14

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Processing a Background Job

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

Start Module Job Step #1 Job Step #2 Job Step #3 End Module
Slide 15 Data Interfaces | 2.01 | August 2003

PRINT SPOOL
Job Processing

List
All WRITE statement output from job step.

Copyright IBM Corporation 2003

IBM Global Services

Phases of Background Processing

Job Scheduling

Job Processing

Job Overview

Slide 16

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Job Overview
Transaction SM37

Job Status

Job Overview

Slide 17

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Job Analysis Using Job Log

System and Program Messages

Job Overview

You can use this Job Log to analyze each step of a finished or cancelled background job.
Slide 18 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

Other Background Processing Topics

Passing Data to Subsequent Job Steps


Scheduling Job within ABAP Program

Slide 19

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Scheduling Job within ABAP Program


Open Background Job JOB_OPEN JOB_SUBMIT is called for each step that is to be added to the job.

Insert Job Step JOB_SUBMIT

Close Background Job JOB_CLOSE


Slide 20 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

JOB_OPEN

JOB_OPEN Exporting: jobname = <job name>

Background Job <job name> <job #>

Importing: jobcount = <job #>

Slide 21

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

JOB_SUBMIT
JOB_SUBMIT Exporting: authcknam = <user> jobcount = <job #> jobname = <job name> report = <report> variant = <variant> Exporting: authcknam = <user> jobcount = <job #> jobname = <job name> report = <report> variant = <variant>
Slide 22 Data Interfaces | 2.01 | August 2003

Background Job

<job name>
<job #> Step #1

Step #2

Copyright IBM Corporation 2003

IBM Global Services

JOB_CLOSE

JOB_CLOSE Exporting: jobcount = <job #> jobname = <job name> sdlstrtdt = <start date> sdlstrttm = <start time> strtimmed = <flag1> Importing: job_was_released = <flag2>

Background Job <job name> <job #> Step #1

Step #2

Slide 23

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

ABAP Program Example

Open Job Submit Step

Close Job

REPORT Y180DM01. DATA: JOBNUM LIKE TBTCJOB-JOBCOUNT. PARAMETERS: JOBNAME LIKE TBTCJOB-JOBNAME, PROGRAM LIKE SY-REPID, VARIANT LIKE RALDB-VARIANT, USER LIKE SY-UNAME. CALL FUNCTION JOB_OPEN EXPORTING JOBNAME = JOBNAME IMPORTING JOBCOUNT = JOBNUM. CALL FUNCTION JOB_SUBMIT EXPORTING AUTHCKNAM = USER CHECK JOBCOUNT = JOBNUM SY-SUBRC JOBNAME = JOBNAME REPORT = PROGRAM VARIANT = VARIANT. CALL FUNCTION JOB_CLOSE EXPORTING JOBCOUNT = JOBNUM JOBNAME = JOBNAME.

Slide 24

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

IBM Global Services

Passing Data to Subsequent Job Steps


Step #1
...

Background Job

DBTABLE

EXPORT <data1>TO DATABASE <dbtable> ID <id1>.


...

id1

data1

EXPORT <data2>TO DATASET <filename> ID <id2>.


...

FILENAME id2 data2

Step #2
...

IMPORT <data1> FROM DATABASE <dbtable>ID <id1>.


...

IMPORT <data2> FROM DATASET <filename> ID <id2>.


Slide 25 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

Using the Database to Pass Data between Job Steps


Background Job
Step #1
TABLES: INDX. DATA: var1(9) TYPE p DECIMALS 2.

INDX
MANDT RELID SRTFD

...

...

CLUSTR

CLUSTD FF05010102 FF05016876 FF05075372 FF03578902

EXPORT var1 TO DATABASE indx(st) ID 12345

800 800 800 800

SP ST ST TM

SPH_I 12345 ABCL


KVERM

254 53 73 97

Step #2
TABLES: INDX. DATA: var1(9) TYPE p DECIMALS 2.
...

IMPORT var1 FROM DATABASE indx(st) ID 12345.


Slide 26 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

Structure of the Data Cluster Table

Area Client

Key Fields to Uniquely Identify the Data Cluster

INDX
SRTF2

Cluster Length
CLUSTR CLUSTD

Cluster Data

MANDT RELID SRTFD

...

800 800 800 800

SP ST ST TM

SPH_I 12345 ABCL KVERM

0 0 0 0

254 53 73 97

FF0501010254787 FF0501687618710 FF0507110005472 FF0357890541472

Fields to store information pertaining to cluster data, not automatically updated by export, need to be explicitly set before the export statement
Slide 27 Data Interfaces | 2.01 | August 2003
Copyright IBM Corporation 2003

IBM Global Services

Summary of Background Processing

Job Scheduling

Job Processing

Job Overview
Job Log

Step #1 Step #2 Spool List

Background

Slide 28

Data Interfaces | 2.01 | August 2003

Copyright IBM Corporation 2003

You might also like