0% found this document useful (0 votes)
6 views4 pages

Rsbpcoll

The document outlines a report for SAP's R/3 system focused on background processing and job runtime statistics collection. It includes parameters for selecting jobs, data structures for job statistics, and logic for updating job statistics in the database. The report also handles performance improvements by checking the date of the last collector run and selectively processing jobs based on their status and periodicity.

Uploaded by

Saavan Rathore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Rsbpcoll

The document outlines a report for SAP's R/3 system focused on background processing and job runtime statistics collection. It includes parameters for selecting jobs, data structures for job statistics, and logic for updating job statistics in the database. The report also handles performance improvements by checking the date of the last collector run and selectively processing jobs based on their status and periodicity.

Uploaded by

Saavan Rathore
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

************************************************************************

* RSBPCOLL *
*----------------------------------------------------------------------*
* *
* SAP AG Walldorf *
* Systeme, Anwendungen und Produkte in der Datenverarbeitung *
* *
* (C) Copyright SAP AG 1993 *
*----------------------------------------------------------------------*
* *
* Projekt: R/3 RZ-Leitstand - Background Processing *
* - Collector fuer Laufzeitstatistik der Jobs *
* *
* *
************************************************************************
REPORT rsbpcoll .

TABLES: btcjstat.

** note 2624832 new parameter ONLY PERIODIC JOBS


PARAMETERS: onlypjob TYPE c DEFAULT space.

* Interne Tabelle mit den Daten aller erledigten Jobs


DATA: BEGIN OF jobtab OCCURS 50.
INCLUDE STRUCTURE tbtco.
DATA: END OF jobtab.

* Arbeitsfelder
DATA: savname LIKE tbtco-jobname,
savdate LIKE tbtco-lastchdate,
savtime LIKE tbtco-lastchtime,
jobnum LIKE btcjstat-cntofjobs,
comparedat TYPE p,
startsec TYPE p,
endsec TYPE p,
duration TYPE p,
dursum TYPE p,
oldsum TYPE p.

DATA: btcoption_wa TYPE btcoptions,


tbtco_select_date TYPE sydats,
select_with_date TYPE c.

*-------------------------------------------------------------------*

** note 2118489 - better performance

* check date of last collector run


SELECT SINGLE * FROM btcoptions INTO btcoption_wa
WHERE btcoption = 'RSBPCOLL'
AND value1 = 'LASTRUN'.
IF sy-subrc = 0.
tbtco_select_date = btcoption_wa-value2.
select_with_date = 'X'.
ENDIF.

** if we know the date of the last collector run,


* select only jobs which have been started on the same date or later
IF select_with_date = 'X'.

** note 2624832 check parameter for collecting all or only periodic jobs
IF onlypjob = space.
SELECT * FROM tbtco INTO TABLE jobtab WHERE status = 'F'
AND strtdate >= tbtco_select_date.

ELSE. "only periodic jobs


SELECT * FROM tbtco INTO TABLE jobtab WHERE status = 'F'
AND periodic = 'X'
AND strtdate >= tbtco_select_date.
ENDIF.

ELSE. "no selectdate

** note 2624832 check parameter for collecting all or only periodic jobs
IF onlypjob = space.
SELECT * FROM tbtco INTO TABLE jobtab WHERE status = 'F'.

ELSE. "only periodic jobs


SELECT * FROM tbtco INTO TABLE jobtab WHERE status = 'F'
AND periodic = 'X'.

ENDIF.

ENDIF.
SORT jobtab BY jobname lastchdate lastchtime.

CLEAR: savname, savdate, savtime.


LOOP AT jobtab.
IF savname <> jobtab-jobname
OR savdate <> jobtab-lastchdate
OR savtime <> jobtab-lastchtime.
* Wechsel des Jobs --> Daten in BTCJSTAT ausgeben.
PERFORM update_btcjstat.
CLEAR: comparedat, jobnum, dursum.
SELECT SINGLE * FROM btcjstat WHERE jobname = jobtab-jobname
AND lastchdate = jobtab-lastchdate
AND lastchtime = jobtab-lastchtime.
* Job schon in BTCJSTAT vorhanden ?
* dann Zeitpunkt des letzten Statistik Eintrags merken.
IF sy-subrc = 0.
comparedat = btcjstat-statdate * 86400 + btcjstat-stattime.
ELSE.
CLEAR btcjstat.
ENDIF.
savname = jobtab-jobname.
savdate = jobtab-lastchdate.
savtime = jobtab-lastchtime.
ENDIF.
startsec = jobtab-strtdate * 86400 + jobtab-strttime.
* wenn das Startdatum > Zeitpunkt des letzten Statistik Eintrags,
* dann Laufzeit ermitteln und sammeln.
IF startsec > comparedat.
jobnum = jobnum + 1.
endsec = jobtab-enddate * 86400 + jobtab-endtime.
duration = endsec - startsec.
dursum = dursum + duration.
ENDIF.
ENDLOOP.
* Fuer den letzten Satz, Daten in BTCJSTAT ausgeben.
PERFORM update_btcjstat.

* write date of successfull run into btcoptions


SELECT SINGLE * FROM btcoptions INTO btcoption_wa
WHERE btcoption = 'RSBPCOLL'
AND value1 = 'LASTRUN'.
IF sy-subrc = 0.
btcoption_wa-value2 = sy-datum.
UPDATE btcoptions FROM btcoption_wa.
ELSE.
btcoption_wa-btcoption = 'RSBPCOLL'.
btcoption_wa-value1 = 'LASTRUN'.
btcoption_wa-value2 = sy-datum.
INSERT btcoptions FROM btcoption_wa.
ENDIF.

*---------------------------------------------------------------------*
* FORM UPDATE_BTCJSTAT *
*---------------------------------------------------------------------*
* Ermittelte Laufzeit in die Statisktikdatei BTCJSTAT ausgeben.
* - Wenn schon ein Satz vorhanden ist, werden die Daten
* Aktualisiert, sonst wird ein neuer Satz ausgegeben.
*
*---------------------------------------------------------------------*

FORM update_btcjstat.
IF savname = space.
EXIT.
ENDIF.
IF jobnum = 0.
EXIT.
ENDIF.
SELECT SINGLE * FROM btcjstat WHERE jobname = savname
AND lastchdate = savdate
AND lastchtime = savtime.
IF sy-subrc = 0.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 99.
IF jobnum > 100.
btcjstat-cntofjobs = jobnum.
btcjstat-avgtimsec = dursum / jobnum.
ELSE.
oldsum = btcjstat-cntofjobs * btcjstat-avgtimsec.
dursum = dursum + oldsum.
btcjstat-cntofjobs = btcjstat-cntofjobs + jobnum.
btcjstat-avgtimsec = dursum / btcjstat-cntofjobs.
ENDIF.
ENDCATCH.
IF sy-subrc <> 0.
EXIT.
ENDIF.

IF btcjstat-avgtimsec < 0.
btcjstat-avgtimsec = 0.
ENDIF.
btcjstat-statdate = sy-datum.
btcjstat-stattime = sy-uzeit.
UPDATE btcjstat.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
ELSE.
CLEAR btcjstat.
btcjstat-jobname = savname.
btcjstat-lastchdate = savdate.
btcjstat-lastchtime = savtime.
btcjstat-cntofjobs = jobnum.
CATCH SYSTEM-EXCEPTIONS arithmetic_errors = 4
OTHERS = 99.
btcjstat-avgtimsec = dursum / jobnum.
ENDCATCH.
IF sy-subrc <> 0.
EXIT.
ENDIF.
btcjstat-statdate = sy-datum.
btcjstat-stattime = sy-uzeit.
INSERT btcjstat.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
ENDIF.
ENDFORM.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy