Advertisement
CDLG_TGR

Mass Log WF

Jun 4th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 3.30 KB | None | 0 0
  1. *&---------------------------------------------------------------------*
  2. *& Report  ZBC_SWWW_LOGS
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *& Permet de lister les messages des étapes de workflows
  6. *&---------------------------------------------------------------------*
  7. report zbc_swww_logs.
  8.  
  9. types:
  10.   begin of ty_restit,
  11.     wi_id      type sww_wiid,
  12.     method     type sww_logact,
  13.     meth_edate type sww_edate,
  14.     meth_etime type sww_etime,
  15.     log_count  type sww_logcnt,
  16.     meth_user  type sww_aagent,
  17.     workarea   type arbgb,
  18.     msgtype    type symsgty,
  19.     message    type string,
  20.   end of ty_restit.
  21.  
  22. data:
  23.   wf_header   type swwwihead,
  24.   wf_header_t type standard table of swwwihead,
  25.   wf_id       type sww_wiid,
  26.   wf_log      type swwloghist,
  27.   wf_log_t    type standard table of swwloghist.
  28.  
  29. data:
  30.   restit   type ty_restit,
  31.   restit_t type standard table of ty_restit.
  32.  
  33. data:
  34.   salv_table     type ref to cl_salv_table,
  35.   salv_functions type ref to cl_salv_functions,
  36.   salv_columns   type ref to cl_salv_columns_table,
  37.   salv_column    type ref to cl_salv_column_table,
  38.   salv_color     type lvc_s_colo.
  39.  
  40. data:
  41.   s1_datum  type datum,
  42.   s1_arbgb  type arbgb,
  43.   s1_wistat type sww_wistat.
  44.  
  45. initialization.
  46.  
  47.   selection-screen begin of block b1.
  48.  
  49.   parameters
  50.     p1_task type sww_task default 'WS92000002'.
  51.   select-options:
  52.     s1_clas for s1_arbgb default 'ZWFUSR',
  53.     s1_stat for s1_wistat  default 'ERROR',
  54.     s1_date for s1_datum.
  55.  
  56.   selection-screen end of block b1.
  57.  
  58. start-of-selection.
  59.  
  60.   " Selection
  61.   select *
  62.     from swwwihead
  63.     into table wf_header_t
  64.     where wi_rh_task = p1_task
  65.       and wi_cd in s1_date
  66.       and wi_stat in s1_stat.
  67.  
  68.   loop at wf_header_t into wf_header.
  69.     select single wi_id
  70.       from swwwihead
  71.       into wf_id
  72.       where wi_chckwi = wf_header-wi_id.
  73.  
  74.     if sy-subrc <> 0. continue. endif.
  75.  
  76.     select *
  77.       from swwloghist
  78.       appending table wf_log_t
  79.       where wi_id = wf_id
  80.         and workarea in s1_clas
  81.         and workarea <> space.
  82.  
  83.     if sy-subrc eq 0.
  84.       "append wf_log to wf_log_t.
  85.     endif.
  86.   endloop.
  87.  
  88.   " Restitution
  89.   loop at wf_log_t into wf_log.
  90.     restit-wi_id = wf_log-wi_id.
  91.     restit-method = wf_log-method.
  92.     restit-meth_edate = wf_log-meth_edate.
  93.     restit-meth_etime = wf_log-meth_etime.
  94.     restit-log_count = wf_log-log_count.
  95.     restit-meth_user      = wf_log-meth_user.
  96.     restit-workarea = wf_log-workarea.
  97.     restit-msgtype = wf_log-msgtype.
  98.  
  99.     message
  100.       id wf_log-workarea
  101.       type 'I' number wf_log-message
  102.       with wf_log-variable1 wf_log-variable2 wf_log-variable3 wf_log-variable4
  103.       into restit-message.
  104.  
  105.     append restit to restit_t.
  106.   endloop.
  107.  
  108.   call method cl_salv_table=>factory(
  109.     importing
  110.       r_salv_table = salv_table
  111.     changing
  112.       t_table      = restit_t ).
  113.  
  114.   salv_columns = salv_table->get_columns( ).
  115.  
  116.   salv_color-col = 6.
  117.   salv_color-int = 1.
  118.   salv_color-inv = 0.
  119.  
  120.   salv_column ?= salv_columns->get_column( 'MESSAGE' ).
  121.   salv_column->set_long_text( 'Message' ).
  122.   "salv_column->set_color( salv_color ).
  123.   salv_columns->set_optimize( 'X' ).
  124.  
  125.   salv_functions = salv_table->get_functions( ).
  126.  
  127.   salv_functions->set_all( 'X' ).
  128.   salv_table->display( ).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement