Oscar,
Hace un tiempo encontre este codigo en la red...Ojala te ayude en algo.
Saludos.
REPORT zestados
NO STANDARD PAGE HEADING
MESSAGE-ID s1
LINE-COUNT 065
LINE-SIZE 1000.
*------TABLAS/ESTRUCTURAS----------------------------------------------*
TABLES: STATS_CUML ,"ERGEBNISSTRUKTUR EINZELSATZ
STA1 ,"STATISTIKANZEIGE SUMMENSATZ
STA2 ,"STATISTIKANZEIGE EINZELSATZ
STATL ,"SELECTION DATA SINGLE RECORD
* statr, "Rohdaten Statistikeinzelsatz
[[STATB,"ROHDA]] TEN TAB.STATISTIKEINZELSATZ
tstct,"Text für Transaktionen
d020t,"Text für Screens
tadir,"Objekttabelle für Textbeschaf.
tdevct,"Text für Entw.klassen
trclt,"Text für Reportklassen
trdir,"Reportinformationen
eudb,"Enthält Text der Funktionskeys
moni,"Performance Datenbank MONI
moni_v01,"Streichview zu MONI
* pfnorm,
sapwlpfnrm."Version 2: Normal statistic rec.
INCLUDE RSSTATSU.
INCLUDE RSSTATDA.
INCLUDE RSSTATD2.
INCLUDE RSSTATX2.
INCLUDE RSSTATCS.
INCLUDE RSSTATMO.
*------TABLAS INTERNAS-------------------------------------------------*
data: begin of i_Datos occurs 1000,
account like stats-account,
date like stats-date,
endti like stats-endti,
tcode like stats-tcode,
terminalid like stats-terminalid,
report like stats-report,
jobname like stats-jobname,
jobstep like stats-jobstep,
tabload like stats-tabload,
dynpronr like stats-dynpronr,
end of i_datos.
data: begin of i_aux occurs 1000,
account like stats-account,
report like stats-report,
tcode like stats-tcode,
date like stats-date,
endti like stats-endti,
terminalid like stats-terminalid,
jobname like stats-jobname,
end of i_aux.
*------VARIABLES-------------------------------------------------------*
*------PARAMETER/SELECT-OPTIONS EN PANTALLA----------------------------*
SELECTION-SCREEN BEGIN OF BLOCK blk_par WITH FRAME.
PARAMETERS: ruser LIKE sapwlpfnrm-account,"User
rtcode LIKE sapwlpfnrm-tcode,"Tcode
rprogram LIKE sapwlpfnrm-report,"Report
tasktype,"Tasktyp
rscreen LIKE sapwlpfnrm-dynpronr,"Dynpro
rwpid(2)."Work Process
SELECTION-SCREEN ULINE.
PARAMETERS: rrspti LIKE sapwlpfidx-max_respti,"Resp. time
rdbti LIKE sapwlpfidx-max_dbti,"DB time
rcputi LIKE sapwlpfidx-max_cputi,"CPU time
rkbyte TYPE i,"Bytes trans
rchg TYPE i."Phys.Aenderg.
SELECTION-SCREEN ULINE.
PARAMETERS: rstartti LIKE sy-uzeit,"ab Uhrzeit
rday LIKE sy-datum,"ab Tag
rendti LIKE sy-uzeit,
rendday LIKE sy-datum.
SELECTION-SCREEN ULINE.
PARAMETERS: rpath LIKE sapwlpstrc-filename,"Stat.Dateinam
rmaxcnt TYPE i DEFAULT 200.
SELECTION-SCREEN END OF BLOCK blk_par.
********************************** ALV *********************************
TYPE-POOLS: slis.
DATA: alv_fieldtab TYPE slis_t_fieldcat_alv,
alv_heading TYPE slis_t_listheader,
alv_layout TYPE slis_layout_alv,
alv_events TYPE slis_t_event,
alv_sort TYPE slis_t_sortinfo_alv,
alv_filter TYPE slis_t_filter_alv,
alv_repname LIKE sy-repid,
alv_f2code LIKE sy-ucomm VALUE '&ETA',
alv_g_save(1) TYPE c,
alv_g_exit(1) TYPE c.
DATA: alv_fieldcat TYPE slis_fieldcat_alv.
************************************************************************
*
* LOGICA DEL PROGRAMA
*
************************************************************************
*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.
'
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'stat/file'
ID 'VALUE' FIELD pfad.
CALL 'C_GET_SYSTEM_NUMBER' ID 'SYSTEM' FIELD systemid.
initflag = 'Y'.
PERFORM transfer_selection_data."Selektionsdaten uebernehmen
SET TITLEBAR '001'.
* BI_FLAG = ' '. "Keine BI-Selektion
headlinesize = 4."Vier Kopfzeilen bei Hitlisten
* STA2-SORTNAME = 'time'. "Sortierkriterium anfangs
savecucol = 15."Cursorposition fuer Columnsort
status = 'SING'."Status for single record displ.
indexappend = 'N'."Indexaufbau noch nicht noetig
*
*-Hole Profilparameter stat/tabrec--------------------------------------
*
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'stat/tabrec'
ID 'VALUE' FIELD parvalue.
IF sy-subrc > 0.
tabrec = 0.
ELSE.
tabrec = parvalue.
ENDIF.
*----------------------------------------------------------------------
* START-OF-SELECTION.
*----------------------------------------------------------------------*
START-OF-SELECTION.
'
'
output = 'N'.
steuer = 'DISP'."Standardanzeige bei Pickup
PERFORM prepare_selection."Seletionsdatenen aufbereiten
PERFORM prepare_fill_stats USING code."Übergabeparameter setzen
PERFORM fill-stats USING 'F'."Laden interne Statistik-Tabelle
loop at stats.
clear i_aux.
move-corresponding stats to i_aux.
append i_aux.
endloop.
sort i_aux.
data: l_time like stats-endti,
l_secs type i,
l_new,
l_aux like i_aux.
loop at i_aux.
l_aux = i_aux.
at new date.
l_time = l_aux-endti.
l_new = 'X'.
endat.
if l_new = 'X'.
clear l_new.
else.
l_secs = i_aux-endti - l_time.
if l_secs < 60.
l_time = i_aux-endti.
continue.
endif.
endif.
move-corresponding i_aux to i_datos.
append i_datos.
l_time = i_aux-endti.
endloop.
sort i_datos.
PERFORM alv_write_output TABLES i_datos USING 'I_DATOS'.
*---------------------------------------------------------------------*
* FORM TRANSFER_SELECTION_DATA *
*---------------------------------------------------------------------*
* Transfer der Selektionsdaten *
*---------------------------------------------------------------------*
FORM transfer_selection_data.
rmaxcnt = statl-smaxcnt.
IF rmaxcnt <= 0.
rmaxcnt = 500.
ENDIF.
rday = statl-sdat.
IF rday IS INITIAL.
rday = sy-datum.
IF statl-stime < sy-uzeit.
rstartti = statl-stime.
ELSE.
CLEAR rstartti.
ENDIF.
ELSE.
rstartti = statl-stime.
ENDIF.
rendday = statl-senddat.
IF rendday IS INITIAL.
rendday = sy-datum.
rendti = sy-uzeit.
ELSE.
rendti = statl-sendtime.
ENDIF.
IF rday > sy-datum OR
( rday = sy-datum AND rstartti > sy-uzeit ).
rday = sy-datum.
CLEAR rstartti.
ENDIF.
IF rendday < rday OR
( rendday = rday AND rendti < rstartti ).
rendday = rday.
rendti = '235959'.
ENDIF.
ruser = statl-sbenu.
IF ruser IS INITIAL.
ruser = '*'.
ENDIF.
rtcode = statl-stcod.
IF rtcode IS INITIAL.
rtcode = '*'.
ENDIF.
rprogram = statl-sprogram.
IF rprogram IS INITIAL.
rprogram = '*'.
ENDIF.
tasktype = statl-stask.
IF tasktype IS INITIAL.
tasktype = '*'.
ENDIF.
rwpid = statl-swpid.
IF rwpid IS INITIAL.
rwpid = '*'.
ENDIF.
rrspti = statl-sresptime.
rcputi = statl-scputime.
rdbti = statl-sdbtime.
rchg = statl-schg.
rkbyte = statl-sbytes.
rscreen = statl-sscreen.
IF rscreen IS INITIAL.
rscreen = '*'.
ENDIF.
rpath = statl-spath.
IF rpath IS INITIAL OR rpath = '*'.
rpath = pfad.
rsystemid = systemid.
ELSE.
rsystemid = statl-ssystemid.
IF rsystemid IS INITIAL OR rsystemid = '*'.
rsystemid = systemid.
ENDIF.
ENDIF.
IF statl-sseltime1 <> 'X'. "Terminal ID statt Account nehmen
TRANSLATE ruser TO UPPER CASE."Accountname in Grossbuchstaben
ENDIF.
ENDFORM.
'
*---------------------------------------------------------------------*
* FORM RETRANS_SELECTION_DATA *
*---------------------------------------------------------------------*
* STATL mit Selektionsdaten fuellen *
*---------------------------------------------------------------------*
FORM retrans_selection_data.
TRANSLATE ruser TO UPPER CASE.
IF rwpid IS INITIAL OR rwpid(1) = '!'.
rwpid = '*'.
ELSEIF rwpid CO ' 0123456789'.
sy-tfill = rwpid.
WRITE sy-tfill TO rwpid USING EDIT MASK 'RR__'.
ENDIF.
statl-swpid = rwpid.
IF rmaxcnt <= 0.
rmaxcnt = 500.
ENDIF.
statl-smaxcnt = rmaxcnt.
statl-sbenu = ruser.
statl-stcod = rtcode.
statl-sprogram = rprogram.
statl-stask = tasktype.
statl-sresptime = rrspti.
statl-scputime = rcputi.
statl-sdbtime = rdbti.
statl-schg = rchg.
statl-sbytes = rkbyte.
statl-sdat = rday.
statl-stime = rstartti.
statl-senddat = rendday.
statl-sendtime = rendti.
IF rscreen IS INITIAL.
rscreen = '*'.
ELSEIF rscreen CO ' 0123456789'.
sy-tfill = rscreen.
WRITE sy-tfill TO rscreen USING EDIT MASK 'RR____'.
TRANSLATE rscreen USING ' 0'.
ENDIF.
statl-sscreen = rscreen.
statl-spath = rpath.
statl-ssystemid = rsystemid.
ENDFORM.
'
*----------------------------------------------------------------------*
* Macro ADD_REC_TO_STATS
*----------------------------------------------------------------------*
* Add a record to the stats table *
*----------------------------------------------------------------------*
* --> &1 statistic record *
* --> &2 record number *
* --> &2 record number *
* --> &3 program/report name *
* --> &4 entry ID *
* --> &5 subrecord index table (sorted by the record number) *
*----------------------------------------------------------------------*
DEFINE add_rec_to_stats.
divide: &1-respti by 1000,"B30K012402
&1-cputi by 1000,
&1-queueti by 1000,
&1-rollinti by 1000,
&1-rolloutti by 1000,
&1-lockti by 1000,
&1-txxxti by 1000,
&1-readdirti by 1000,
&1-readseqti by 1000,
&1-insti by 1000,
&1-updti by 1000,
&1-delti by 1000,
&1-committi by 1000,
&1-generateti by 1000,
&1-reploadti by 1000,
&1-cualoadti by 1000,
&1-dynploadti by 1000,
&1-queti by 1000,
&1-ddicti by 1000,
&1-mcti by 1000.
move-corresponding &1 to stats.
stats-origin = &2.
stats-report = &3.
if &4+64(1) = 'T'.
stats-tcode = &4(40).
endif.
stats-endti = &1-endtime.
stats-date = &1-enddate.
stats-dbcalls = stats-readdircnt + stats-readseqcnt +
stats-inscnt + stats-updcnt + stats-delcnt.
stats-tablepoint = 0.
if &2 > 0.
read table &5 with key recordno = &2 binary search.
if sy-subrc = 0 and &5-tab_b > 0.
stats-tablepoint = 1.
endif.
endif.
append stats.
END-OF-DEFINITION.
'
'
*-----------------------------------------------------------------------
* FORM FILL-STATS: Fuellen der internen Tabelle STATS mit Records
* ----------------------------------------------------------------------
* --> DIRECTION read direction F)orward or B)ackwards
*-----------------------------------------------------------------------
*
'
FORM fill-stats USING direction TYPE c.
DATA records_read LIKE sapwlsfidx-recordno.
DATA records LIKE sapwlsfidx-recordno.
DATA file_error LIKE sapwlpstrc-file_error.
DATA user LIKE sapwlpfnrm-account.
DATA tcode LIKE sapwlpfnrm-tcode.
DATA entry_id LIKE sapwluenti-entry_id.
DATA program LIKE sapwlpfnrm-report.
DATA screen LIKE sapwlpfnrm-dynpronr.
DATA tasktype TYPE c.
DATA wpid(2) TYPE c.
DATA hex_wpid LIKE sapwlpstrc-wp_number.
DATA rspti TYPE p.
DATA cputi TYPE p.
DATA dbti TYPE p.
DATA kbyte TYPE p.
DATA chg TYPE p.
DATA v2_normal_start TYPE i.
DATA v2_btc_step_start TYPE i.
DATA exit_loop.
DATA stats_wa LIKE stats.
DATA cutindex TYPE i.
DATA while_counter TYPE i VALUE '0'.
STATICS no_buffer_flush.
FREE: v2_normal_records,
v2_btc_step_records,
v2_table_records,
v2_rfc_client_records,
v2_rfc_server_records,
v2_rfc_client_dest_records,
v2_rfc_server_dest_records,
v2_spool_print_records,
v2_spool_activity_records,
v2_rfc_time_int_records,
norm_subrecord_index,
stats.
CLEAR index.
IF rwpid CO ' 0123456789'.
sy-tfill = rwpid."Conversion to type I
hex_wpid = sy-tfill."Conversion to type X
ELSE.
hex_wpid = 'FFFF'.
ENDIF.
*--- New version of SAPWL_STATREC_READ (_FILE) - June 1997 - DH
* - check read dirction
IF direction <> 'B'.
read_direction = 'X'.
ELSE.
read_direction = ' '.
ENDIF.
* - check wether start_read_recordno is given
IF start_read_recordno IS INITIAL.
start_read_recordno = -1.
ENDIF.
* - read all data from statistic file
WHILE records_read < rmaxcnt AND
exit_loop IS INITIAL.
* - set counter to get first/last record read
ADD 1 TO while_counter.
* - who many records to read are left?
records = rmaxcnt - records_read.
* - get start position for now read records
DESCRIBE: TABLE v2_normal_records LINES v2_normal_start,
TABLE v2_btc_step_records LINES v2_btc_step_start.
* - read from statistic file 'records' records
CALL FUNCTION 'SAPWL_STATREC_READ_FILE'
EXPORTING
no_of_records = records
* READ_CLIENT =
read_end_date = rendday
read_end_time = rendti
* READ_EXCLUDE_USERNAME =
read_continue_recordno = start_read_recordno
read_start_date = rday
read_start_time = rstartti
read_username = ruser
read_workprocess = hex_wpid
read_forward = read_direction
statistic_file = rpath
no_buffer_flush = no_buffer_flush
IMPORTING
file_error = file_error
records_read = records
eof_reached = eof_reached
continue_recordno_forward = continue_recordno_forward
continue_recordno_backward = continue_recordno_backward
* PROBLEMS =
TABLES
v2_normal_records = v2_normal_records
v2_btc_step_records = v2_btc_step_records
v2_table_records = v2_table_records
v2_rfc_client_records = v2_rfc_client_records
v2_rfc_server_records = v2_rfc_server_records
v2_rfc_client_dest_records = v2_rfc_client_dest_records
v2_rfc_server_dest_records = v2_rfc_server_dest_records
v2_spool_print_records = v2_spool_print_records
v2_spool_activity_records = v2_spool_activity_records
v2_rfc_time_int_records = v2_rfc_time_int_records
norm_subrecord_index = norm_subrecord_index
EXCEPTIONS
wrong_parameter_combination = 1
OTHERS = 2.
* - records found?
IF records = 0.
EXIT.
ENDIF.
* - get first / last record read
IF while_counter = 1.
IF direction = 'B'.
save_continue_recordno_forw = continue_recordno_forward.
ELSE.
save_continue_recordno_backw = continue_recordno_backward.
ENDIF.
ELSE.
IF direction = 'B'.
save_continue_recordno_backw = continue_recordno_backward.
ELSE.
save_continue_recordno_forw = continue_recordno_forward.
ENDIF.
ENDIF.
* - don't flush the buffer anymore
no_buffer_flush = 'X'.
* - sort subrecord index by recordno - no more necessary!?!
SORT norm_subrecord_index BY recordno.
* - get / overwork a number of parameters in v2_normal_records
ADD 1 TO v2_normal_start.
LOOP AT v2_normal_records FROM v2_normal_start.
CALL FUNCTION 'SAPWL_STATREC_GET_ENTRY_ID'
EXPORTING
v2_record = v2_normal_records
IMPORTING
entry_id = entry_id
converted_report_name = program.
tcode = v2_normal_records-tcode.
PERFORM tt_convert_number_to_letter
USING v2_normal_records-tasktype tasktype.
user = v2_normal_records-account.
screen = v2_normal_records-dynpronr.
sy-tfill = v2_normal_records-wpid.
WRITE sy-tfill TO wpid USING EDIT MASK 'RR__'.
rspti = v2_normal_records-respti / 1000.
cputi = v2_normal_records-cputi / 1000.
dbti = ( v2_normal_records-delti +
v2_normal_records-insti +
v2_normal_records-updti +
v2_normal_records-readseqti +
v2_normal_records-readdirti ) / 1000.
kbyte = ( v2_normal_records-ntabcnt +
v2_normal_records-quecnt +
v2_normal_records-rfccnt +
v2_normal_records-ddiccnt +
v2_normal_records-dynpscnt +
v2_normal_records-dynplcnt +
v2_normal_records-abapscnt +
v2_normal_records-abaplcnt +
v2_normal_records-cualcnt +
v2_normal_records-dsqlcnt ) / 1024.
chg = v2_normal_records-phyupdcnt +
v2_normal_records-phyinscnt +
v2_normal_records-phydelcnt.
* - don't put record into stats if selection criteria don't match
CHECK user CP ruser
AND tcode CP rtcode
AND program CP rprogram
AND screen CP rscreen
AND ( v2_normal_records-tasktype = rtasktype
OR rtasktype = '00' )
AND wpid CP rwpid
AND rspti >= rrspti
AND cputi >= rcputi
AND dbti >= rdbti
AND kbyte >= rkbyte
AND chg >= rchg.
CLEAR stats.
stats-cpicti = v2_normal_records-rfcti.
* - put normal records into stats
add_rec_to_stats v2_normal_records
sy-tabix
program
entry_id
norm_subrecord_index.
ENDLOOP.
* - get / overwork a number of parameters of batches
ADD 1 TO v2_btc_step_start.
LOOP AT v2_btc_step_records FROM v2_btc_step_start.
PERFORM tt_convert_number_to_letter
USING v2_btc_step_records-tasktype tasktype.
CALL FUNCTION 'SAPWL_STATREC_GET_ENTRY_ID'
EXPORTING
v2_btc_record = v2_btc_step_records
IMPORTING
entry_id = entry_id
converted_report_name = program
EXCEPTIONS
wrong_statistic_version = 1
OTHERS = 2.
tcode = space." v2_btc_step_records-tcode.
user = v2_btc_step_records-account.
screen = v2_btc_step_records-dynpronr.
sy-tfill = v2_btc_step_records-wpid.
WRITE sy-tfill TO wpid USING EDIT MASK 'RR__'.
rspti = v2_btc_step_records-respti / 1000.
cputi = v2_btc_step_records-cputi / 1000.
dbti = ( v2_btc_step_records-delti +
v2_btc_step_records-insti +
v2_btc_step_records-updti +
v2_btc_step_records-readseqti +
v2_btc_step_records-readdirti ) / 1000.
kbyte = ( v2_btc_step_records-ntabcnt +
v2_btc_step_records-quecnt +
v2_btc_step_records-rfccnt +
v2_btc_step_records-ddiccnt +
v2_btc_step_records-dynpscnt +
v2_btc_step_records-dynplcnt +
v2_btc_step_records-abapscnt +
v2_btc_step_records-abaplcnt +
v2_btc_step_records-cualcnt +
v2_btc_step_records-dsqlcnt ) / 1024.
chg = v2_btc_step_records-phyupdcnt +
v2_btc_step_records-phyinscnt +
v2_btc_step_records-phydelcnt.
* - don't out record into stats if selection criteria don't match
CHECK user CP ruser
AND tcode CP rtcode
AND program CP rprogram
AND screen CP rscreen
AND wpid CP rwpid
AND rspti >= rrspti
AND cputi >= rcputi
AND dbti >= rdbti
AND kbyte >= rkbyte
AND chg >= rchg
AND ( v2_btc_step_records-tasktype = rtasktype
OR rtasktype = '00' ).
CLEAR stats.
stats-cpicti = v2_btc_step_records-rfcti.
* - put batch record into stats
add_rec_to_stats v2_btc_step_records
-1
program
entry_id
norm_subrecord_index.
ENDLOOP.
* - beginning/end of statistic file reached? or read problems?
IF eof_reached = 'X' OR NOT ( file_error IS INITIAL ) .
EXIT.
ENDIF.
* - get number of records in stat
DESCRIBE TABLE stats LINES records_read.
* - check wether rmaxcnt was reached and set new start_read_recordno
IF records_read < rmaxcnt.
IF direction = 'B'.
start_read_recordno = continue_recordno_backward.
ELSE.
start_read_recordno = continue_recordno_forward.
ENDIF.
ENDIF.
ENDWHILE.
* - end of read data from file
* - Satznummer vom zuerst bzw. zuletzt gelesenen Satz wiederherstellen
IF direction = 'B'.
continue_recordno_forward = save_continue_recordno_forw.
ELSE.
continue_recordno_backward = save_continue_recordno_backw.
ENDIF.
* - get start time and day if it was reset before
IF rstartti = space AND rday = space.
SORT stats BY date ASCENDING endti ASCENDING.
READ TABLE stats INDEX 1.
rday = stats-date.
rstartti = stats-endti.
ENDIF.
rdate = statl-sdat = rday.
seltime = statl-stime = rstartti.
* - get number of records in stat - nochmals nötig, falls EOF erreicht
DESCRIBE TABLE stats LINES records_read.
IF records_read = 0.
statl-senddat = rendday.
statl-sendtime = rendti.
IF file_error IS INITIAL.
MESSAGE s006 WITH myname."rsystem.
* No statistical record for $ found with given criteria
ELSE.
MESSAGE s076 WITH file_error.
* Read problems with statistic file (OS error: &)
ENDIF.
ELSE.
* - get end time and day
SORT stats BY date ASCENDING endti ASCENDING.
READ TABLE stats INDEX records_read.
rendday = statl-senddat = stats-date.
rendti = statl-sendtime = stats-endti.
ENDIF.
* index = records_read. "for write-disp
* PERFORM write-disp.
ENDFORM."FILL-STATS
'
*&---------------------------------------------------------------------*
*& Form PREPARE_FILL_STATS
*&---------------------------------------------------------------------*
* Übergabeparameter für Form Fill-Stats bzw. Funktionsbaustein
* SAPWL_STATREC_READ_FILE setzen.
*----------------------------------------------------------------------*
* --> code Bearbeitungsmodus (-> Leserichtung, Leseergebnis)
* <-- start_read_recordno Startsatz, falls 'Weiter-'lesen
* rday, rstartti ggf. Lesestartzeitpunkt
* rendday, rendti ggf. Leseendzeitpunkt
*----------------------------------------------------------------------*
FORM prepare_fill_stats USING value(fall).
'
CASE fall.
WHEN 'INIT' OR 'MINS' OR 'MINM' OR 'NEWR' OR 'NEWT'.
start_read_recordno = '1-'.
WHEN 'RECM' OR 'SIZE'.
start_read_recordno = continue_recordno_backward.
rday = space. rstartti = space.
rendday = '99991231'. rendti = '235959'.
WHEN 'RECN'.
start_read_recordno = continue_recordno_forward.
rday = space. rstartti = space.
rendday = '99991231'. rendti = '235959'.
WHEN OTHERS.
start_read_recordno = '1-'.
ENDCASE.
ENDFORM." PREPARE_FILL_STATS
'
*---------------------------------------------------------------------*
* FORM PREPARE_SELECTION *
*---------------------------------------------------------------------*
* Aufbereitung der Selektionskriterien *
*---------------------------------------------------------------------*
FORM prepare_selection.
DATA: savepath LIKE pfad.
*---Sonderfall bei Zeitslot: Terminalid statt Accountname
IF statl-sseltime1 = 'X'.
IF statl-sbenu = '_'.
ruser = space.
ENDIF.
ELSE.
TRANSLATE ruser TO UPPER CASE.
ENDIF.
IF statl-sbenu = '*TOTAL*'.
statl-sbenu = '*'.
ruser = '*'.
ENDIF.
IF statl-stcod = '*TOTAL*'.
statl-stcod = '*'.
rtcode = '*'.
ENDIF.
IF statl-sprogram = '*TOTAL*'.
statl-sprogram = '*'.
rprogram = '*'.
ENDIF.
*
*-Eigener Server aber andere Instanz ( andere SYSTEMID )
IF statl-ssystemid BETWEEN '00' AND '99' AND
statl-ssystemid <> systemid.
newinstanceflag = 'X'."Nachbarinstanz wird behandelt
ELSE.
newinstanceflag = ' '."eigene Instanz
ENDIF.
*
pfad = rpath."Pfad setzen
IF pfad = space OR pfad = '*'."Default Pfad
newinstanceflag = ' '.
statl-ssystemid = '*'.
PERFORM fill-pfad."Stat-Datei-Pfad, Systemid laden
ENDIF.
bi_flag = ' '.
PERFORM tt_convert_letter_to_number USING tasktype rtasktype.
IF tasktype = 'I'.
bi_flag = 'X'.
ENDIF.
*
seltime = rstartti."Min.zeit bei Selektion festlegen
PERFORM get-cpu-id."Server-Id laden
rsystem = cpuid."Grundparameter setzen
*-Server extern---------------------------------------------------------
IF statl-ssystemid <> '**' AND statl-ssystemid <> ' ' AND
statl-ssystemid <> ' *' AND statl-ssystemid <> '* ' AND
statl-ssystemid <> '--' AND statl-ssystemid <> systemid.
IF statl-ssystemid BETWEEN '00' AND '99'.
ELSE.
rsystem = 'Extern'."bei externen Systemen
ENDIF.
ENDIF.
*--Pfadnamen verproben / Kann Index ueberhaupt benutzt, aufgebaut werden
IF pfad <> space AND pfad <> '*'. "Default Pfad
savepath = pfad.
PERFORM fill-pfad.
IF pfad <> savepath "Nicht Default Pfadname
AND rsystem <> 'Extern' "und keine Externen Daten
AND newinstanceflag <> 'X'. "und keine Nachbarinstanzdaten
noindexflag = 'X'."Kein Indexaufbau gewuenscht !
ENDIF.
pfad = savepath.
ENDIF.
*
*-Authority-Check bei Userfremden Daten---------------------------------
* IF ruser <> sy-uname. "Fremde User anzeigen !
* AUTHORITY-CHECK OBJECT 'S_TOOLS_EX'
* ID 'AUTH' FIELD 'S_TOOLS_EX_A'.
* IF sy-subrc <> 0.
* noauthflag = 'X'. "Nicht authorisiert
* IF ruser <> '*'. "Alle sind erlaubt
* statl-sbenu = sy-uname. "oder nur der Benutzer selbs
* statl-sseltime1 = ' '. "Terminalid nicht erlaubt
* ruser = sy-uname.
* ENDIF.
* MESSAGE i090 WITH 'Monitortools'."B20K000662 QQI
* ENDIF.
* ENDIF.
*
*-Pruefen Profileparameter rsdb/level bei eigenem Server----------------
IF rsystem = sy-host.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'stat/level'
ID 'VALUE' FIELD parvalue.
IF sy-subrc > 0 OR parvalue = '0'.
MESSAGE e097 WITH 'stat/level' parvalue.
EXIT.
ENDIF.
ENDIF.
*
rperiod = 'DAY'."
rdate = rday."
ENDFORM.
'
*&---------------------------------------------------------------------*
*& Form BUILD_EVENTTAB
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_EVENTS[] text *
*----------------------------------------------------------------------*
FORM alv_build_eventtab USING p_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_events.
READ TABLE p_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_top_of_page TO ls_event-form.
MODIFY p_events FROM ls_event INDEX sy-tabix.
ENDIF.
*
READ TABLE p_events WITH KEY name = slis_ev_pf_status_set
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_pf_status_set TO ls_event-form.
MODIFY p_events FROM ls_event INDEX sy-tabix.
ENDIF.
READ TABLE p_events WITH KEY name = slis_ev_user_command
INTO ls_event.
IF sy-subrc = 0.
MOVE slis_ev_user_command TO ls_event-form.
MODIFY p_events FROM ls_event INDEX sy-tabix.
ENDIF.
ENDFORM." BUILD_EVENTTAB
'
*&---------------------------------------------------------------------*
*& Form WRITE_OUTPUT
*&---------------------------------------------------------------------*
FORM alv_write_output TABLES pi_tabla
USING pe_tabla.
ALV_REPNAME = SY-REPID.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = alv_repname
i_internal_tabname = pe_tabla
i_inclname = alv_repname
CHANGING
ct_fieldcat = alv_fieldtab.
IF sy-subrc <> 0.
WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_FIELDCATALOG_MERGE'.
ENDIF.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = alv_repname
i_structure_name = pe_tabla
is_layout = alv_layout
it_fieldcat = alv_fieldtab
i_default = 'A'
i_save = alv_g_save
it_events = alv_events[]
it_sort = alv_sort
it_filter = alv_filter
TABLES
t_outtab = pi_tabla.
IF sy-subrc <> 0.
WRITE: 'SY-SUBRC: ', sy-subrc, 'REUSE_ALV_LIST_DISPLAY'.
ENDIF.
ENDFORM." WRITE_OUTPUT