You are on page 1of 20

Job control and Parallel processing

Thomas Bollmeier
IBU Financial Services, NAD, Tools & Technology

Job control : Requirements




Control of the start of processes depending on the technical and business processing status of other processes
 Example : Mass processing of account extract only after successful processing of account balancing.

Synchronisations of parallel sub processes


 That is follow up processes should start only after end of all parallel sub processes

=> Use of a job control

SAP AG 2001, Title of Presentation, Speaker Name 2

Job control : Performance features


Processes are specialisations of an abstract process class
Advantage : can be expanded easily Implemented process classes:

Report processes (Attributes: Report name, Variant, Mass run-ID); use in the daily end processing Processes in the parallel processing

Definition of flow plans in the Customizing


Predecessor-Successor Relationships between Report processes

Flexible generation of flows through customer reports


BAPI JobControlFS.createNetwork

Start of Reportprocesses through external Job control possible


BAPI JobControlFS.startProcess

Possibility of the status query through BAPI JobControlFS.getDetail planned

SAP AG 2001, Title of Presentation, Speaker Name 3

Job control : Design


Assigned DB-Tables: Process flow pattern :
 TBANK_RFL_TEMPL  TBANK_RFL_TREP  TBANK_RFL_TREL

Process flow:
 BANK_PROCFL_FLOW  BANK_PROCFL_REL

Process:
 BANK_PROCFL_PROC  BANK_PROCFL_LOG

Report process:
 BANK_REPORTS  BANK_REP_PARAMS

SAP AG 2001, Title of Presentation, Speaker Name 4

Jobsteuerung: Prozessablauf I
BANK_API_PROCFL_START

BANK_OBJ_PROCFL_GET_PROC(procid) Following checks are done : 1.) Check for restart . If the start counter is (START_COUNT) > 0 , then the code XREST_ALLOWED must be set for the process. 2.) Check whether external start is expected. (code.: XSTART_EXTERN). 3.) Status check. The status must have the value 'not yet started' . BANK_OBJ_PROCFL_LOCK_PROC

Start Checks

[Start check negative]

[Lock can not be set ]

BANK_OBJ_PROCFL_WAIT_FOR_PRED

[at least one predecessor aborted] BANK_OBJ_PROCFL_REL_PROC

BANK_OBJ_PROCFL_GET_MODE

[else] [asynchronous processing]

BANK_OBJ_PROCFL_START_ASYNC

BANK_OBJ_PROCFL_START_SYNC

SAP AG 2001, Title of Presentation, Speaker Name 5

Jobsteuerung: Prozessablauf II
:cl_procflow BANK_OBJ_PROCFL_START_ASYNC BANK_OBJ_PROCFL_GET_JOBDATA :R/3-Job control

JOB_OPEN( startjob ) endjob is planned as successor of startjob . It runs even during aborting of startjob and ensures such a defined process end even in case of aborting.

JOB_OPEN( end job )

SUBMIT end report

The Report RBANK_PROC_START is called. As Parameter P_ID the ID of the process to be started is transferred.

JOB_CLOSE( end job )

SUBMIT startreport

JOB_CLOSE( startjob ) Der Report RBANK_PROC_END starts the flow at the process end Its Parameter P_ID during calling is supplied with the ID of the process to be closed. :cl_procflow BANK_OBJ_PROCFL_START_SYNC

startreport

end report

:cl_procflow BANK_OBJ_PROCFL_END

SAP AG 2001, Title of Presentation, Speaker Name 6

Jobsteuerung: Prozessablauf III


:cl_procflow BANK_OBJ_PROCFL_START_SYNC BANK_DB_PROCFL_SET_STATUS (aktiv) Reading of the method of the process class , which implements the method AT_START of the interface if_proc Process:Proce ss class :cl_ooman :DB-administration

BANK_API_OOMAN_GET_METHOD Method name BANK_OBJ_PROCFL_EXPORT_ID

Process::AT_START

COMMIT BANK_OBJ_PROCFL_REL_PROC

BANK_OBJ_PROCFL_GET_CHILDS

BANK_API_PROCFL_START * [for all child processes]

BANK_OBJ_PROCFL_GET_MODE

BANK_OBJ_PROCFL_END [in case synchronous mode]

SAP AG 2001, Title of Presentation, Speaker Name 7

Jobsteuerung: Prozessablauf IV
BANK_OBJ_PROCFL_END

BANK_DB_PROCFL_GET_STATUS

closed, aborted]

BANK_OBJ_PROCFL_LOCK_PRC

[Locking not

possible ]

Get the method, which implements the interface method AT_END_OF_PROCESS of the interface if_proc .

BANK_OBJ_PROCFL_WAIT_FOR_CHILDS

cl_ooman::BANK_API_OOMAN_GET_METHOD

<Prozeklasse>:AT_END_OF_PROCESS:

BANK_DB_PROCFL_SET_STATUS

DB::COMMIT_WORK

status = closed / aborted

BANK_OBJ_PROCFL_REL_PROC

BANK_OBJ_PROCFL_GET_FATHER

[else] [No father process available ]

BANK_OBJ_PROCFL_START_SUCC

SAP AG 2001, Title of Presentation, Speaker Name 8

Job control : Customizing


Definition of a flow pattern from Report processes in IMG
 Create and maintenance of variants per Report of the pattern  Dynamic Variables (e.g. Date values ) can be defined as selection variables (in the table TVARV)  Stipulation of predecessor- successorrelationships  If necessary definition of own reports for inclusion in Report-Flow pattern
 Stipulation

of the behaviour during restarting

SAP AG 2001, Title of Presentation, Speaker Name 9

Job control : Start and control of a flow


Start through
 BAPI JobControlFS.createNetwork bzw. JobControlFS.startProcess  Report RBANK_JC_START
BANK_JC_START  Planning as background job possible
 Transaction

Monitoring and control of the procedural flow through report RBANK_JC_OVERVIEW (Transaction: BANK_JC_OVRVW)
 Network plan diagram  Restarting  Stopping a flow (Emergency stop )

SAP AG 2001, Title of Presentation, Speaker Name 10

Parallel processing : Concept


Framework for Applications , which are to be parallelised Classification of the quantity of objects to be processed in to work packages Processing of the work packages in to parallel background jobs Generation and Synchronisation of the background jobs through Financial- Services-Job control

SAP AG 2001, Title of Presentation, Speaker Name 11

Parallel processing : Performance features


Number of parallel jobs + Distribution to Server(groups) adjustable in the customizing Standard-Package templates enable reusability of once prepared object classification by many randomly paralleised mass processings Definition of the packages as Interval or as discrete Object list BTE and BAPI for definition of packages through customer
 0BANK010  ParallelProcessingFS. PackAdmCreate

Start of the parallel processing through BAPI is supported Transactions for automatic generation of Callback-FuB and for checking the interface consistency
 BANK_PP_GEN und BANK_PP_CHECK
SAP AG 2001, Title of Presentation, Speaker Name 12

Parallel processing : Data model I


Job control parallel sub process Account closing (example) 1..* 1 General process 1..* + at_start + at_end_of_process generated 1 Application {abstract} Mass run Mass run-ID Application type current StartNo current realStartNo. 1 1..2 Start Data Mass run-ID Simulation code No. current step No. last step No. of repetitions No. maximal step Status Process {abstract} - Job-ID - Jobstatus

1 1..* Pack administrator PVerw-ID Kz. Standard Def.Type of packs 1 0..* work reserve

- work reserve-ID - number of objects in status <xx>

0..* 1 Pack templateobjects PVerw-ID PacktNr Object-ID

0..* Pack template 0..1 0..*

1 1..* Work package header work reserve-ID PackNo. Code.: requested number of open Obj. number of returned Obj. 1

- PVerw-ID - PackNo. - Interval limits

1..* work package work reserve-ID PacktNo Object-ID Status

SAP AG 2001, Title of Presentation, Speaker Name 13

Parallel processing : Data model II


Assigned DB-Tables
 Mass course (run)
 BKKMPARUNHD, BKKMPARUN,

BANK_PP_STEPDATA

 Package administrator
 BANK_PACKMAN_HD

 Package template (pattern)


 BANK_PACKMAN

 Package template objects


 BANK_PACKMAN_OBJ

 Work stock(reserve)
 BANK_WORKL_HD,

BANK_WORKL_CNT

 Work reserve header


 BANK_WORKL_PACK

 Work package (objects)


 BANK_WORKL_OBJ

SAP AG 2001, Title of Presentation, Speaker Name 14

Parallel processing : Flow I


BANK_MAP_PP _START

:Mass runAPI

:Mass runOBJ

:Application

BANK_OBJ_PP_PREPARE _START Method 0100: Start of a mass run BANK_API_WORKL_ CONSTRUCTOR

:work reserve -API BANK_API_PACKMAN _CONSTRUCTOR

[if I_PACKMANID_EXT initial]

:PVerw-API

Method 0205: generate package templates

Method 0120: Set Parameter Call in UPDATE TASK, if I_X_TRIGGER... = 'X' BANK_OBJ_PP_EXECUTE _STEP BANK_OBJ_PP_START_CONTAINER Method 0160:Checks prior to start of a mass run In process flow within a update(entry) work process (WP-Types 2 and 6) BANK_OBJ_PP_START_CON TAINER is called with the addition STARTING NEW TASK

SAP AG 2001, Title of Presentation, Speaker Name 15

Parallel processing : Flow II


Mass run ::BANK_OBJ_START_CONTAINER Application ::Method 0160

Mass run::BANK_OBJ_PP_JOB

Mass run::BANK_OBJ_PP_JOB

Mass run::BANK_OBJ_PP_JOB

Mass run ::BANK_OBJ_PP_DET_STAT_AT_EOSTEP

[Status Start next step , repeat current step]

Mass run::BANK_OBJ_PP_CONT_WITH_STEP

[Status closed, aborted, in asynchronous processing]

Mass run ::BANK_OBJ_PP_PREPARE_START

Application ::Method 0300

After Synchronisation with the help of Object status counter (Table BANK_WORKL_CNT) and the job status a mass run status is determined. If the percentage of the objects in the status 'reset' exceeds the threshold value stored in the Customizing (TBCAMPPAPPL) , the current step is repeated. If the maximal step number is not yet reached and the run status not 'aborted' or 'in asynchronous processing', the next step is started.

SAP AG 2001, Title of Presentation, Speaker Name 16

Parallel Processing: Flow III


:Mass runOBJ BANK_OBJ_PP_JOB Method 1400: Start of processing in a parallel Job :PVerw-API * [ till no unprocessed package is available ] BANK_API_WORKL_GET_PACKAGE BANK_API_PACKMAN_GET_LIMITS BANK_OBJ_PP_PACKAGE Method 1000: initialise package :work reserve :Application

Method 1100: select data First processing of package without preselection BANK_API_WORKL_GET_OBJECTS BANK_API_PACKMAN_GET_OBJECTS [1.Pack processing] Follow up processing of the package or first processing with preselection [Follow up processing] BANK_DB_WORKL_GET_PACKOBJ

Method 1200: select data for list

BANK_API_WORKL_CHANGE_STATUS Method 1270 Method 1260: check data

BANK_API_WORKL_CHANGE_STATUS Method 1270

Method 1300: process data End of the package processing loop BANK_API_WORKL_CHANGE_STATUS

Method 1410: End of the processing in a parallel Job

SAP AG 2001, Title of Presentation, Speaker Name 17

Parallel processing : Connecting an application


Maintenance of the System-Customizing (Transaction BANK_CUS_PP)
 Definition of a type of application  Implementation and assignment of the Callback-Functions

Calling the functional module BANK_MAP_PP_START or BANK_MAP_PP_RESTART (during restart )

SAP AG 2001, Title of Presentation, Speaker Name 18

Other Literature
 Design-Document on Job control in the InfoCenter
 Title

Job control  \\pwdf0626\infocenter\protected\2001\07\27\c42375be8f46ba44a509b675a7bd b151.doc

 Developer docu for parallel processing in the InfoCenter


Parallelisation 2.1  \\pwdf0626\infocenter\protected\2001\09\06\2694861e939edf4b8c12f8fa44c1ba a7.doc
 Titel

 H. Knallinger, D. E. Knuth, J. v. Neumann(), A. Turing() (Eds.): The Art of Parallel Processing, 347th. Ed., Berlin, Heidelberg, New York, 1999, ISBN: 0-123-4567-8

SAP AG 2001, Title of Presentation, Speaker Name 19

Copyright 2001 SAP AG. All rights reserved


 No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, WINDOWS, NT, EXCEL, Word, PowerPoint and SQL Server are registered trademarks of Microsoft Corporation. IBM, DB2, OS/2, DB2/6000, Parallel Sysplex, MVS/ESA, RS/6000, AIX, S/390, AS/400, OS/390, and OS/400 are registered trademarks of IBM Corporation. ORACLE is a registered trademark of ORACLE Corporation. INFORMIX-OnLine for SAP and INFORMIX Dynamic ServerTM are registered trademarks of Informix Software Incorporated. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. HTML, DHTML, XML, XHTML are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. JAVA is a registered trademark of Sun Microsystems, Inc. JAVASCRIPT is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. SAP, SAP Logo, R/2, RIVA, R/3, ABAP, SAP ArchiveLink, SAP Business Workflow, WebFlow, SAP EarlyWatch, BAPI, SAPPHIRE, Management Cockpit, mySAP.com Logo and mySAP.com are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other products mentioned are trademarks or registered trademarks of their respective companies.

         

SAP AG 2001, Title of Presentation, Speaker Name 20