ABAP 后台作业的一个状态查询工具
生活随笔
收集整理的這篇文章主要介紹了
ABAP 后台作业的一个状态查询工具
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
執行 report,界面如下,指定要查詢的時間間隔:
查詢結果:
源代碼:
REPORT Z_MAT_analyzer line-size 255no standard page heading. *---------------------------------------------------------------------- * Tool : Job Log Analyzer * This tool analyzes the Job Log and summarizes the messages. *----------------------------------------------------------------------*---------------------------------------------------------------------- tables: tbtco.*---------------------------------------------------------------------- SELECT-OPTIONS: SO_JOBNM FOR TBTCO-JOBNAME. SELECT-OPTIONS: SO_STRDT FOR TBTCO-STRTDATE DEFAULT SY-DATUM. SELECT-OPTIONS: SO_UNAME FOR TBTCO-RELUNAME DEFAULT SY-UNAME.*---------------------------------------------------------------------- constants: c_hdr_lines type i value 3.types: begin of typ_logsumm,msgid type tbtc5-msgid,msgno type tbtc5-msgno,msgtype type tbtc5-msgtype,text_gen type tbtc5-text,count type sy-index,end of typ_logsumm.data: it_tbtco type standard table of tbtcowith header line,it_joblog type standard table of TBTC5with header line,it_logsumm type standard table of typ_logsummwith header line.data: l_status(10) type c,l_alternate(01) type c,l_index type sy-index.*---------------------------------------------------------------------- start-of-selection. * set pf-status '0002'.write: / sy-uline(87).write: / '|' no-gap,(32) 'Job Name' color col_heading no-gap, '|' no-gap,(10) 'St Date' color col_heading no-gap, '|' no-gap,(08) 'St Time' color col_heading no-gap, '|' no-gap,(12) 'User' color col_heading no-gap, '|' no-gap,(10) 'Status' color col_heading no-gap, '|' no-gap,(08) 'Job Nbr' color col_heading no-gap, '|' no-gap. write: / sy-uline(87).* select * from tbtcointo table it_tbtcowhere jobname in so_jobnmAND strtdate in so_strdtand reluname in so_uname.* sort it_tbtco by jobname jobcount descending.loop at it_tbtco.case it_tbtco-status.when 'F'. l_status = 'Finished'.when 'C'. l_status = 'Active'.when 'A'. l_status = 'Canceled'.when 'R'. l_status = 'Ready'.when 'P'. l_status = 'Scheduled'.when 'S'. l_status = 'Scheduled'. * P & S - Should never show up in this report.when others. l_status = it_tbtco-status.endcase.if l_alternate is initial.l_alternate = 'X'.format color col_normal intensified on.else.l_alternate = ' '.format color col_normal intensified off.endif.write: / '|' no-gap,(32) it_tbtco-jobname no-gap, '|' no-gap,(10) it_tbtco-STRTDATE no-gap, '|' no-gap,(08) it_tbtco-STRTTIME no-gap, '|' no-gap,(12) it_TBTCO-RELUNAME no-gap, '|' no-gap,(10) l_status no-gap, '|' no-gap,(08) it_tbtco-jobcount no-gap, '|' no-gap.endloop.write: / sy-uline(87).*---------------------------------------------------------------------- at line-selection.l_index = sy-lilli - c_hdr_lines.read table it_tbtco index l_index.check sy-subrc = 0.refresh: it_joblog.CALL FUNCTION 'BP_JOBLOG_READ'EXPORTINGJOBCOUNT = it_tbtco-jobcountJOBNAME = it_tbtco-jobnameTABLESJOBLOGTBL = it_joblogEXCEPTIONSCANT_READ_JOBLOG = 1JOBCOUNT_MISSING = 2JOBLOG_DOES_NOT_EXIST = 3JOBLOG_IS_EMPTY = 4JOBLOG_NAME_MISSING = 5JOBNAME_MISSING = 6JOB_DOES_NOT_EXIST = 7OTHERS = 8.IF SY-SUBRC <> 0.write: / 'No Log found for Job:', it_tbtco-jobname.ENDIF.refresh: it_logsumm.it_logsumm-count = 1.loop at it_joblog.move-corresponding it_joblog to it_logsumm.select single text into it_logsumm-text_genfrom t100where sprsl = sy-languand arbgb = it_logsumm-msgidand msgnr = it_logsumm-msgno.collect it_logsumm.endloop.format color col_heading.write: / sy-uline(122).write: / '|' no-gap,(02) 'ID' no-gap, '|' no-gap,(03) 'Nbr' no-gap, '|' no-gap,(01) 'T' no-gap, '|' no-gap,(10) 'Count' no-gap, '|' no-gap,(100) 'Error Message' no-gap, '|' no-gap.write: / sy-uline(122).loop at it_logsumm.if l_alternate is initial.l_alternate = 'X'.format color col_normal intensified on.else.l_alternate = ' '.format color col_normal intensified off.endif.write: / '|' no-gap,(02) it_logsumm-msgid no-gap, '|' no-gap,(03) it_logsumm-msgno no-gap, '|' no-gap,(01) it_logsumm-msgtype no-gap, '|' no-gap,(10) it_logsumm-count no-gap, '|' no-gap,(100) it_logsumm-text_gen no-gap, '|' no-gap.endloop.write: / sy-uline(122).總結
以上是生活随笔為你收集整理的ABAP 后台作业的一个状态查询工具的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 拒绝流氓应用 Win11安卓子系统重磅升
- 下一篇: Angular 服务器端渲染的一个错误消