SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Analysis of execution processes



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sun Mar 16, 2008 11:57 pm    Post subject: Analysis of execution processes Reply with quote

Code:
************************************************************************
* TITULO      : Análisis de ejecución de procesos                      *
*                                                                      *
* DESCRIPCION : Versión simplificada del análisis de trabajo en SAP    *
*               (Trans. ST03) que permite fácilmente ver que programas *
*               se han ejecutado en periodos cercanos                  *
*                                                                      *
* AUTOR: Andrés Picazo (http://www.sapabap.cc)  FECHA: 24/05/2002      *
*                                                                      *
************************************************************************
REPORT  rsamon50
      NO STANDARD PAGE HEADING
      MESSAGE-ID v9
      LINE-COUNT 065
      LINE-SIZE 080.

*------TABLAS/ESTRUCTURAS----------------------------------------------*

*------TABLAS INTERNAS-------------------------------------------------*
DATA: BEGIN OF monikeydd,              "Schluessel bei MONI Ex/Import
        systemid(2),                   "Systemnummer
        cpuid(8),                      "Server name
        type(4),                       "Art der Daten
        datum LIKE sy-datum,           "Datum
      END OF monikeydd.

DATA: BEGIN OF sta_per OCCURS 10.
        INCLUDE STRUCTURE statp.
DATA: END OF sta_per.


DATA:  BEGIN OF i_datos OCCURS 0.
        INCLUDE STRUCTURE sapwlustcx.
DATA:  END OF i_datos.

DATA: BEGIN OF i_list OCCURS 0,
        uname  LIKE bpin-uname,
        tcode  LIKE resab-tcode,
        repid  LIKE TSTC-PGMNA,
        JOB    LIKE BTCH2170-JOBNAME,
      END OF i_list.

*------VARIABLES-------------------------------------------------------*

DATA: sta_per_2 LIKE sapwlacctp-startdate.
DATA:  g_instance LIKE sapwlserv-name.
DATA: k_laenge TYPE i.


*------PARAMETER/SELECT-OPTIONS EN PANTALLA----------------------------*
SELECTION-SCREEN BEGIN OF BLOCK blk_par WITH FRAME.
SELECT-OPTIONS: s_uname FOR sy-uname,
                s_repid for sy-repid.
SELECTION-SCREEN END OF BLOCK blk_par.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_list RADIOBUTTON GROUP b1.
SELECTION-SCREEN COMMENT 6(65) FOR FIELD p_list.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: p_deta RADIOBUTTON GROUP b1.
SELECTION-SCREEN COMMENT 6(65) FOR FIELD p_deta.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK a1.
********************************** 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.

*----------------------------------------------------------------------
* START-OF-SELECTION.
*----------------------------------------------------------------------*
START-OF-SELECTION.

  PERFORM seleccionar_datos.

  IF p_deta = 'X'.
    PERFORM alv_write_output TABLES i_datos USING 'I_DATOS'.
  ELSE.
    LOOP AT i_datos.
      CLEAR i_list.
      i_list-uname = i_datos-account.
      IF i_datos-entry_id+72(1) = 'T'.
        i_list-tcode = i_datos-entry_id(20).
        IF i_datos-entry_id(1) = 'Z'.
          SELECT SINGLE PGMNA FROM TSTC
            INTO I_LIST-REPID
           WHERE TCODE = I_LIST-TCODE.
        ENDIF.
      ELSEIF i_datos-entry_id+72(1) = 'R'.
        i_list-repid = i_datos-entry_id(20).
        IF NOT i_datos-entry_id+40(20) IS INITIAL.
          I_LIST-JOB = i_datos-entry_id+40(20).
        ENDIF.
      ENDIF.
      if i_list-repid in s_repid or
         i_list-tcode in s_repid.
        APPEND i_list.
      endif.
    ENDLOOP.
    PERFORM alv_write_output TABLES i_list USING 'I_LIST'.
  ENDIF.

************************************************************************
*
*                  FORMS ADICIONALES
*
************************************************************************

*&---------------------------------------------------------------------*
*&      Form  SELECCIONAR_DATOS
*&---------------------------------------------------------------------*
*       Seleccionar datos y guardarlos en la tabla I_DATOS.
*----------------------------------------------------------------------*
FORM seleccionar_datos.

  IF monikeydd IS INITIAL.

    CALL FUNCTION 'MONI_DATA_PERIOD_DETERMINE'
         IMPORTING
              monikeydd    = monikeydd
              speriod      = sta_per
              instance     = g_instance
         EXCEPTIONS
              no_selection = 1.
    IF NOT sy-subrc IS INITIAL.
      MESSAGE i006.
      LEAVE PROGRAM.
    ENDIF.
  ENDIF.

  IF sta_per-term4 IS INITIAL.
    sta_per_2 = sy-datum.
  ELSE.
    sta_per_2 = sta_per-term4.
  ENDIF.

  CALL FUNCTION 'SAPWL_WORKLOAD_GET_STATISTIC'
       EXPORTING
            periodtype                    = monikeydd-type+2(1)
*         HOSTID                        = MONIKEYDD-CPUID
            startdate                     = sta_per_2
            instance                      = g_instance
       TABLES
*         HITLIST_DBCALLS               =
*         HITLIST_RESPTI                =
*         ACCOUNTING_STATISTIC_TASKTYPE =
*         TIME_STATISTIC                =
*         TABLE_RECORD_STATISTIC        =
            application_statistic         = i_datos
*         FUNCTION_CODE_STATISTIC       =
*         TERMINAL_IO_STATISTIC         =
*         TASKTYPE_STATISTIC            =
*         USER_STATISTIC                =
*         MEMORY_STATISTIC              =
*         RFC_CLIENT_STATISTIC          =
*         RFC_SERVER_STATISTIC          =
*         RFC_CLIENT_DEST_STATISTIC     =
*         INSTANCES                     =
*         RFC_SERVER_DEST_STATISTIC     =
       EXCEPTIONS
            unknown_periodtype            = 1
            no_data_found                 = 2
            OTHERS                        = 3.

  DESCRIBE TABLE i_datos LINES k_laenge.
  IF k_laenge = 0.
    MESSAGE e032.
  ENDIF.

  DELETE i_datos WHERE NOT account IN s_uname.
  SORT i_datos.

ENDFORM.                               " SELECCIONAR_DATOS

*&---------------------------------------------------------------------*
*&      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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Security and Monitoring All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.