REPORT ZIMRE000.
************************************************************************
* This program limits the number of parallel instances a particular
* heavy batch job (JOB_NAME) can have.
* The program has to be scheduled as the first step of a job, while the
* heavy batch job should be the second step. The first step (this
* program) checks the number of jobs already running, and if it is
* over the limit (MAX_NUM) it reschedules itself to run in X minutes
* (X selected by a radiobutton), and then aborts. A variant with
* the corresponding MAX_NUM, X and JOB_NAME has to be created before
* scheduling the job.
* To prevent a deadlock (too many batch job start at the same time, and
* they think that there are already many jobs running, and they are
* rescheduling themselves to run again X time later - causing the same
* situation again) X is varied by a random +/- 1 minute.
************************************************************************
TABLES: TBTCO.
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(40) A.
PARAMETERS: JOB_NAME(30).
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(40) B.
PARAMETERS: MAX_NUM TYPE N.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN COMMENT /1(50) C.
PARAMETERS: 5_MIN RADIOBUTTON GROUP PERI,
10_MIN RADIOBUTTON GROUP PERI,
30_MIN RADIOBUTTON GROUP PERI,
1_HOUR RADIOBUTTON GROUP PERI,
2_HOURS RADIOBUTTON GROUP PERI,
4_HOURS RADIOBUTTON GROUP PERI,
8_HOURS RADIOBUTTON GROUP PERI.
SELECTION-SCREEN END OF BLOCK BLK.
*
INITIALIZATION.
A = 'THE NAME OF THE BACH JOB:'.
B = 'MAXIMUM NUMBER OF CONCURRENT BATCH JOBS:'.
C = 'RESTART IN:'.
*
START-OF-SELECTION.
DATA: COUNTER TYPE I.
DATA: UZENET(40).
DATA: DATUM TYPE D, TIME TYPE T.
DATA: NEW_DATUM TYPE D, NEW_TIME TYPE T.
DATA: AMOUNT TYPE T.
DATA: NEW_JOBHEAD LIKE TBTCJOB.
DATA: T TYPE I.
* Some preparations
IF 5_MIN = 'X'.
AMOUNT = 300.
ELSEIF 10_MIN = 'X'.
AMOUNT = 600.
ELSEIF 30_MIN = 'X'.
AMOUNT = 1800.
ELSEIF 1_HOUR = 'X'.
AMOUNT = 3600.
ELSEIF 2_HOURS = 'X'.
AMOUNT = 7200.
ELSEIF 4_HOURS = 'X'.
AMOUNT = 14400.
ELSEIF 8_HOURS = 'X'.
AMOUNT = 28800.
ENDIF.
*
GET RUN TIME FIELD T.
GET TIME.
DATUM = SY-DATUM.
TIME = SY-UZEIT.
TIME = TIME + AMOUNT.
IF TIME < dialog="N" source_jobcount="TBTCO-JOBCOUNT" source_jobname="TBTCO-JOBNAME" target_jobname="TBTCO-JOBNAME" new_jobhead="NEW_JOBHEAD" cant_enq_job="9."> 9. EXIT. ENDIF.
ENDDO.
*
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBNAME = NEW_JOBHEAD-JOBNAME
JOBCOUNT = NEW_JOBHEAD-JOBCOUNT
SDLSTRTDT = DATUM
SDLSTRTTM = TIME.
* Abort the second step
UZENET = 'It is not ERROR! Rescheduling!'.
MESSAGE ID '00' TYPE 'A' NUMBER '208' WITH UZENET.
ENDIF.
Friday, October 15, 2010
ABAP Program for Limit the parallel instances a particular heavy batch job can have
Subscribe to:
Post Comments (Atom)
Automation Testing
- Manual and Automation testing Challenges
- What you need to know about BVT (Build Verification Testing)
- BVT types
- Learning basics of QTP automation tool and preparation of QTP interview questions
- QuickTest Pro - QTP Functional testing tool review
- Tips you should read before automating your testing work
- Choosing Automation tool for your organization
Blog Archive
-
▼
2010
(342)
-
▼
October
(127)
- free downloadABAP/4 OLE Automation Controller pdf ...
- sap abap program Sample XML Source Code For SAP
- sap abap XML file to word document through SAP
- abap program for How to determine the number of av...
- Handling favorites in ABAP Workbench
- ABAP/4 Programming Quickstart
- Number Range Object in sap
- PERFORMENCE TIPS IN ABAP
- ABAP Tips and Tricks
- ABAP Tips and Tricks
- What is the use of the POSITION and SIZE command i...
- How to find the Driver Program for the given SAPsc...
- How can I set the header and footer in the main wi...
- What the conditional statements used in SAP Scripts?
- What the conditional statements used in SAP Scripts?
- What is the difference between the SAP Script text...
- How can I change the page size of the layout?
- How can I apply shading for the BOXes in SAP Script?
- How can I format the date being displayed in the S...
- How can I format the time in the SAP Script?
- Frequently Used System Variables in SAPScript?
- What are the different types of windows in SAP Scr...
- How can I set the position of the leading sign to ...
- What are the various text formatting options in SA...
- How can I trigger new page in SAPScripts?
- How can I prevent page-break in the message that i...
- How can I copy SAPScripts from one client to another?
- How can I print logos in SAPScripts?
- How can I copy SAPScripts from one client to another?
- How can I Word Wrap the text being displayed in SA...
- How can I display barcodes in SAPScripts?
- I have created a script in language DE. Now I need...
- ABAP Tips and Tricks
- PERFORMENCE TIPS IN ABAP
- ABAP Tips and Tricks
- Number Range Object in sap
- Handling favorites in ABAP Workbench
- abap program for How to determine the number of av...
- ABAP/4 Programming Quickstart
- Some ABAP/4 Query header line variable
- ABAP Quick Viewer
- Creating The Query
- SAP ABAP Queries
- Creating Functional Areas Without a Logical Database
- Creating Functional Areas using a Logical Database
- Creating the ABAP Query
- Creating the User Group in SAP ABAP Queries
- Ranked List and Statistics in abap query
- Data Retrieval Using Program in abap query
- Authorizations in abap query
- What Is SAP Queries
- Authorizations in abap query
- SAP Query (BC-SRV-QUE)
- click on link
- HOW TO DEVELOPE ABAP QUERY
- ABAP/4 Query Hints and Tips IN Abap Query
- ABAP Program: Output of Date Format
- ABAP Programs : Using the events start-of-selectio...
- C program that uses the GUI automatization interfa...
- This ABAP rings the bell on any chosen pc, that ha...
- Method of displaying the hidden ABAPs of SAP - fro...
- abap program for Parallel processing: breaks a rep...
- Simple macro that prevents runnig more than one in...
- abap Program to download/upload table data dynamic...
- Create/Modify/Delete records in any table from CSV...
- Displaying Graphics using an ABAP Program
- ABAP Program: Output of Date Format
- Making a Java Editor in ABAP and compiling it
- Program to Hide ABAP's Source Code and Protects it
- Program to Hide ABAP's Source Code and Protects it
- Using Different Color in ABAP
- Protect part of ABAP code from modifying
- String Handling in ABAP - Removing Unwanted Char
- How to find out Total No of Pages of a Report Outp...
- Split String into two parts at delimiter in sap abap
- Macro to validate Date in abap sap
- How to get the field descriptions of a table?
- Dynamically increase/decrease the number of batch/...
- Have active URL-s in the list an ABAP report creates
- ABAP Program: show and hide windows by request
- Perl script to check the status of the SAP systems...
- abap program for Customized, dynamic login screen
- ABAP Program for refresh dynamically - once a seco...
- ABAP Program for Limit the parallel instances a pa...
- Hide and password-protect any ABAP's source - stil...
- Display the long raw fields of such SAP tables as ...
- ABAP Program for Yet another customized logon scre...
- The abap part, that retrieves the data from the SA...
- abap program for The remote script for 96a
- ABAP Program for This perl displays a self-refresh...
- abap program for Automatically save and circulate ...
- Tree display of the UNIX process table - a click o...
- ABAP Program for Continuously display the rejected...
- abap program for Display the true average response...
- COMMUNICATION INTERFACE IN ABAP COMPLETE
- COMMUNICATION INTERFACE 1
- COMMUNICATION INTERFACE 2
- COMMUNICATION INTERFACE 3
- COMMUNICATION INTERFACE 4
- COMMUNICATION INTERFACE 5
-
▼
October
(127)
No comments:
Post a Comment