basis functions

function z_basis_job_status.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  EXPORTING
*"     VALUE(E_JOB_RUNNING) TYPE  ZBASIS_TT_RUNNING
*"     VALUE(E_JOB_ABORTED) TYPE  ZBASIS_TT_ABORTED
*"     VALUE(E_JOB_ABORTED_SELECT) TYPE  ZBASIS_TT_ABORTED_SELECT
*"     VALUE(E_ACTIVE_USERS) TYPE  ZBASIS_TT_ACTIVE_USERS
*"     VALUE(E_SNAP_BEG) TYPE  ZBASIS_TT_SNAP_BEG
*"     VALUE(E_COUNTER) TYPE  ZBASIS_STRUCTURE
*"----------------------------------------------------------------------
  clear : gv_index.
  clear : e_job_running[], e_job_running, gs_e_job_running.
  clear : e_job_aborted[], e_job_aborted, gs_e_job_aborted.
  clear : e_job_aborted_select[], e_job_aborted_select,
          gs_e_job_aborted_select.
  clear : e_snap_beg[], e_snap_beg, gs_e_snap_beg.
  clear : e_active_users[], e_active_users, gs_e_active_users.

  clear : e_counter, gs_e_counter.
  clear : gv_sayac, gv_sayac_t, gv_sayac_y, gv_sayac_h.
  clear : lv_datum, lv_datum_y.
**********************************************************************
**********************************************************************
* Job statü
  lv_datum = sy-datum - 4.
  lv_datum_y = sy-datum - 1.

  select * from tbtco
           into corresponding fields of table e_job_running
          where status eq 'R'.

  clear : gv_sayac.
  describe table e_job_running lines gv_sayac.
  move gv_sayac to e_counter-e_running.

  select * from tbtco
           into corresponding fields of table e_job_aborted
          where enddate ge lv_datum
            and status eq 'A'.

  clear : gv_sayac.
  describe table e_job_aborted lines gv_sayac.
  move gv_sayac to e_counter-e_aborted.

  clear : gv_sayac_t, gv_sayac_h, gv_sayac_h2.

  if sy-uzeit+0(2) > '00'.
    gv_sayac_h2 = sy-uzeit+0(2) - 01.
    move gv_sayac_h2 to sy-uzeit+0(2).
  else.
    move '000000' to sy-uzeit.
  endif.

  loop at e_job_aborted into gs_e_job_aborted.
    if gs_e_job_aborted-enddate eq lv_datum_y.
      add 1 to gv_sayac_t.
      if gs_e_job_aborted-endtime ge sy-uzeit.
        add 1 to gv_sayac_h.
      endif.
    endif.
  endloop.

  select * from tbtco as a inner join zbasis_job_abort as b
             on b~jobname eq a~jobname
           into corresponding fields of table e_job_aborted_select
          where enddate ge lv_datum
            and status eq 'A'.
**********************************************************************
  move gv_sayac_t to e_counter-e_aborted_t.
  move gv_sayac_h to e_counter-e_aborted_h.
**********************************************************************
**********************************************************************
* ST22
  clear : gv_sayac_t, gv_sayac_y.
  clear : lv_datum.
  lv_datum = sy-datum - 1.

  select * from snap_beg
           into corresponding fields of table e_snap_beg
          where datum ge lv_datum
            and seqno eq '000'.

  loop at e_snap_beg into gs_e_snap_beg.
    if gs_e_snap_beg-datum eq sy-datum.
      add 1 to gv_sayac_t.
    endif.

    if gs_e_snap_beg-datum eq lv_datum.
      add 1 to gv_sayac_y.
    endif.
  endloop.

  move gv_sayac_t to e_counter-e_today.
  move gv_sayac_y to e_counter-e_yesterday.
**********************************************************************
  select * from usr41 as c inner join usr02 as d
             on d~bname eq c~bname
           into corresponding fields of table e_active_users
          where logon_date eq sy-datum.

  clear : gv_sayac_a.
  describe table e_active_users lines gv_sayac_a.
  move gv_sayac_a to e_counter-e_active_user.
endfunction.

No comment

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.