Вы находитесь на странице: 1из 22

0

Background Processing

Contents:

 Scheduling jobs
 Using the job overview
 Using parallel BI processing through RSBDCSUB

 SAP AG 1999

© SAP AG BC420 14-1


0.2
Course Overview Diagram

Call Transaction
Batch Input

Direct Input

TA Recorder
7 12 IDoc BAPI
9
10
11 12
Principles of Standard 4
Data Tansfer

DX Workbench 11
3 5
LSM Workbench
8 10 11

13
6 Basics

2 Datenübernahme 14
14

1 Course Overview

 SAP AG 1999

© SAP AG BC420 14-2


0.3
Background Processing - Contents (1)

Basicsof
Basics ofBackground
BackgroundProcessing
Processing

Performanceand
Performance andScheduling
Scheduling BI
BISessions
Sessions

 SAP AG 1999

© SAP AG BC420 14-3


0.4
Concept of Background Processing

Step 1 Program 1
Step 2 Program 2
Job ...
Step n Program 3

Scheduled
(Time / Date)

... B B
Executed on
Dispatcher
background server

 SAP AG 1999

 R/3 background processing is used to automate routine tasks and optimize the use of the R/3
resources within a company. You or your users schedule programs to be run by the R/3 System and
specify which programs to execute and when.

 The R/3 System provides comprehensive support for background processing including a number of
methods for scheduling and maintaining jobs. You can execute both internal R/3 and external
programs. To simplify scheduling, you can execute related internal and external jobs as “job steps”
within one background processing job. Using job steps, you can define a complex background job
that includes several processing steps. Job scheduling includes all process activities required to
execute the task.

 In addition, there are various job administration and diagnostic tools, including a graphical monitor.
There is a powerful, easy-to-use programming interface you can use to program your own
applications for background processing, if needed; you can use the job wizard to schedule your jobs.
The wizard automates the basic definition of the background processing job and guides new users
through the entire process.

© SAP AG BC420 14-4


0.5
Background Processing Steps

Create program variant

Define job name and priority

Create step list (enter programs) Step 1


Step 2

Define job start time Step 1


Step 2

Job runs

Display job logs Step 1


Step 2

 SAP AG 1999

 To create a background processing job, proceed as follows:


1) If the program to be scheduled contains a selection screen, create a variant.
2) In the job definition, you must specify the job name and priority.
Optional: Target server
3) The step list contains all programs to be sequentially processed within a job.
4) You must set the start time for the job.
5) When the start time is reached, the job is processed in a free background work process.
6) You can then display the job logs.

© SAP AG BC420 14-5


0.6
Creating a Job (1)

Job Definition Transaction (SM36)


1 Define job name and class

Start conditions Steps

Job name BC420_JOB


Job class C
Job: BC420_JOB
Status geplant Step list is empty.

Target server

2 Choose Steps to create the subtasks for the job.

...
 SAP AG 1999

 In the job definition, you specify a job name and job class ( A = highest, to C = lowest priority ).
 To ensure automatic workload balancing, leave the Target server field empty. The system then
executes the job on a server with free background work processes.
 Under Steps you define the individual job steps (individual programs within the job).
 Under Start conditions, you specify the start date and time.

© SAP AG BC420 14-6


0.7
Creating a Job (2)

3 Each step should consist of one ABAP program

ABAP Program External Command External Program

ABAP Program

Name BI_PROGNAME
Variant
Language DE Step 1
Job: BC420_JOB

If the ABAP program A step has been added to


contains a selection the step list. However, the
Save
screen, you must first job has not been saved. Do
create a variant. not exit the transaction.

 SAP AG 1999

 A step can be an internal ABAP program. If the program contains a selection screen, you must create
a variant, which is a saved set of selection screen values for this program.

© SAP AG BC420 14-7


0.8
Creating a Job (3)

4 After you create and save the steps, the step list appears.

No. Program name ... Ext. prg List Parameters


1 BC420_JOB

To add additional steps, choose Create; to leave the step list, choose Back
( -> Initial screen).

5 To schedule the job start date and time, go to Start condition.

Start condition Steps


Step 1
Job: BC420_JOB

 SAP AG 1999 ...

 After you save the steps, the step list appears. To add additional steps, choose Create.
 After you define and Save the step list and go Back to the initial screen, you can specify the start date
and time for the job.

© SAP AG BC420 14-8


0.9
Creating a Job (4)

6 You have several options for job start date and time.

Immed. Date / Time After job After event ...

Date / Time
Scheduled start Date 27.08.1999 Time 23:06

Do not start after Date Time

Save
Job is now scheduled. Important: Choose Save
on the initial screen of transaction SM36.
Step 1
Job: BC420_JOB
 SAP AG 1999

 One scheduling method is to specify a date and time.


 Not only can you specify a start date and time, you can also specify an “expiration date”.
If the job has not been processed by this date and time (because there is no free background work
process), it will never be processed. The job status is then set to Canceled.
 You can also specify a Periodic start time.

© SAP AG BC420 14-9


0.10
JobOverview(1)

Joboverviewtrans
a ction(SM37)
Jobname BC420*
Username *

Jobstatus
Sched. Rele
a sed Ready Active Finished Canceled

Jobsta
rtconditions
From 27.08.1999 to 27.08.1999

2
3 :24 23:56

orstartafterevent *

Step1
Job:BC420_JOB

SA
PAG1999

 You can use the job overview to select and display jobs according to specific criteria.
 For example, you could choose to display all jobs that have status Ready, but that have not yet
started..
 If you want to display scheduled jobs that depend on an event, you must enter at least “*” in the
Start after event field.

© SAP AG BC420 14-10


0.11
Job Overview (2)

After specifying the selection parameters, the selected jobs appear.

... Released Spool Job Log Step

Job overview for: 27.08.1999 ...

Job name Created by Status Start date Start time Duration[sec]...


BC420_JOB MILLER Finished 27.08.1999 5:34:23 12
BC420_JOB1 WONG Finished 27.08.1999 6:23:00 1
BC420_JOB3 KELLER Finished 27.08.1999 6:23:34 3
BC420_0815 MEYERS Scheduled
....

Scheduled: Job is
Job finished defined but no
start time has been
specified.

 SAP AG 1999

 From the job overview, you can go to the Spool transaction to display the list output of the individual
job steps.
 To view the job logs, choose Job log.
 Job status:
 Scheduled: Job is defined but no start time has been specified.
 Released: Start time has been specified
 Ready: Execution time has been reached, job ready for execution
 Active: Job running, see transaction SM50
 Finished: Job completed without errors
 Canceled: Job ended; Errors occurred.

© SAP AG BC420 14-11


0.12
Background Processing - Contents (2)

Basicsof
Basics ofBackground
BackgroundProcessing
Processing

Performanceand
Performance andScheduling
Scheduling BI
BISessions
Sessions

 SAP AG 1999

© SAP AG BC420 14-12


0.13
Parallel Processing with RSBDCSUB

Sequential
File

Generate several sessions


BI Program

Schedule RSBDCSUB

... B B ... B B ... B

Dispatcher Dispatcher Dispatcher

Process BI sessions in several background WPs in parallel.


 SAP AG 1999

 You can process BI sessions in parallel in the background using the program RSBDCSUB. If several
BI sessions were generated from the external data, RSBDCSUB schedules a separate job for each BI
session.
 On the selection screen of RSBDCSUB, you specify the names of the BI sessions you want to
process (generic entry possible: "bc420*").

© SAP AG BC420 14-13


0.14
Batch Input Scheduling with RSBDCSUB

ABAP
ABAP Development
Development

Program RSBDCSUB
Execute 1) Test RSBDCSUB to
understand
its functions.

Session name
Created on
from____ to
Session status 2) Create variant of
To be processed Variant
With errors RSBDCSUB.
Edit x

Save
Save 3) Create job with two
steps to schedule
the BI program and
Create
Create background
background job
job
with RSBDCSUB.
with STEP:
STEP: RSBDCSUB
RSBDCSUB

 SAP AG 1999

Using program RSBDCSUB, you can schedule session processing in the background.
Proceed as follows:
1) Test RSBDCSUB to learn about the input parameters on the selection screen and the program’s
functions.
2) Create a variant of RSBDCSUB using the following selection criteria:
- Session name (generic entries also possible, such as "bc420*")
- Created on
- Session status
- It’s a good idea to leave the Target server field empty (for automatic load balancing).
- Extended log

3) Create a background job for program RSBDCSUB using the variant you created.

© SAP AG BC420 14-14


0.15
Jobs

Job with two steps

In the first step, the sequential data is


read and then BI sessions are
generated from this data.

Step 1: BI Program
In the second step, the BI sessions are
scheduled by the RSBDCSUB to run
Step 2: RSBDCSUB in parallel and then processed by
the background work processes.

 SAP AG 1999

 The external data conversion and import of the data into the R/3 System can be automatically
scheduled through background processing.
 This requires two program steps:
1) In Step 1, the BI program is called that reads the external data and converts the data. BI sessions
are then created.
2) In steps 2, RSBDCSUB is called and transfers the generated BI sessions to background
processing.

© SAP AG BC420 14-15


0.16
RSBDCSUB Jobs

The job log contains the results of the


... Job Log BI runs.

Job name Created by Status Start date Start time Duration[sec]...


BC420_MAP1 MEYERS Finished 27.08.1999 6:22:19 41
BC420_MAP2 MEYERS Finished 27.08.1999 6:23:00 34
BC420_MAP3 MEYERS Finished 27.08.1999 6:23:34 22
BC420_MAP4 MEYERS Finished 27.08.1999 6:23:56 23

RSBDCSUB creates a job for each BI session with the job name identical to
the BI session name.

 SAP AG 1999

 The job overview contains the results of the individual job runs (one job per session).
 The results of the session processing can also be viewed in the BI monitor.

© SAP AG BC420 14-16


0.17
FrontendAccessinBackground

Presentation

Local sequential
files

Application
TRANSFER
... B READ DATASET
Dispatcher

Sequential
files
Database

SAPAG1999

 The "DOWNLOAD" and "UPLOAD" function modules are designed for online operation and
cannot be executed in the background.

© SAP AG BC420 14-17


0.18
Background Processing: Unit Summary

You are now able to:


 Schedule and administer jobs
 Use RSBDCSUB to schedule batch input sessions
in the background

 SAP AG 1999

© SAP AG BC420 14-18


Exercises

Unit: Background Processing


Topic: Scheduling of Batch Input in the Background

 Scheduling of batch input sessions in the background.


 Parallel processing of the processing

The transfer of the legacy data should be automated. This is done by


scheduling a specific ABAP program (RSBDCSUB) via the R/3
background processing. There are different possibilities for performing
the scheduling.

Job: BC420_##_Job

1 Optional: Start a job consisting of one step using Date/Time.


1-1 Define a variant for the program SAPBC420_SPTD_LIST_CHECKBOXES.
1-2 Create the job BC420JOB##-1. Start this job using Date/Time. You can enter
"Start now" or the system time + 3 minutes. The only step the job should
contain is the ABAP report.
1-3 Follow the flow of the job in the SM37 and analyze the job log.

© SAP AG BC420 14-19


2 Define and schedule a job to generate and run batch input sessions. Define one job
“BC420_##_Job” that performs the follwing tasks in two steps:
a) Run a program to generate one or more batch input sessions. Before you start,
generate a variant for the scheduled batch input program.
b) Call the RSBDCSUB to schedule the batch input session that has been created in the
previous step. You must also first create a variant for RSBDCSUB.

Steps:
2-1 Create the variant VAR_## for the program RFBIBL00. Maintain the
- File name = ...... (File name see outbound file respectively converted data in
the LSMW object CT-##).
- Type of data transfer is batch input

2-2 Create a variant for the RSBDCSUB. This variant should process the batch
input sessions CT-##. (This session name is from the LSMW outbound file and
corresponds to the object name).
2-3 Schedule a job consisting of two steps: The first step contains your batch input
program RFBIBL00, the second step contains RSBDCSUB. The variants you
defined before are necessary for both steps.
2-4 In order to run BI sessions, follow the flow of the job and check the job log for
each job that has been created by the RSBDCSUB.

3 Optional: Generating several BI sessions by changing an LSMW setting and


scheduling the LSMW main program.
3-1 Display all objects for your project. Select the object CT-## and copy it to the
new object BI-##.
3-2 Make the following changes in the END_OF_RECORD of structure BGR00.
The field g_cnt_transactions_group determines the number of
records according to which the next BI session is generated. Change this value
to 2.
at_first_transfer_record.
if g_cnt_transactions_group = 2.
g_cnt_transactions_group = 0.
transfer_record.
endif.

3-3 In the object attributes set the data transfer to periodic.


Then you get the main program /SAPDMC/SAP_LSMW_INTERFACE, which
will perform the steps of the LSMW automatically.

© SAP AG BC420 14-20


3-4 Create the variant Var-## for this main program.
Settings:
Project: BC420-##
Sub-project: DOCU-##
Object: BI-##
Set the parameters of some batch input/direct input programs
“BI, DI, Call Transaction” to “B”.
3-5 Schedule a job that consists of one step and that contains the main program with
the variant VAR-##. Start the job.
3-6 Follow the the job flow and check the job log.

© SAP AG BC420 14-21


Solutions

Chapter: Background processing


Solution to 3.2

3 Optional: Create several BI sessions by changing an LSMW setting and scheduling the
LSMW main program.

3-2 Go to Extras -> Display variant and set the "Technical field" and "Processing
events" checkboxes to change a technical LSMW field mapping setting.
"Coding" and "Global data definitions" should also be selected.

The processing event "END OF RECORD" is below the structure BGR00 and
determines how many transactions a new BI session processes with a counter.

Change the test "if g_cnt_transactions_group = 5000" to "if


g_cnt_transactions_group = 3" to create a new BI session after
reading three records.

© SAP AG BC420 14-22

Вам также может понравиться