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

Статистика по программам, запускаемых пользователем



 
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: 1636

PostPosted: Thu May 29, 2008 4:50 pm    Post subject: Статистика по программам, запускаемых пользователем Reply with quote

Code:
REPORT ZERU_USR_STAT .

INCLUDE ZERU_USR_STAT_TOP.
INCLUDE ZERU_USR_STAT_SSCR.
INCLUDE ZERU_USR_STAT_FORMS.
INCLUDE ZERU_USR_STAT_PAI.
INCLUDE ZERU_USR_STAT_PBO.

START-OF-SELECTION.

  SELECT * FROM USR01 INTO TABLE IT_USR01
        WHERE BNAME IN RUSER.

  LOOP AT IT_USR01.
    CALL FUNCTION 'SAPWL_STATREC_READ_FILE'
     EXPORTING
       NO_OF_RECORDS                     = 9999
*   READ_CLIENT                       =
       READ_END_DATE                     = RENDDAY
       READ_END_TIME                     = RENDTI
*   READ_EXCLUDE_USERNAME             =
*   READ_CONTINUE_RECORDNO            = -1
       READ_START_DATE                   = RDAY
       READ_START_TIME                   = RSTARTTI
       READ_USERNAME                     = IT_USR01-BNAME
       READ_WORKPROCESS                  = 'FFFF'
       READ_FORWARD                      = 'X'
*   STATISTIC_FILE                    =
       NO_BUFFER_FLUSH                   = 'X'
     IMPORTING
       FILE_ERROR                        = FILE_ERROR
       RECORDS_READ                      = RECORDS_READ
       EOF_REACHED                       = EOF_REACHED
*       CONTINUE_RECORDNO_FORWARD         = CONTINUE_RECORDNO_FORWARD
*       CONTINUE_RECORDNO_BACKWARD        = CONTINUE_RECORDNO_BACKWARD
       PROBLEMS                          = 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
*       DB_PROCEDURE_RECORDS              = DB_PROCEDURE_RECORDS
*       ADM_MESSAGE_RECORDS               = ADM_MESSAGE_RECORDS
     EXCEPTIONS
       WRONG_PARAMETER_COMBINATION       = 1
       OTHERS                            = 2
              .
    IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    CHECK NOT V2_NORMAL_RECORDS IS INITIAL.
    DELETE V2_NORMAL_RECORDS WHERE NOT TCODE IN RTCODE.
    DELETE V2_NORMAL_RECORDS WHERE NOT REPORT IN RPROGRAM.
    INSERT LINES OF V2_NORMAL_RECORDS INTO TABLE ITAB.
  ENDLOOP.


  PERFORM ALV_PREPARE.
  CALL SCREEN 100.

END-OF-SELECTION.

----------------------------------------------------------------------


Code:

*----------------------------------------------------------------------*
*   INCLUDE ZERU_USR_STAT_FORMS                                        *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  ALV_PREPARE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM ALV_PREPARE.

  IF GT_LVC_FCAT IS INITIAL.
    PERFORM ALVG_FIELDCAT_CREATE USING 'ITAB' G_REPID_DATA.
    PERFORM ALVG_FCAT_CREATE TABLES ITAB.
  ENDIF."gt_lvc_fcat

  GT_GRIDLAYO-CWIDTH_OPT = 'X'.
  GT_GRIDLAYO-ZEBRA      = 'X'.
  GT_GRIDLAYO-INFO_FNAME = 'COLOR'.
  GT_GRIDLAYO-SEL_MODE = 'D'.

  GS_SORTCAT-FIELDNAME      = 'TCODE'.
  GS_SORTCAT-UP             = 'X'.
  GS_SORTCAT-SUBTOT         = 'X'.
  APPEND GS_SORTCAT TO GT_SORT. CLEAR GS_SORTCAT.

*  GS_SORTCAT-FIELDNAME      = 'MATNRBD'.
*  GS_SORTCAT-UP             = 'X'.
**  GS_SORTCAT-SUBTOT         = 'X'.
*  APPEND GS_SORTCAT TO GT_SORT. CLEAR GS_SORTCAT.

ENDFORM.                    " ALV_PREPARE
*&---------------------------------------------------------------------*
*&      Form  alvg_fieldcat_create
*&---------------------------------------------------------------------*
* ALV-grid fieldcatalog create
*----------------------------------------------------------------------*
*  -->  p_tabname
*  -->  p_inclname
*  -->  gs_outtab
*  <--  gt_lvc_fcat
*----------------------------------------------------------------------*
FORM ALVG_FIELDCAT_CREATE
  USING
    VALUE(P_TABNAME)  TYPE SLIS_TABNAME
    VALUE(P_INCLNAME) TYPE TRDIR-NAME.

  REFRESH GT_LVC_FCAT.
  REFRESH GT_ALV_FIELDCAT.

  CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
       EXPORTING
            I_PROGRAM_NAME         = G_REPID
            I_INTERNAL_TABNAME     = P_TABNAME
            I_INCLNAME             = P_INCLNAME
            I_CLIENT_NEVER_DISPLAY = 'X'
       CHANGING
            CT_FIELDCAT            = GT_ALV_FIELDCAT
       EXCEPTIONS
            INCONSISTENT_INTERFACE = 1
            PROGRAM_ERROR          = 2
            OTHERS                 = 3.

  CHECK SY-SUBRC EQ 0.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  alvg_fcat_create
*&---------------------------------------------------------------------*
* Transfer gt_alv_fieldcat to gt_lvc_fcat
*----------------------------------------------------------------------*
* #ECDK909408
*----------------------------------------------------------------------*
*  -->  t_outtab
*  -->  gt_alv_fieldcat
*  <--  gt_lvc_fcat
*----------------------------------------------------------------------*
FORM ALVG_FCAT_CREATE TABLES T_OUTTAB.

  CALL FUNCTION 'LVC_TRANSFER_FROM_SLIS'
       EXPORTING
            IT_FIELDCAT_ALV = GT_ALV_FIELDCAT
       IMPORTING
            ET_FIELDCAT_LVC = GT_LVC_FCAT
       TABLES
            IT_DATA         = ITAB
       EXCEPTIONS
            IT_DATA_MISSING = 1
            OTHERS          = 2.

  CHECK SY-SUBRC EQ 0.
  LOOP AT GT_LVC_FCAT INTO GS_LVC_FCAT .
    CASE GS_LVC_FCAT-FIELDNAME.
      WHEN 'TCODE'.
*        GS_LVC_FCAT-KEY = 'X'.
*      WHEN OTHERS.
        GS_LVC_FCAT-KEY = 'X'.
      WHEN 'ROLLED_OUT' .
        GS_LVC_FCAT-DO_SUM = 'X'.
    ENDCASE.
    MODIFY GT_LVC_FCAT FROM GS_LVC_FCAT.
  ENDLOOP.

ENDFORM.                    " alvg_fcat_create

----------------------------------------------------------------------


Code:

*----------------------------------------------------------------------*
*   INCLUDE ZERU_USR_STAT_PAI                                          *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  USER_COMMAND_0100  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 INPUT.
  CASE OK_CODE.
    WHEN 'EXIT' OR 'BACK'.
      CALL METHOD G_CUSTOM_CONTAINER->FREE.
      CALL METHOD CL_GUI_CFW=>FLUSH.
      SET SCREEN 0.
      LEAVE SCREEN.
    WHEN OTHERS.
*     do nothing
  ENDCASE.
  CLEAR OK_CODE.

ENDMODULE.                 " USER_COMMAND_0100  INPUT

----------------------------------------------------------------------



Code:

*----------------------------------------------------------------------*
*   INCLUDE ZERU_USR_STAT_PBO                                          *
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0100 OUTPUT.
  SET PF-STATUS 'MAIN'.
*  SET TITLEBAR 'xxx'.
  DATA : LO_REUSE_ALV_GRID  TYPE REF TO ZERUXX_CL_REUSE_ALV_GRID.
  DATA : LO_SPLITTER        TYPE REF TO CL_GUI_SPLITTER_CONTAINER.

  IF G_CUSTOM_CONTAINER IS INITIAL.
    CREATE OBJECT G_CUSTOM_CONTAINER
      EXPORTING CONTAINER_NAME = G_CONTAINER.

    PERFORM TOP_OF_PAGE. "=>gt_top_of_page
    CREATE OBJECT LO_REUSE_ALV_GRID.
    CALL METHOD LO_REUSE_ALV_GRID->CREATE_HTML_HEADER(
      EXPORTING IT_LIST_COMMENTARY  = GT_TOP_OF_PAGE
                IO_PARENT_CONTAINER = G_CUSTOM_CONTAINER
      CHANGING  CO_GRID_CONTAINER   = GO_GUI_CONTAINER ).

    CREATE OBJECT GRID1 EXPORTING I_PARENT = GO_GUI_CONTAINER.

    CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING IS_LAYOUT       = GT_GRIDLAYO
      CHANGING  IT_FIELDCATALOG = GT_LVC_FCAT
                IT_OUTTAB       = ITAB[]
                IT_SORT         = GT_SORT.
  ENDIF.

ENDMODULE.                 " STATUS_0100  OUTPUT
*&---------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM TOP_OF_PAGE.
*  REFRESH GT_TOP_OF_PAGE.
*  CLEAR   GS_TOP_OF_PAGE.
*  GS_TOP_OF_PAGE-TYP   = 'H'.
*  GS_TOP_OF_PAGE-INFO  = TEXT-TIT.
*  APPEND GS_TOP_OF_PAGE TO GT_TOP_OF_PAGE.
*
*  CLEAR   GS_TOP_OF_PAGE.
*  GS_TOP_OF_PAGE-TYP   = 'S'.
*  GS_TOP_OF_PAGE-KEY   = TEXT-WRK.
*  GS_TOP_OF_PAGE-INFO  = PWERKS.
*  APPEND GS_TOP_OF_PAGE TO GT_TOP_OF_PAGE.
*
*  CLEAR   GS_TOP_OF_PAGE.
*  GS_TOP_OF_PAGE-TYP   = 'S'.
*  GS_TOP_OF_PAGE-KEY   = TEXT-DFR.
*  DATE SBUDAT-LOW INTO GS_TOP_OF_PAGE-INFO BY C_POINT.
*  APPEND GS_TOP_OF_PAGE TO GT_TOP_OF_PAGE.
*
*  CLEAR   GS_TOP_OF_PAGE.
*  GS_TOP_OF_PAGE-TYP   = 'S'.
*  GS_TOP_OF_PAGE-KEY   = TEXT-DTO.
*  DATE SBUDAT-HIGH INTO GS_TOP_OF_PAGE-INFO BY C_POINT.
*  APPEND GS_TOP_OF_PAGE TO GT_TOP_OF_PAGE.
ENDFORM.                    " TOP_OF_PAGE

----------------------------------------------------------------------



Code:

*----------------------------------------------------------------------*
*   INCLUDE ZERU_USR_STAT_SSCR                                         *
*----------------------------------------------------------------------*
SELECT-OPTIONS:      RUSER      for SAPWLPFNRM-ACCOUNT
                             default SY-UNAME,      "User
                 RTCODE     for SAPWLPFNRM-TCODE,        "Tcode
                 RPROGRAM   for 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.

PARAMETERS:    RSTARTTI      LIKE SY-UZEIT default '000000' ,
               RDAY          LIKE SY-DATUM default sy-datum,"ab Tag
               RENDTI        LIKE SY-UZEIT default '235959',
               RENDDAY       LIKE SY-DATUM default sy-datum.
SELECTION-SCREEN ULINE.
*PARAMETERS:      RPATH         LIKE SAPWLPSTRC-FILENAME, "Stat.Dateinam
*                 RMAXCNT       TYPE I DEFAULT 200.       "Anzahl

----------------------------------------------------------------------



Code:

*----------------------------------------------------------------------*
*   INCLUDE ZERU_USR_STAT_TOP                                          *
*----------------------------------------------------------------------*
TABLES: STATS_CUML,                    "Ergebnisstruktur Einzelsatz
        STA1,                          "Statistikanzeige Summensatz
        STA2,                          "Statistikanzeige Einzelsatz
        STATL,                         "Selection data single record
*       statr,                         "Rohdaten Statistikeinzelsatz
        STATB,                         "Rohdaten 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.

TYPES: SLIN.

*types: begin of ty_itab,
*
*
*
*       endof ty_itab.

DATA: ITAB LIKE SAPWLPFNRM OCCURS 0
      WITH HEADER LINE.

DATA: IT_USR01 TYPE SORTED TABLE OF USR01
      WITH UNIQUE KEY BNAME
      WITH HEADER LINE.

DATA: V2_NORMAL_RECORDS   LIKE   SAPWLPFNRM OCCURS 0 WITH HEADER LINE,
******* importing
FILE_ERROR          LIKE      SAPWLPSTRC-FILE_ERROR,
RECORDS_READ        LIKE      SAPWLSFIDX-RECORDNO ,
EOF_REACHED         LIKE      SAPWLPSTRC-FLAG     ,
*CONTINUE_RECORDNO_FOLIKE      SAPWLSFIHD-RECORDNO ,
*CONTINUE_RECORDNO_BALIKE      SAPWLSFIHD-RECORDNO ,
PROBLEMS            LIKE      SAPWLPSTRC-COUNTER  .

******* alv
*ALV layout
DATA: OK_CODE LIKE SY-UCOMM,
      G_CONTAINER TYPE SCRFNAME VALUE 'CUSTOM',
      GRID1  TYPE REF TO CL_GUI_ALV_GRID,
      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
      GO_GUI_CONTAINER TYPE REF TO CL_GUI_CONTAINER.

DATA: G_REPID       LIKE SY-REPID VALUE 'ZERU_USR_STAT'.
DATA: G_REPID_DATA  LIKE SY-REPID VALUE 'ZERU_USR_STAT_TOP'.
DATA:
  GS_DISVARI       TYPE DISVARIANT,
  GS_TREEV_HDR     TYPE TREEV_HHDR,

  GS_ALV_FIELDCAT  TYPE SLIS_FIELDCAT_ALV,                  "#EC NEEDED
  GT_ALV_FIELDCAT  TYPE SLIS_T_FIELDCAT_ALV,                "#EC NEEDED
  GS_ALV_LAYOUT    TYPE SLIS_LAYOUT_ALV,
  GS_KEYINFO       TYPE SLIS_KEYINFO_ALV,

  GS_SORTCAT       TYPE SLIS_SORTINFO_ALV, " Sorting Catalog
  GT_SORTCAT       TYPE SLIS_T_SORTINFO_ALV,                "#EC NEEDED

  GS_ALV_FILTER    TYPE SLIS_FILTER_ALV,
  GT_ALV_FILTER    TYPE SLIS_T_FILTER_ALV,

  GS_LVC_FILTER    TYPE LVC_S_FILT,
  GT_LVC_FILTER    TYPE LVC_T_FILT,

  GS_EVENTS        TYPE SLIS_ALV_EVENT,
  GT_EVENTS        TYPE SLIS_T_EVENT,
  GS_EVENT_EXIT    TYPE SLIS_EVENT_EXIT,
  GT_EVENT_EXIT    TYPE SLIS_T_EVENT_EXIT,

  GF_EXIT_BY_CALLER
                   TYPE CHAR1,                              "06.04.2004
  GS_EXIT_BY_USER  TYPE SLIS_EXIT_BY_USER,

  GS_TOP_OF_PAGE   TYPE SLIS_LISTHEADER,
  GT_TOP_OF_PAGE   TYPE SLIS_T_LISTHEADER,

  G_METHOD_EXPORT  TYPE C,

  GS_FCODE_EXCLUDING
                   TYPE SLIS_EXTAB,
  GT_FCODE_EXCLUDING
                   TYPE SLIS_T_EXTAB,

  G_ITEM_NAME      TYPE LVC_FNAME,

  GT_NODES         TYPE LVC_T_NKEY,
  GT_GRIDLAYO TYPE LVC_S_LAYO,
  GS_LVC_FCAT      TYPE LVC_S_FCAT,
  GT_LVC_FCAT      TYPE LVC_T_FCAT,
  GT_SORT TYPE LVC_T_SORT ,
  GS_SORTINFO      TYPE SLIS_SORTINFO_ALV,
  GT_SORTINFO      TYPE SLIS_T_SORTINFO_ALV.

----------------------------------------------------------------------




screen_0100.txt
 Description:

Download
 Filename:  screen_0100.txt
 Filesize:  1.4 KB
 Downloaded:  1245 Time(s)

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.