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 5:09 pm    Post subject: Мониторинг прав пользователей Reply with quote

Code:

REPORT ZBCWATCH NO STANDARD PAGE HEADING LINE-COUNT 65 LINE-SIZE 132.
************************************************************************
* REPORT CHANGES ON CORE MASTER DATA USING A LOG FILE. CHANGES IN THE  *
* AUTHORIZATIONS OF INDIVIDUAL USERS OR WITHIN PROFILES WILL BE        *
* REFLECTED IN THIS REPORT.                                            *
*
*  November 2001, Hans HERR (GIP Consulting)                           *
*  This is a copy of a program from the ELS system adapted for P91 and *
*  P51.                                                                *
*  Original Program: ZWATCHAT                                          *
*           Include: ZIINCL01                                          *
*           Include: ZIINCL03                                          *
*   Functions Added:                                                   *
*           1) List users without a group assignement                  *
*           2) List users with a SAP_ALL profile                       *
*           3) List users not logged on since # of days                *
*           4) List users with a # of error logons since # of days     *
*           5) List of users in a specific group that are locked and   *
*              unlocked. (changed function that existed already)       *
*           6) List of customizing settings changes                    *
*              Submit program rsstat20 for transaction code SCC4       *
*              This report will be printed in a separate spool!!       *
*           7) List of all aborted jobs (SM37)                         *
*           8) List of all incorrect batch input sessions (SM35)       *
*           9) List of all pending update records (SM13)               *
*          10) List of all the clients and the user who last changed   *
*              something for the particular client                     *
************************************************************************
** Hans HERR 04.12.2001          *-- CHG01 --*                         *
*  Added the selection date range in print header                      *
*  changed the printing of the header and "End of report line"         *
************************************************************************
** Andre Rheeder 17.07.2002                                            *
*  Add changes request by D.Morel                                      *
************************************************************************
**Hans HERR Feb-20-2003                                                *
*  Delete all clients from errors on logon test.                       *
*  Change number: HH02                                                 *
************************************************************************
**Hans HERR March-17-2003                                              *
*  Display actual Client settings in SCC4 report                       *
*  Change number: HH03                                                 *
************************************************************************

* Description                          : add transaction statistic

TABLES: USH10, USH12, USR10, USR12, ZEBCWATCH, E070, E07T,
        USR02, USR03, "zebcusrlog,
        STATL, USR06,
        UR100, USH02, USH04, USGRP, UST04, T000, UST10S, SDBAD.
*
RANGES: USERS FOR UR100-USER,
        OBJ_X FOR USR12-OBJCT OCCURS 1,
        AUTH_X FOR USR12-AUTH OCCURS 1.
************************************************************************
**********************  Selection Screen  ******************************
************************************************************************
SELECT-OPTIONS: S_RDATE FOR USR10-MODDA OBLIGATORY
                  DEFAULT SY-DATUM OPTION EQ SIGN I.

DATA: PAR_STATUS           LIKE SY-INDEX.
DATA: PAR_USER_ONLY        LIKE PAR_STATUS VALUE 1.
DATA: PAR_NAME(60).
DATA: TMP_PNAME(60).
DATA: PAR_WERT(60).
DATA: PAR_USER_WERT LIKE PAR_WERT.
DATA: PAR_DEFAULT_WERT LIKE PAR_WERT.
DATA: LAST_PAR_NAME LIKE PAR_NAME.

DATA: BEGIN OF SYS_MEAS OCCURS 0,
        BNAME LIKE USR02-BNAME,
        CLASS LIKE USR02-CLASS,
      END   OF SYS_MEAS.


DATA: BEGIN OF TSM12 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM12.
*
DATA: BEGIN OF TSE38 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSE38.
*
DATA: BEGIN OF TSE16 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSE16.

DATA: BEGIN OF TSM30 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM30.
*
DATA: BEGIN OF TSM31 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM31.
*
DATA: BEGIN OF TSM18 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM18.
*
DATA: BEGIN OF TSM19 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM19.
*
DATA: BEGIN OF TSM36 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM36.
*
DATA: BEGIN OF TSM38 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM38.
*
DATA: BEGIN OF TSM64 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM64.
*
DATA: BEGIN OF TLOCCODE OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TLOCCODE.
*
DATA: BEGIN OF TSM65 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM65.
*
DATA: BEGIN OF TSM01 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM01.
*
DATA: BEGIN OF TSA38 OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSA38.
*
DATA: BEGIN OF TSM36WIZ OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TSM36WIZ.
*
DATA: BEGIN OF TST_CUS OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
        CLASS LIKE USR02-CLASS,
     END OF TST_CUS.
*
DATA: BEGIN OF USR OCCURS 0,
        MANDT LIKE SY-MANDT,
        DATE(8) TYPE D,
        CODE(4) TYPE C,
        ACCOUNT(12) TYPE C,
     END OF USR.

DATA:  BEGIN OF TPROF OCCURS 0,
        PROFN LIKE UST10S-PROFN,
       END OF TPROF.
*
DATA:  BEGIN OF PROF_USD OCCURS 0,
        PROFILE LIKE UST10S-PROFN,
       END OF PROF_USD.
*
DATA:   BEGIN OF PROFILES OCCURS 100.
        INCLUDE STRUCTURE USREF.
DATA:   END OF PROFILES.

DATA: BEGIN OF SEL.
        INCLUDE STRUCTURE SEQG3.
DATA: END OF SEL.

DATA: BEGIN OF ENQ OCCURS 0.
        INCLUDE STRUCTURE SEQG3.
DATA: END OF ENQ.

DATA: BEGIN OF DEL OCCURS 0.
        INCLUDE STRUCTURE SEQG3.
DATA: END OF DEL.

*** Tabelle mit unsubstituierten Werten der Profile_parameter **********
DATA: BEGIN OF PAR_USUB OCCURS 0,
       STATUS LIKE PAR_STATUS,
       PNAME LIKE PAR_NAME,
       USER_WERT LIKE PAR_WERT,
       DEFAULT_WERT LIKE PAR_WERT,
      END OF PAR_USUB.

*** Tabelle mit substituierten Werten der Profile_parameter ************
DATA: BEGIN OF PAR_SUB OCCURS 0,
       STATUS LIKE PAR_STATUS,
       PNAME LIKE PAR_NAME,
       USER_WERT LIKE PAR_WERT,
       DEFAULT_WERT LIKE PAR_WERT,
      END OF PAR_SUB.

DATA: BEGIN OF T_RSPARAM OCCURS 0.
        INCLUDE STRUCTURE ZEBCWATCH.
DATA: END OF T_RSPARAM.
***************
*** BLOCK 1 ***
***************
SELECTION-SCREEN: BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-016.
*
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) TEXT-030.
PARAMETER     P_PROF AS CHECKBOX DEFAULT ''.
SELECTION-SCREEN END   OF LINE.
*
SELECT-OPTIONS: S_PROFN FOR USH10-PROFN,
                S_MODBE FOR USH12-MODBE.
*
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(31) TEXT-024.
PARAMETER       P_PAGE AS CHECKBOX.
SELECTION-SCREEN END   OF LINE.
*
SELECTION-SCREEN: END OF BLOCK B1.
*
***************
*** BLOCK 3 ***
***************
SELECTION-SCREEN: BEGIN OF BLOCK B3 WITH FRAME TITLE TEXT-026.
*
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:     AUTHORIT AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 4(28) TEXT-B01.
PARAMETERS:     PASSFLAG AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 35(22) TEXT-B02.
PARAMETERS:     DEL_USR  AS CHECKBOX DEFAULT 'X'.
*
SELECTION-SCREEN: COMMENT 60(13) TEXT-B09.
SELECTION-SCREEN END   OF LINE.
*
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:     PASS_CHG AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 4(28) TEXT-B03.
PARAMETERS:     DEQ_ADM AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 35(22) TEXT-B04.
PARAMETERS:     PRF_USR  AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 60(13) TEXT-B13.
SELECTION-SCREEN END   OF LINE.
*
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:     DEQ_LOG AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 4(28) TEXT-B05.
PARAMETERS:     ENQ_ADM AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 35(22) TEXT-B06.
PARAMETERS:     RS_PAR   AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 60(7) TEXT-B14.
SELECTION-SCREEN END   OF LINE.
*
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:     ENQ_LOG AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 4(28) TEXT-B07.
PARAMETERS:     ADD_USR AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 35(22) TEXT-B08.
PARAMETERS:     TR_REQ   AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 60(14) TEXT-B15.
SELECTION-SCREEN END   OF LINE.
*
SELECTION-SCREEN: END OF BLOCK B3.
*
***************
*** BLOCK 4 ***
***************
SELECTION-SCREEN: BEGIN OF BLOCK B4 WITH FRAME TITLE TEXT-031.
*
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:       LST_CUS AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 4(28) TEXT-B10.
*
PARAMETERS:       USR_GRP AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 35(22) TEXT-B11.
*
PARAMETERS:       SAP_ALL AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 60(18) TEXT-B12.
SELECTION-SCREEN END   OF LINE.
*
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:       SM12 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 3(5) TEXT-041.
PARAMETERS:       SM13 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 11(5) TEXT-035.
PARAMETERS:       SM37 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 19(5) TEXT-036.
PARAMETERS:       SM35 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 27(5) TEXT-038.
PARAMETERS:       SCC4 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 35(5) TEXT-040.
PARAMETERS:       DB12 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 43(14) TEXT-044.
PARAMETERS:       USMM AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 60(18) TEXT-043.
*
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: ULINE.
*
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS:       NOT_LOG AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 3(35) TEXT-039.
PARAMETERS:       NUM_DAYS LIKE SY-FDAYW DEFAULT '90'.
SELECTION-SCREEN: COMMENT 45(5) TEXT-032.
SELECTION-SCREEN: END   OF LINE.
*
SELECTION-SCREEN: ULINE.

SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS:       ERR_LOG AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 3(35) TEXT-042.
*parameters:       num_log like sy-fdayw default '7'.
*selection-screen: comment 45(15) text-033.
*parameters:       snc_day like sy-fdayw  visible length 3 default '5'.
*selection-screen: comment 68(5) text-032.
SELECTION-SCREEN: END   OF LINE.
*
SELECTION-SCREEN: ULINE.
*
SELECTION-SCREEN: BEGIN OF LINE.
PARAMETERS:       USR_LCK AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN: COMMENT 4(46) TEXT-034.
SELECTION-SCREEN: END   OF LINE.
*
SELECT-OPTIONS    USR_CLS FOR USGRP-USERGROUP.

SELECTION-SCREEN: ULINE.
PARAMETERS:       SHW_BEF RADIOBUTTON GROUP RAD1 DEFAULT 'X'.
PARAMETERS:       PRT_DIR RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN: END OF BLOCK B4.
************************************************************************
*****************  end  Selection Screen  ******************************
************************************************************************
*
DATA: L_VAL(1) TYPE C,
      L_PRIPAR LIKE PRI_PARAMS,
      L_ARCPAR LIKE ARC_PARAMS.
*
DATA: BEGIN OF ITAB_P OCCURS 0,        "profile changes
         PROFN LIKE USH10-PROFN,
         MODDA LIKE USH10-MODDA,
         MODTI LIKE USH10-MODTI,
         MODBE LIKE USH10-MODBE,
         AUTHS(1),                  "Huge field; only first byte needed
      END OF ITAB_P.
*
DATA: BEGIN OF ITAB_A OCCURS 0,        " Authorizations Changed
         AUTH  LIKE USH12-AUTH,
         OBJCT LIKE USH12-OBJCT,
         PROFN LIKE UST10S-PROFN,
      END OF ITAB_A.
*
DATA: BEGIN OF I_T000 OCCURS 0.        " Changes on Customizing
        INCLUDE STRUCTURE T000.
DATA: END OF I_T000.
*
DATA: BEGIN OF I_TBTCO OCCURS 0.       " Aborted jobs SM37
        INCLUDE STRUCTURE TBTCO.
DATA: END OF I_TBTCO.
*
DATA: BEGIN OF I_VBHDR OCCURS 0.       " Hanging Updates SM13
        INCLUDE STRUCTURE VBHDR.
DATA: END OF I_VBHDR.
*
DATA: BEGIN OF I_APQI OCCURS 0.        " Error in batch sesssions SM35
        INCLUDE STRUCTURE APQI.
DATA: END OF I_APQI.
*
DATA: BEGIN OF ITAB1 OCCURS 50.        " User changes in period
        INCLUDE STRUCTURE USH02.
DATA: END   OF ITAB1.

DATA: BEGIN OF ITAB2 OCCURS 50.        " Prior changes for one user
        INCLUDE STRUCTURE USH02.
DATA: END   OF ITAB2.
*
DATA: BEGIN OF ITAB3 OCCURS 50,        " Password changes in period
        BNAME LIKE USH02-BNAME,        "   for one user
        MODDA LIKE USH02-MODDA,
        MODTI LIKE USH02-MODTI,
        MODBE LIKE USH02-MODBE,
        CLASS LIKE USR02-CLASS,        " Class of user who changed PSW
      END   OF ITAB3,

      BEGIN OF ITAB4 OCCURS 10,        " Creations/Deletions of one user
        BNAME LIKE USH04-BNAME,
        MODDA LIKE USH04-MODDA,
        MODTI LIKE USH04-MODTI,
        NRPRO LIKE USH04-NRPRO,
        PROFS,
      END   OF ITAB4.
*
DATA:  BEGIN OF ITAB5 OCCURS 10.       " Users with SAP_ALL profil
        INCLUDE STRUCTURE UST04.
DATA:   TRDAT LIKE USR02-TRDAT,
       END   OF ITAB5.
*
DATA:  BEGIN OF ITAB6 OCCURS 10,     " Users without a group assignement
        BNAME LIKE USR02-BNAME,
       END   OF ITAB6.
*
DATA:  BEGIN OF ITAB7 OCCURS 10,       " Users not logged in sinc # Days
        BNAME LIKE USR02-BNAME,
        TRDAT LIKE USR02-TRDAT,        " Last login date
       END   OF ITAB7.
*
DATA:  BEGIN OF ITAB9 OCCURS 10,
        TRKORR LIKE E070-TRKORR,
        AS4USER LIKE E070-AS4USER,
        AS4DATE LIKE E070-AS4DATE,
        AS4TEXT LIKE E07T-AS4TEXT,
       END   OF ITAB9.
*
DATA:  BEGIN OF ITAB8 OCCURS 10,     " Users not with errors durin logon
        BNAME LIKE USR02-BNAME,
        LOCNT LIKE USR02-LOCNT,        "Number of errors
       END   OF ITAB8.
*
DATA: BEGIN OF BACKUP_TAB OCCURS 300.
        include structure sdbah.
data: end of backup_tab.

data: begin of last_full_backup.
        include structure sdbah.
data: end of last_full_backup.

data: begin of last_succ_backup.
        include structure sdbah.
data: end of last_succ_backup.

DATA:  BEGIN OF BL OCCURS 10,
        BR_VERS,
        FILE_ID(4),
        TS_NAME(30),
        TS_STATUS(1),
        DBF_STATUS(1),
        REDO_NR(6),
        TIME_END(14),
        VOLUME(10),
        FILE_POS(4),
        COMPR_RATE(8),
        BACKUP_ID(16),
        DBF_NAME(128),
      END OF BL.

DATA:  HEAD_TAB(250).
DATA:  L_SAPALL LIKE SY-INDEX.
DATA:  L_USRGRP LIKE SY-INDEX.
DATA:  L_NOTLOG LIKE SY-INDEX.
DATA:  L_TR_LST LIKE SY-INDEX.
DATA:  L_ERRLOG LIKE SY-INDEX.
DATA:  SAPALL(1)  TYPE C.
DATA:  USRGRP(1)  TYPE C.
DATA:  SYMEAS(1)  TYPE C.
DATA:  NOTLOG(1)  TYPE C.
DATA:  TRNLST(1)  TYPE C.
DATA:  ERRLOG(1)  TYPE C.
DATA:  T_SM35(1) TYPE C.
DATA:  T_PROF(1) TYPE C.
DATA:  T_SM37(1) TYPE C.
DATA:  T_SM13(1) TYPE C.
DATA:  T_SM12(1) TYPE C.
DATA:  T_SE38(1) TYPE C.
DATA:  T_SE16(1) TYPE C.
DATA:  T_SM30(1) TYPE C.
DATA:  T_CUS(1) TYPE C.
DATA:  T_PARAM(1) TYPE C.
DATA:  T_SM31(1) TYPE C.
DATA:  T_SM18(1) TYPE C.
DATA:  T_SM19(1) TYPE C.
DATA:  T_SM36(1) TYPE C.
DATA:  T_SM36WIZ(1) TYPE C.
DATA:  T_SA38(1) TYPE C.
DATA:  T_SM38(1) TYPE C.
DATA:  T_SM64(1) TYPE C.
DATA:  T_SM65(1) TYPE C.
DATA:  T_SM01(1) TYPE C.
DATA:  T_TST_CUS(1) TYPE C.
DATA:  T_SCC4(1) TYPE C.
DATA:  DATE1 LIKE SY-DATUM.
DATA:  DATE2 LIKE SY-DATUM.
DATA:  TABCNT LIKE SY-DBCNT.
DATA:  WORKDATE LIKE SY-DATUM.
DATA:  WORKTIME LIKE SY-UZEIT.
DATA: UNSUCC_DATETIME(20),
      RC(4),
      SUCC_DATETIME(20).

FIELD-SYMBOLS: <PROF>.
*
DATA:   VONDATUM LIKE SY-DATUM,
        BISDATUM LIKE SY-DATUM,
        V_PROF(10) TYPE C,
        HOLD_PAGNO LIKE SYST-PAGNO,
        HOLD_LINNO LIKE SYST-LINNO,
        NEW_LINNO  LIKE SYST-LINNO,
        NUM_SEL_A  TYPE I VALUE 0,
        NUM_SEL_L  TYPE I VALUE 0,
        NUM_SEL_PW TYPE I VALUE 0,
        NUM_SEL_P  TYPE I VALUE 0,
        LIN_P      TYPE I VALUE 0,
        ALL_FLAG VALUE ' ',
        HOLD_UFLAG LIKE USH02-UFLAG,
        HOLD_BCODE LIKE USH02-BCODE,
        SPACER(21) TYPE C,             " To color right end of lines
        LOCK TYPE C,
        OTHER TYPE C,
        PASSWORD TYPE C,
        LOGGED TYPE C,
        PROFILE TYPE C.
*
DATA:   YULOCK       TYPE X VALUE '80',
        YUSLOC       TYPE X VALUE '40'.
DATA:   TITLE(100)   TYPE C.
* START OF INSERTION *-- CHG01 --*
DATA:   W_TITLE(100) TYPE C.
DATA:   W_DAT1(12)   TYPE C.
DATA:   W_DAT2(12)   TYPE C.
* END   OF INSERTION *-- CHG01 --*
DATA:   OUT_DATE(15) TYPE C.
DATA:   W_TEST(10)   TYPE C.
*
AT SELECTION-SCREEN OUTPUT.
*initialization.
************************************************************************
***************** Main processing section ******************************
************************************************************************


AUTHORITY-CHECK OBJECT 'S_TCODE'
           ID 'TCD' FIELD sy-tcode.
  IF sy-subrc NE 0.
    MESSAGE e003(zgxxu_gen) WITH sy-tcode   .
  ENDIF.


START-OF-SELECTION.
  IF PRT_DIR = 'X'.
    PERFORM RPT_PRINT.
  ENDIF.

  IF NOT_LOG = 'X' AND NUM_DAYS IS INITIAL.
    NUM_DAYS = '90'.
  ENDIF.
*
  MOVE S_RDATE-LOW TO VONDATUM.
  IF NOT S_RDATE-HIGH IS INITIAL.
    MOVE S_RDATE-HIGH TO BISDATUM.
  ELSE.
    MOVE: S_RDATE-LOW TO BISDATUM,
          S_RDATE-LOW TO S_RDATE-HIGH.
  ENDIF.

**  Display profile changes
  IF P_PROF EQ 'X'.
    PERFORM GET-PROFILE-CHANGES.
    IF LIN_P = 0.
      WRITE: /31 '****** NO RECORDS EXIST FOR PROFILES ******'(003).
    ENDIF.
  ENDIF.

** Printing users LOCKED/UNLOCKED and PASSWORD changes
  IF USR_LCK = 'X'.
    PERFORM GET_LOCK_CHANGES.
    PERFORM WRITE_PW_CHANGES.
  ENDIF.
  CONCATENATE AUTHORIT
              PASSFLAG
              DEL_USR
              PASS_CHG
              DEQ_ADM
              DEQ_LOG
              ENQ_ADM
              ENQ_LOG
              ADD_USR INTO W_TEST.
  IF W_TEST <> ''.
    PERFORM GET_OTHER_USER_CHANGES.
  ENDIF.

** Printing users with SAP_ALL profile
  IF SAP_ALL = 'X'.
    PERFORM FIND_SAP_ALL.
    IF L_SAPALL > 0.
      PERFORM PRINT_SAP_ALL.
    ENDIF.
  ENDIF.

** Printing users without a group assignment
  IF USR_GRP = 'X'.
    PERFORM FIND_USR_GRP.
    IF L_USRGRP > 0.
      PERFORM PRINT_USR_GRP.
    ELSE.
      PERFORM PRINT_ALL_USR_GRP.
    ENDIF.
  ENDIF.

** Transport request imported by date range .
  IF TR_REQ = 'X'.
    PERFORM FIND_TRANSPORT_LIST.
    IF L_TR_LST > 0.
      PERFORM PRINT_TRANSPORT_LIST.
    ENDIF.
  ENDIF.

** Profiles not used.
  IF PRF_USR = 'X'.
    PERFORM FIND_PRF_NOT_USED.
    PERFORM PRINT_ALL_PROFILES.
  ENDIF.

** Printing users that haven't been logged on since 'X' Days
  IF NOT_LOG = 'X'.
    PERFORM FIND_NOT_LOG.
    IF L_NOTLOG > 0.
      PERFORM PRINT_NOT_LOG.
    ENDIF.
  ENDIF.

** Printing users who had errors during logon
  IF ERR_LOG = 'X'.
*   perform maintain_err_log.
    PERFORM FIND_ERR_LOG.
*   perform print_err_log.
  ENDIF.

** Transaction SM12 **
  IF SM12 = 'X'.
    PERFORM SELECT_SM12.
    PERFORM PRINT_SM12.
  ENDIF.

** Transaction SM13 **
  IF SM13 = 'X'.
    SELECT *  INTO I_VBHDR FROM VBHDR.
      APPEND I_VBHDR.
    ENDSELECT.
    PERFORM PRINT_SM13.
  ENDIF.

** Transaction SM37 **
  IF SM37 = 'X'.
    SELECT *  INTO I_TBTCO FROM TBTCO
           WHERE STATUS = 'A' AND      "Aborted
                 ENDDATE IN S_RDATE.
      APPEND I_TBTCO.
    ENDSELECT.
    PERFORM PRINT_SM37.
  ENDIF.

** Transaction RSPARAM.
  IF RS_PAR = 'X'.
    CALL 'C_SAPGALLPARAM' ID 'PAR_USUB' FIELD PAR_USUB-*SYS*
                          ID 'PAR_SUB'  FIELD PAR_SUB-*SYS*.

    PERFORM PRINT_RSPARAM.
  ENDIF.

** Transaction SM35 **
  IF SM35 = 'X'.
    SELECT *  INTO I_APQI FROM APQI
           WHERE QSTATE = 'E'
             AND CREDATE IN S_RDATE.
      APPEND I_APQI.
    ENDSELECT.
    PERFORM PRINT_SM35.
  ENDIF.

** Transaction SCC4 **
  IF SCC4 = 'X'.
    SELECT *  INTO I_T000 FROM T000.
      APPEND I_T000.
    ENDSELECT.
    PERFORM PRINT_SCC4.

** Transaction SE38 **
    PERFORM FILL_STATL USING 'SE38'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SE38.
    PERFORM PRINT_SE38.

** Transaction SE16 **
    PERFORM FILL_STATL USING 'SE16'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SE16.
    PERFORM PRINT_SE16.

** Transaction SM30 **
    PERFORM FILL_STATL USING 'SM30'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM30.
    PERFORM PRINT_SM30.

** Transaction SM31 **
    PERFORM FILL_STATL USING 'SM31'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM31.
    PERFORM PRINT_SM31.

** Transaction SM18 **
    PERFORM FILL_STATL USING 'SM18'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM18.
    PERFORM PRINT_SM18.

** Transaction SM19 **
    PERFORM FILL_STATL USING 'SM19'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM19.
    PERFORM PRINT_SM19.

** Transaction SM36 **
    PERFORM FILL_STATL USING 'SM36'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM36.
    PERFORM PRINT_SM36.

** Transaction SM36WIZ **
    PERFORM FILL_STATL USING 'SM36WIZ'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM36WIZ.
    PERFORM PRINT_SM36WIZ.

** Transaction SA38 **
    PERFORM FILL_STATL USING 'SA38'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SA38.
    PERFORM PRINT_SA38.

** Transaction SM38 **
    PERFORM FILL_STATL USING 'SM38'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM38.
    PERFORM PRINT_SM38.

** Transaction SM64 **
    PERFORM FILL_STATL USING 'SM64'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM64.
    PERFORM PRINT_SM64.

** Transaction SM65 **
    PERFORM FILL_STATL USING 'SM65'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM65.
    PERFORM PRINT_SM65.

** Transaction SM01 **
    PERFORM FILL_STATL USING 'SM01'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_SM01.
    PERFORM PRINT_SM01.

***************************************
  ENDIF.
** Transaction SCC4 **
  IF LST_CUS = 'X' AND PRT_DIR = ' '.
    PERFORM FILL_STATL USING 'SCC4'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT zeru_sstat20 AND RETURN.
    IMPORT USR FROM MEMORY ID 'AUDIT_REP'.
    PERFORM MOVE_LST_CUS.
    PERFORM PRINT_TST_CUS.
  ENDIF.

** Transaction USMM **
  IF USMM = 'X'.
    SELECT *
           FROM USR02.

      SELECT SINGLE *
             FROM USR06
             WHERE BNAME = USR02-BNAME.

      IF SY-SUBRC <> 0.
        SYS_MEAS-BNAME = USR02-BNAME.
        SYS_MEAS-CLASS = USR02-CLASS.

        APPEND SYS_MEAS.
        CLEAR  SYS_MEAS.
      ENDIF.
    ENDSELECT.
    PERFORM PRINT_USMM.
  ENDIF.

** Transaction DB12 **
  IF DB12 = 'X'.

    PERFORM SELECT_BACKUP_ACTIVITIES.
*** print complete list.
    PERFORM PRINT_BACKUP.
  ENDIF.

  SKIP 2.
  WRITE: /54 TEXT-023, SY-REPID(10), '***'.

** Printing users who changed the custo via transaction SCC4.
** This 'SUBMIT' has to be the last print session while it creates
** another spool. When coming back to this program no printing is
** possible anymore.
  IF LST_CUS = 'X' AND PRT_DIR = 'X'.
    PERFORM FILL_STATL USING 'SCC4'.
    EXPORT STATL TO MEMORY ID 'RSSTAT20_STATL'.
    SUBMIT RSSTAT20 TO SAP-SPOOL
           SPOOL PARAMETERS L_PRIPAR
           WITHOUT SPOOL DYNPRO.
  ENDIF.
*
END-OF-SELECTION.

************************************************************************
* FROM GET-PROFILE-CHANGES
*-----------------------------------------------------------------------
* SHOWS ALL AUTHORIZATION CHANGES BY PROFILE
************************************************************************
FORM GET-PROFILE-CHANGES.
  IF S_PROFN IS INITIAL.               " No specific profiles entered
    SELECT PROFN MODDA MODTI MODBE AUTHS FROM USR10
      INTO TABLE ITAB_P   WHERE AKTPS EQ 'A'
                            AND MODDA IN S_RDATE
                            AND MODBE IN S_MODBE.
    SELECT PROFN MODDA MODTI MODBE AUTHS FROM USH10
      INTO CORRESPONDING FIELDS OF ITAB_P
                          WHERE AKTPS EQ 'A'
                            AND MODDA IN S_RDATE
                            AND MODBE IN S_MODBE.
      COLLECT ITAB_P.
    ENDSELECT.

    DESCRIBE TABLE ITAB_P LINES LIN_P.
    CHECK LIN_P > 0.

    SORT ITAB_P BY PROFN MODDA MODBE AUTHS ASCENDING MODTI DESCENDING.
    DELETE ADJACENT DUPLICATES FROM ITAB_P
      COMPARING PROFN MODDA MODBE AUTHS.

    SELECT AUTH OBJCT FROM USR12
           INTO TABLE ITAB_A  WHERE AKTPS = 'A'
                                AND MODDA IN S_RDATE
                                AND MODBE IN S_MODBE.
    SELECT AUTH OBJCT FROM USH12
           INTO CORRESPONDING FIELDS OF ITAB_A
                              WHERE AKTPS = 'A'
                                AND MODDA IN S_RDATE
                                AND MODBE IN S_MODBE.
      COLLECT ITAB_A.
    ENDSELECT.

  ELSE.                                " Specific profiles entered
    SELECT PROFN MODDA MODTI MODBE AUTHS FROM USR10
      INTO TABLE ITAB_P   WHERE PROFN IN S_PROFN
                            AND AKTPS EQ 'A'
                            AND MODDA IN S_RDATE
                            AND MODBE IN S_MODBE.

    SELECT PROFN MODDA MODTI MODBE AUTHS FROM USH10
      INTO CORRESPONDING FIELDS OF ITAB_P
                          WHERE PROFN IN S_PROFN
                            AND AKTPS EQ 'A'
                            AND MODDA IN S_RDATE
                            AND MODBE IN S_MODBE.
      COLLECT ITAB_P.
    ENDSELECT.
    DESCRIBE TABLE ITAB_P LINES LIN_P.
    CHECK LIN_P > 0.

    SORT ITAB_P BY PROFN MODDA MODBE AUTHS ASCENDING MODTI DESCENDING.
    DELETE ADJACENT DUPLICATES FROM ITAB_P
      COMPARING PROFN MODDA MODBE AUTHS.

    LOOP AT ITAB_P.
      SELECT AUTH OBJCT FROM USR12
             INTO CORRESPONDING FIELDS OF ITAB_A
                                        WHERE AKTPS = 'A'
                                          AND MODDA IN S_RDATE
                                          AND MODBE IN S_MODBE.
        CHECK ITAB_A-AUTH(10) = ITAB_P-PROFN.
        APPEND ITAB_A.
      ENDSELECT.
      SELECT AUTH OBJCT FROM USH12
             INTO CORRESPONDING FIELDS OF ITAB_A
                                        WHERE AKTPS = 'A'
                                          AND MODDA IN S_RDATE
                                          AND MODBE IN S_MODBE.
        CHECK ITAB_A-AUTH(10) = ITAB_P-PROFN.
        COLLECT ITAB_A.
      ENDSELECT.
    ENDLOOP.
  ENDIF.

* Add profile name to each line of table
  LOOP AT ITAB_A.
    MOVE ITAB_A-AUTH(10) TO ITAB_A-PROFN.
    MODIFY ITAB_A.
  ENDLOOP.

  PROFILE = 'X'.                       " PROFILE header information
  SORT ITAB_P BY PROFN MODDA MODTI.
  LOOP AT ITAB_P.
    AT NEW PROFN.
      IF P_PAGE EQ 'X'.                " New page at each new profile
        NEW-PAGE.
      ELSE.
        RESERVE 5 LINES.
      ENDIF.
      ULINE /(80).
      WRITE /(80) SPACE COLOR COL_HEADING INTENSIFIED.
      WRITE 1 SY-VLINE.
      WRITE 3  'PROFILE'(022) COLOR COL_KEY INTENSIFIED.
      WRITE 18 'Changed by'(004)
                COLOR COL_HEADING INTENSIFIED.
      WRITE 38 'on'(020) COLOR COL_HEADING INTENSIFIED.
      WRITE 49 'at'(021) COLOR COL_HEADING INTENSIFIED.
      WRITE 80 SY-VLINE.
    ENDAT.
    WRITE /(80) SPACE COLOR 4 INTENSIFIED OFF.
    WRITE 1 SY-VLINE.
    WRITE: 3 ITAB_P-PROFN COLOR COL_KEY INTENSIFIED.
    WRITE: 18 ITAB_P-MODBE COLOR 4 INTENSIFIED OFF.
    WRITE: 38 ITAB_P-MODDA COLOR 4 INTENSIFIED OFF.
    WRITE: 49 ITAB_P-MODTI COLOR 4 INTENSIFIED OFF.

    IF ITAB_P-AUTHS EQ 'M'.
      ASSIGN 'MODIFIED'(005) TO <PROF>.
    ELSEIF ITAB_P-AUTHS EQ 'D'.
      ASSIGN 'DELETED'(006) TO <PROF>.
    ELSEIF ITAB_P-AUTHS EQ 'C'.
      ASSIGN 'CREATED'(007) TO <PROF>.
    ENDIF.

    MOVE <PROF> TO V_PROF.

    WRITE 65 V_PROF COLOR 4 INTENSIFIED OFF.
    WRITE 80 SY-VLINE.
    ULINE /(123).
    WRITE /(122) SPACE COLOR COL_HEADING INTENSIFIED.
    WRITE 1 SY-VLINE.
    WRITE 3  '*** Deleted entries ***'(013)
              COLOR COL_HEADING INTENSIFIED.
    WRITE 62 SY-VLINE.
    WRITE 64 '*** Created entries ***'(014)
              COLOR COL_HEADING INTENSIFIED.
    WRITE 123 SY-VLINE.
    ULINE /(123).

    ADD 1 TO NUM_SEL_P.
    PERFORM GET-AUTH-CHANGES.
  ENDLOOP.

  IF NUM_SEL_P EQ 0.
    WRITE: /31 '****** NO RECORDS EXIST FOR PROFILES ******'(003).
  ENDIF.
  CLEAR PROFILE.

ENDFORM.                               " GET-PROFILE-CHANGES
************************************************************************
* FROM GET-AUTH-CHANGES
*-----------------------------------------------------------------------
* SHOWS ALL INDIVIDUAL AUTHORIZATION CHANGES FOR ONE PROFILE
************************************************************************
FORM GET-AUTH-CHANGES.
  REFRESH: OBJ_X, AUTH_X.
  OBJ_X-SIGN = 'I'.
  OBJ_X-OPTION = 'EQ'.
  AUTH_X-SIGN = 'I'.
  AUTH_X-OPTION = 'EQ'.
  HOLD_PAGNO = SY-PAGNO.               " Save page and line numbers
  HOLD_LINNO = SY-LINNO.

  LOOP AT ITAB_A WHERE PROFN = ITAB_P-PROFN.
    OBJ_X-LOW    = ITAB_A-OBJCT.
    APPEND OBJ_X.
    AUTH_X-LOW    = ITAB_A-AUTH.
    APPEND AUTH_X.
    PERFORM PRINT_AUTH_CHANGES.
    REFRESH: OBJ_X, AUTH_X.
  ENDLOOP.

* If we haven't written any lines, then there are no auth changes for
* this profile.  Back up 5 lines in preparation for the next one.
  IF SY-PAGNO = HOLD_PAGNO AND SY-LINNO = HOLD_LINNO.
    NEW_LINNO = SY-LINNO - 5.
    SKIP TO LINE NEW_LINNO.
  ELSE.
    ADD 1 TO NUM_SEL_A.
  ENDIF.

ENDFORM.                               " GET-AUTH-CHANGES
*&---------------------------------------------------------------------*
*&      Form  PRINT_AUTH_CHANGES                      MIM 05/17/00
*&---------------------------------------------------------------------*
*   Call function module to print authorization changes                *
*----------------------------------------------------------------------*
FORM PRINT_AUTH_CHANGES.
  CALL FUNCTION 'SHOW_AUTH_HISTORY'
       EXPORTING
            SCHEINMODIFIKATIONEN = SPACE
            VON_DATUM            = VONDATUM
            BIS_DATUM            = BISDATUM
            NAVIGATION           = 'X'
       TABLES
            OBJ_TABLE            = OBJ_X
            AUTH_TABLE           = AUTH_X.

ENDFORM.                               " PRINT_AUTH_CHANGES
*&---------------------------------------------------------------------*
*&      Form  GET_LOCK_CHANGES
*&---------------------------------------------------------------------*
*  This is used to show user locking and unlocking over a given time   *
*  period.  It also captures password changes.  Normally, the period   *
*  being used is the previous day.                                     *
*----------------------------------------------------------------------*
FORM GET_LOCK_CHANGES.
  LOCK = 'X'.
  CLEAR NUM_SEL_L.
  NEW-PAGE.
* Get all changes for users and period selected.  Save them in itab1.
* select * from ush02 into table itab1
*            where bname in users
*              and class in usr_cls
*              and modda between vondatum and bisdatum.

  SELECT * FROM USH02
         INTO USH02
             WHERE BNAME IN USERS
               AND CLASS IN USR_CLS
               AND MODDA BETWEEN VONDATUM AND BISDATUM.

    MOVE-CORRESPONDING USH02 TO ITAB1.

    SELECT SINGLE BNAME CLASS
           FROM USR02
           INTO (USR02-BNAME, USR02-CLASS)
           WHERE BNAME = ITAB1-MODBE.

    IF SY-SUBRC = 0.
      ITAB1-CLASS = USR02-CLASS.
    ENDIF.
    APPEND ITAB1.
    CLEAR  ITAB1.
  ENDSELECT.

  FORMAT COLOR COL_KEY INTENSIFIED.
  LOOP AT ITAB1.
    CLEAR ITAB2.                       " Initialize itab2
    REFRESH ITAB2.                                          "
*   For one user, get all changes prior to current one.  Save them
*   in itab2.
    SELECT * FROM USH02
               WHERE BNAME EQ ITAB1-BNAME
                 AND MODDA LE ITAB1-MODDA.
      IF USH02-MODDA EQ ITAB1-MODDA.
        CHECK USH02-MODTI LT ITAB1-MODTI.
      ENDIF.
      MOVE-CORRESPONDING USH02 TO ITAB2.
      APPEND ITAB2.
    ENDSELECT.

    LOOP AT ITAB2.                     " Get to last record of itab2
    ENDLOOP.

*   Capture last locking status prior to current record.
    HOLD_UFLAG = ITAB2-UFLAG.
*   Capture last password prior to current record.  This logic is
*   complex because we want to skip the initial password generated
*   when a user is first created, and when a user is recreated after
*   being deleted.
    IF NOT ITAB2-BCODE IS INITIAL.     " User existed already
      PERFORM CHECK_FOR_DELETED_USER.
      IF ( ITAB4-NRPRO = 1 AND
           ITAB4-PROFS = 'D' ).        " User was Deleted
        HOLD_BCODE = ITAB1-BCODE.      " Store current password
      ELSE.
        HOLD_BCODE = ITAB2-BCODE.      " Store prior password
      ENDIF.
    ELSE.
      HOLD_BCODE = ITAB1-BCODE.        " Store current password
    ENDIF.

    IF ITAB1-UFLAG NE HOLD_UFLAG.      " Locking status has changed
      CASE ITAB1-UFLAG.
        WHEN 0.
* Check the transaction that was used to make the change.
          CHECK ITAB1-TCODE(2) = 'SU'.
          ADD 1 TO NUM_SEL_L.          " Status was changed to UNLOCKED
          WRITE:/15 'User'(018), ' ', ITAB1-BNAME, 'UNLOCKED by '(017),
                 ITAB1-MODBE, ' ', 'in Group ', ITAB1-CLASS,
                                   'on'(020), ' ', ITAB1-MODDA,
                 ' ', 'at'(021), ' ', ITAB1-MODTI, SPACER.
        WHEN OTHERS.                   " Status was changed to LOCKED
          ADD 1 TO NUM_SEL_L.
          WRITE:/15 'User'(018), ' ', ITAB1-BNAME, 'LOCKED   by '(025),
                 ITAB1-MODBE, ' ', 'in Group ', ITAB1-CLASS,
                                   'on'(020), ' ', ITAB1-MODDA,
                 ' ', 'at'(021), ' ', ITAB1-MODTI, SPACER.
      ENDCASE.
      HOLD_UFLAG = ITAB1-UFLAG.        " Save flag value
    ENDIF.

    IF ITAB1-BCODE NE HOLD_BCODE.      " Password has changed
      MOVE: ITAB1-BNAME TO ITAB3-BNAME,
            ITAB1-MODDA TO ITAB3-MODDA,
            ITAB1-MODTI TO ITAB3-MODTI,
            ITAB1-MODBE TO ITAB3-MODBE,
            ITAB1-CLASS TO ITAB3-CLASS.
      APPEND ITAB3.                    " Save pw changes in itab3
      HOLD_BCODE = ITAB1-BCODE.        " Save password value
    ENDIF.

  ENDLOOP.

  FORMAT RESET.
  IF NUM_SEL_L EQ 0.
    WRITE: /31 '****** NO RECORDS EXIST FOR LOCK/UNLOCK ******'(012).
  ENDIF.
  CLEAR LOCK.

ENDFORM.                               " GET_LOCK_CHANGES
*&---------------------------------------------------------------------*
*&      Form  CHECK_FOR_DELETED_USER                                   *
*&---------------------------------------------------------------------*
*  This form checks whether a user was deleted prior to the current    *
*  change and after any previous change.                               *
*----------------------------------------------------------------------*
FORM CHECK_FOR_DELETED_USER.
* When a user is deleted, a record is written to ush04, with nrpro = 1
* and the first byte of profs = 'D'.  If the same user is then created,
* another record is written, with a different nrpro value and with
* profs = 'C'.  This form captures all these records and positions us
* at the most recent one so we can check for a 'D'.
  CLEAR ITAB4.
  REFRESH ITAB4.
  SELECT * FROM USH04
    WHERE BNAME EQ ITAB1-BNAME
      AND MODDA LE ITAB1-MODDA
      AND MODDA GE ITAB2-MODDA.
* Check that record is prior to current change.
    IF USH04-MODDA EQ ITAB1-MODDA.
      CHECK USH04-MODTI LT ITAB1-MODTI.
    ENDIF.
* Check that record is later than any previous change.  (This is needed
* because simple changes to a user, such as a password change, do not
* result in a record written to ush04.)
    IF USH04-MODDA EQ ITAB2-MODDA.
      CHECK USH04-MODTI GT ITAB2-MODTI.
    ENDIF.
    MOVE: USH04-BNAME    TO ITAB4-BNAME,
          USH04-MODDA    TO ITAB4-MODDA,
          USH04-MODTI    TO ITAB4-MODTI,
          USH04-NRPRO    TO ITAB4-NRPRO,
          USH04-PROFS(1) TO ITAB4-PROFS.
    APPEND ITAB4.
  ENDSELECT.

  LOOP AT ITAB4.                       " Get to last record of itab4
  ENDLOOP.

ENDFORM.                               " CHECK_FOR_DELETED_USER
*&---------------------------------------------------------------------*
*&      Form  WRITE_PW_CHANGES
*&---------------------------------------------------------------------*
*  This form writes out the password change records previously saved.  *
*----------------------------------------------------------------------*
FORM WRITE_PW_CHANGES.
  PASSWORD = 'X'.
  CLEAR NUM_SEL_PW.
  NEW-PAGE.

  FORMAT COLOR COL_TOTAL INTENSIFIED.
  LOOP AT ITAB3.                       " Write out password changes
    ADD 1 TO NUM_SEL_PW.
    WRITE:/15 'User'(018), ' ', ITAB3-BNAME, 'PASSWORD CHANGED by'(029),
          ' ', ITAB3-MODBE, ' ', 'in Group ', ITAB3-CLASS,
                                 'on'(020), ' ', ITAB3-MODDA,
          ' ', 'at'(021), ' ', ITAB3-MODTI, SPACER.
  ENDLOOP.
  FORMAT RESET.
  IF NUM_SEL_PW EQ 0.
    WRITE: /31 '**** NO RECORDS EXIST FOR PASSWORD CHANGES ****'(027).
  ENDIF.
  CLEAR PASSWORD.

ENDFORM.                               " WRITE_PW_CHANGES
*&---------------------------------------------------------------------*
*&      Form  GET_OTHER_USER_CHANGES                                   *
*&---------------------------------------------------------------------*
*  This call function is used to show changes to users other than      *
*  locking and unlocking, over a given time period (normally, the      *
*  previous day).                                                      *
*----------------------------------------------------------------------*
FORM GET_OTHER_USER_CHANGES.
  OTHER = 'X'.
  NEW-PAGE.

* - JJ ADD 8/13/99
* - Setup table User
  MOVE: 'I'  TO USERS-SIGN,
        'CP' TO USERS-OPTION,
        '*'  TO USERS-LOW.
  APPEND USERS.
* - END JJ ADD

  CALL FUNCTION 'SHOW_USERX_HISTORY'
       EXPORTING
            AUTHORITY            = AUTHORIT
            VON_DATUM            = VONDATUM  " Changes since
            BIS_DATUM            = BISDATUM  " Changes to
            HEADER               = PASSFLAG
            SCHEINMODIFIKATIONEN = ALL_FLAG
            ENQ_ADM_FLAG         = ENQ_ADM
            ENQ_LOG_FLAG         = ENQ_LOG
            DEQ_ADM_FLAG         = DEQ_ADM
            DEQ_LOG_FLAG         = DEQ_LOG
            PASS_CHG_FLAG        = PASS_CHG
            ADD_USR_FLAG         = ADD_USR
            DEL_USR_FLAG         = DEL_USR
            NAVIGATION           = SPACE
       TABLES
            USER_TABLE           = USERS.
*           mod_table            = chgu
*           add_prof_table       = add_prof
*           del_prof_table       = del_prof.
  CLEAR OTHER.

ENDFORM.                               " GET_OTHER_USER_CHANGES
*----------------------------------------------------------------------*
TOP-OF-PAGE.
  CASE SY-SYSID+1(2).
    WHEN '91'.                         "CEMA    *
      MOVE: 'Philip Morris Europe SA' TO TITLE.
    WHEN '51'.                         "EU      *
      MOVE: 'Philip Morris Europe SA' TO TITLE.
    WHEN '55'.                         "PMWT    *
      MOVE: 'Philip Morris PMWT'      TO TITLE.
    WHEN 'CP'.                         "ELS     *
      MOVE: 'INTERNATIONAL HQ ACCOUNTING SYSTEM'   TO TITLE.
    WHEN '22'.                         "PMP     *
      MOVE: 'Philip Morris PMP'   TO TITLE.
  ENDCASE.
* START OF INSERTION *-- CHG01 --*
  WRITE S_RDATE-LOW  TO W_DAT1 DD/MM/YYYY.
  WRITE S_RDATE-HIGH TO W_DAT2 DD/MM/YYYY.
  CONCATENATE 'Selection run period:'
              W_DAT1
              '-'
              W_DAT2
              INTO W_TITLE SEPARATED BY SPACE.
* END   OF INSERTION *-- CHG01 --*
* START OF DELETION  *-- CHG01 --*
*  perform pmi-heading using title
*                            'AUTH/PROFILE MASTER RECORD WATCH'(010)
*                            ' '.
* END   OF DELETION  *-- CHG01 --*
* START OF INSERTION *-- CHG01 --*
  PERFORM PMI-HEADING USING TITLE(40)
                            TEXT-010
                            W_TITLE.
* END   OF INSERTION *-- CHG01 --*
  SKIP.
  PERFORM WRITE_HEADER.
  INCLUDE ZIINCL031.

*&---------------------------------------------------------------------*
*&      Form  WRITE_HEADER
*&---------------------------------------------------------------------*
FORM WRITE_HEADER.
  DATA: SNC_DAYT(3) TYPE C,
        NUM_LOGT(3) TYPE C,
        W_LINE(67)  TYPE C.
  IF SAPALL = 'X'.
    WRITE  52 '****************************'.
    WRITE: /53 'USERS WITH SAP_ALL PROFILE'.
    WRITE /52 '****************************'.
    ULINE /(132). SKIP.
  ELSEIF USRGRP = 'X'.
    WRITE  47 '***************************************'.
    WRITE: /48 'USERS WITHOUT A USER-GROUP ASSIGNMENT'.
    WRITE /47 '***************************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM37 = 'X'.
    WRITE  50 '********************************'.
    WRITE: /51 'ABORTED BACKGROUND JOBS - SM37'.
    WRITE /50 '********************************'.
    ULINE /(132). SKIP.
  ELSEIF T_PROF = 'X'.
    WRITE  60 '*****************'.
    WRITE: /61 'UNUSED PROFILES'.
    WRITE /60 '*****************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM35 = 'X'.
    WRITE  47 '***************************************'.
    WRITE: /48 'INCORRECT BATCH INPUT SESSIONS - SM35'.
    WRITE /47 '***************************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM13 = 'X'.
    WRITE  51 '*******************************'.
    WRITE: /52 'HANGING UPDATE RECORDS - SM13'.
    WRITE /51 '*******************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM12 = 'X'.
    WRITE  49 '**********************************'.
    WRITE: /50 'UPDATES ON LOGGED ENTRIES - SM12'.
    WRITE /49 '**********************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SE38 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SE38'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SE16 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SE16'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM30 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM30'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM31 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM31'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM18 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM18'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM19 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM19'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM36 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM36'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM36WIZ = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM36WIZ'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SA38 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SA38'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM38 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM38'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM64 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM64'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM65 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM65'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SM01 = 'X'.
    WRITE  54 '*************************'.
    WRITE: /55 'LIST OF USERS USED SM01'.
    WRITE /54 '*************************'.
    ULINE /(132). SKIP.
  ELSEIF T_SCC4 = 'X'.
    WRITE  51 '*******************************'.
    WRITE: /52 'UPDATES ON CLIENT CUSTOMIZING'.
    WRITE /51 '*******************************'.
    ULINE /(132). SKIP.
  ELSEIF T_PARAM = 'X'.
    WRITE  52 '****************************'.
    WRITE: /53 'DISPLAY PROFILE PARAMETERS'.
    WRITE /52 '****************************'.
    ULINE /(132). SKIP.
  ELSEIF T_CUS = 'X'.
    WRITE  53 '*******************'.
    WRITE: /54 'BACKUP MONITORING'.
    WRITE /53 '*******************'.
    FORMAT COLOR 3.
    WRITE:/ SY-ULINE.
    FORMAT COLOR OFF.
  ELSEIF SYMEAS = 'X'.
    WRITE  49 '**********************************'.
    WRITE: /50 'USERS WITH NO SYSTEM MEASUREMENTS'.
    WRITE /49 '**********************************'.
    ULINE /(132). SKIP.
  ELSEIF NOTLOG = 'X'.
    WRITE  48 '*************************************'.
    MOVE NUM_DAYS TO SNC_DAYT.
    WRITE: /49 'USERS NOT LOGGED IN SINCE', SNC_DAYT, ' DAYS'.
    WRITE /48 '*************************************'.
    ULINE /(132). SKIP.
  ELSEIF TRNLST = 'X'.
    WRITE  57 '********************'.
    WRITE: /58 'IMPORTED TRANPORTS'.
    WRITE /57 '********************'.
    ULINE /(132). SKIP.
  ELSEIF ERRLOG = 'X'.
    NEW-PAGE.
    CLEAR W_LINE WITH '*'.
    WRITE:/58 '*****************'.
    WRITE: /59 'INCORRECT LOGON'.
    WRITE:/58 '*****************'.
    ULINE (90).
  ELSEIF LOCK = 'X'.
    WRITE 50 '***********************'.
    WRITE /51 'USERS LOCKED/UNLOCKED'(008).
    WRITE /50 '***********************'.
    ULINE /(132). SKIP.
  ELSEIF PASSWORD = 'X'.
    WRITE  54 '***********************'.
    WRITE /55 'PASSWORD CHANGES'(028).
    WRITE /54 '***********************'.
    ULINE /(132). SKIP.
  ELSEIF OTHER = 'X'.
    WRITE  54 '**********************'.
    WRITE /56 'OTHER USER CHANGES'(011).
    WRITE /54 '**********************'.
    ULINE /(80).
    WRITE /(80) SPACE COLOR COL_HEADING INTENSIFIED.
    WRITE 1 SY-VLINE.
    WRITE 3  'User'(018) COLOR COL_HEADING INTENSIFIED.
    WRITE 41 'Changed by'(004)
             COLOR COL_HEADING INTENSIFIED.
    WRITE 59 'on'(020) COLOR COL_HEADING INTENSIFIED.
    WRITE 71 'at'(021) COLOR COL_HEADING INTENSIFIED.
    WRITE 80 SY-VLINE.
    NEW-LINE.
    WRITE /(80) SPACE COLOR COL_HEADING INTENSIFIED OFF.
    WRITE 1 SY-VLINE.
    WRITE 3 '*** Deleted entries ***'(013)
            COLOR COL_HEADING INTENSIFIED OFF.
    WRITE 40 SY-VLINE.
    WRITE 42 '*** Created entries ***'(014)
             COLOR COL_HEADING INTENSIFIED OFF.
    WRITE 80 SY-VLINE.
    ULINE /(80).
  ELSEIF LOGGED = 'X'.
    WRITE  45 '*****************************************'.
    WRITE /49 'USER IDs WITH @ - LAST LOGGED ON'(015).
    WRITE /45 '*****************************************'.
    SKIP.
  ELSEIF PROFILE = 'X'.
    WRITE  45 '*****************************************'.
    WRITE /59 'PROFILE CHANGES'(016).
    WRITE /45 '*****************************************'.
  ENDIF.

ENDFORM.                               " WRITE_HEADER
************************************************************************
* FORM find_sap_all
*-----------------------------------------------------------------------
* SHOWS ALL USERS WITH PROFILE = 'SAP_ALL'
************************************************************************
FORM FIND_SAP_ALL.
  CLEAR ITAB5.
  REFRESH ITAB5.
  SELECT * FROM UST04 WHERE PROFILE = 'SAP_ALL'.
    MOVE-CORRESPONDING UST04 TO ITAB5.
    SELECT SINGLE BNAME TRDAT
           FROM USR02
           INTO (USR02-BNAME, USR02-TRDAT)
           WHERE BNAME = UST04-BNAME.
    IF SY-SUBRC = 0.
      ITAB5-TRDAT = USR02-TRDAT.
    ENDIF.
    APPEND ITAB5.
    CLEAR ITAB5.
  ENDSELECT.
  DESCRIBE TABLE ITAB5 LINES L_SAPALL.
ENDFORM.
************************************************************************
* FORM find_usr_grp
*-----------------------------------------------------------------------
* SHOWS ALL USERS WITHOUT A GROUP ASSIGNMENT
************************************************************************
FORM FIND_USR_GRP.
  CLEAR ITAB6.
  REFRESH ITAB6.
  SELECT * FROM USR02 WHERE CLASS = ''.
    MOVE-CORRESPONDING USR02 TO ITAB6.
    APPEND ITAB6.
    CLEAR ITAB6.
  ENDSELECT.
  DESCRIBE TABLE ITAB6 LINES L_USRGRP.
ENDFORM.
************************************************************************
* FORM find_not_log
*-----------------------------------------------------------------------
* SHOWS ALL USERS NOT lOGGED IN SINCE # DAYS
************************************************************************
FORM FIND_NOT_LOG.
  DATA: TEST_DATE LIKE SY-DATUM.
  CLEAR ITAB7.
  REFRESH ITAB7.
  TEST_DATE = S_RDATE-LOW - NUM_DAYS.

  SELECT * FROM USR02 WHERE TRDAT <= TEST_DATE.
    CHECK NOT USR02-TRDAT IS INITIAL.
    MOVE-CORRESPONDING USR02 TO ITAB7.
    APPEND ITAB7.
    CLEAR ITAB7.
  ENDSELECT.
  DESCRIBE TABLE ITAB7 LINES L_NOTLOG.
ENDFORM.
************************************************************************
* FORM find_err_log
*-----------------------------------------------------------------------
* SHOWS ALL USERS WITH ERROR LOGONS # of times and # of days
************************************************************************
FORM FIND_ERR_LOG.
* data: test_date like sy-datum.
* clear itab8.
* refresh itab8.
* test_date = s_rdate-low - snc_day.

* select bname locnt from zebcusrlog
*      into corresponding fields of itab8
*      where trdat ge test_date.
*   collect itab8.
* endselect.
* clear itab8.

* describe table itab8 lines l_errlog.
  NEW-PAGE.
  ERRLOG = 'X'.
*  select * from t000.                                         "HH02 DEL
*    select * from usr02 client specified                      "HH02 DEL
*             where mandt = t000-mandt.                        "HH02 DEL
  SELECT * FROM USR02 WHERE TRDAT IN S_RDATE.                "HH02 INS
    IF USR02-UFLAG O YULOCK.
      WRITE: (90) SPACE COLOR COL_NORMAL INTENSIFIED OFF.
      WRITE 1 SY-VLINE.
      WRITE 2 USR02-MANDT COLOR COL_KEY INTENSIFIED.
      WRITE 5 SY-VLINE.
      WRITE 6 USR02-BNAME COLOR COL_KEY INTENSIFIED.
      WRITE 18 SY-VLINE.
      WRITE 19 USR02-CLASS COLOR COL_NORMAL INTENSIFIED OFF.
      WRITE 31 SY-VLINE.
      WRITE 32 USR02-TRDAT COLOR COL_NORMAL INTENSIFIED OFF.
      WRITE 42 SY-VLINE.
      WRITE 43 USR02-LTIME COLOR COL_NORMAL INTENSIFIED OFF.
      WRITE 51 SY-VLINE.
      WRITE 52 'User locked (Incorrect logons)'
                COLOR COL_NEGATIVE INTENSIFIED OFF.
      WRITE 90 SY-VLINE.
    ENDIF.
  ENDSELECT.
*  endselect.                                                  "HH02 DEL
  ULINE (90).
  ERRLOG = ' '.

ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  print_sap_all
*&---------------------------------------------------------------------*
*  This form writes users with SAP_ALL profile                         *
*----------------------------------------------------------------------*
FORM PRINT_SAP_ALL.
  SAPALL = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_TOTAL INTENSIFIED.
  LOOP AT ITAB5.                       " Write out users

    WRITE:/21 'User'(018), ' ', ITAB5-BNAME,
          'has a ', ITAB5-PROFILE, ' Profile',
                 ' and last logon was ', ITAB5-TRDAT.
  ENDLOOP.
  FORMAT RESET.
  SAPALL = ''.
ENDFORM.                               " print_sap_all
*&---------------------------------------------------------------------*
*&      Form  print_usr_grp
*&---------------------------------------------------------------------*
*  This form writes users without a group assignment                   *
*----------------------------------------------------------------------*
FORM PRINT_USR_GRP.
  USRGRP = 'X'.
  NEW-PAGE.
  SORT ITAB6 BY BNAME.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  LOOP AT ITAB6.                       " Write out users

    WRITE:/21 'User'(018), ' ', ITAB6-BNAME,
                               'has no group assignment'.
  ENDLOOP.
  FORMAT RESET.
  USRGRP = ''.
ENDFORM.                               " print_usr_grp
*&---------------------------------------------------------------------*
*&      Form  print_not_log
*&---------------------------------------------------------------------*
*  This form writes users not logged in since # of Days                *
*----------------------------------------------------------------------*
FORM PRINT_NOT_LOG.
  SORT ITAB7 BY TRDAT.
  NOTLOG = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_TOTAL INTENSIFIED.
  LOOP AT ITAB7.                       " Write out users

    WRITE:/21 'User'(018), ' ', ITAB7-BNAME,
                               'has not logged in since',
                                ITAB7-TRDAT.
  ENDLOOP.
  SKIP 1.
  WRITE:/21 'Total number of users : ', L_NOTLOG.
  FORMAT RESET.
  NOTLOG = ''.
ENDFORM.                               " print_not_log
*&---------------------------------------------------------------------*
*&      Form  print_err_log
*&---------------------------------------------------------------------*
*  This form writes users with error logons # of time since # of days  *
*----------------------------------------------------------------------*
FORM PRINT_ERR_LOG.
* data: print_ok(1) type c.
* clear print_ok.
* sort itab8 by locnt descending bname ascending.
* errlog = 'X'.
* new-page.

* format color col_total intensified.
* loop at itab8 where locnt gt num_log." Write out users

*   write:/21 'User'(018), ' ', itab8-bname,
*                              'had ',
*                               itab8-locnt,
*                               ' times an error at logon.'.
*   print_ok = 'Y'.
* endloop.
* if l_errlog = 0 or print_ok ne 'Y'.
*   write: /31 '**** NO RECORDS EXIST FOR ERROR LOGONS ****'.
* endif.
* format reset.
* errlog = ''.
ENDFORM.                               " print_not_log
*&---------------------------------------------------------------------*
*&      Form  form maintain_err_log.
*&---------------------------------------------------------------------*
* Maintaining values in Costomer table zebcusrlog.
*----------------------------------------------------------------------*
FORM MAINTAIN_ERR_LOG.
* data: test_date like sy-datum.

* test_date = sy-datum - 365.          " One year of history
** deleting data older than 1 year ....
* delete from zebcusrlog
*        where trdat < test_date.
** Adding new data for error logons per user.
* select * from usr02 where locnt gt 0.
*   move-corresponding usr02 to zebcusrlog.
*   insert into zebcusrlog values zebcusrlog.
* endselect.

ENDFORM.
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Thu May 29, 2008 5:13 pm    Post subject: Reply with quote

Code:

*&---------------------------------------------------------------------*
*&      Form  fill_statl.
*&---------------------------------------------------------------------*
*  Filling up structure for calling program RSSTAT21
*----------------------------------------------------------------------*
FORM FILL_STATL USING TRANS.
  CLEAR STATL.
  STATL-SMAXCNT    = 500.
*  statl-senddat    = sy-datum.
  IF NOT S_RDATE-HIGH IS INITIAL.
    MOVE S_RDATE-HIGH TO STATL-SENDDAT.
  ELSE.
    MOVE: S_RDATE-LOW TO STATL-SENDDAT.
  ENDIF.
  STATL-SENDTIME   = '235959'.
  STATL-STIME      = '000000'.
  STATL-SMANDT     = '*  '.
  STATL-SBENU      = '*'.
  STATL-STCOD      = TRANS.            " Transaction for Custo changes
  STATL-SPROGRAM   = '*'.
  STATL-STASK      = 'D'.              " Dialog
  STATL-SPATH      = '*'.
  STATL-SSCREEN    = '*'.
  STATL-SSYSTEMID  = '*'.
  STATL-SWPID      = '*'.
*  statl-sdat       = sy-datum.
  MOVE: S_RDATE-LOW TO STATL-SDAT.
* statl-schg       = '1'.              " Database change > 1
ENDFORM.

*&---------------------------------------------------------------------*
*&      Form  rpt_print.
*&---------------------------------------------------------------------*
*  Getting the print parameters
*----------------------------------------------------------------------*
FORM RPT_PRINT.
  CALL FUNCTION 'GET_PRINT_PARAMETERS'
       EXPORTING
            NO_DIALOG              = 'X'
            LINE_COUNT             = 65
            LINE_SIZE              = 132
            NEW_LIST_ID            = 'X'
       IMPORTING
            OUT_ARCHIVE_PARAMETERS = L_ARCPAR
            OUT_PARAMETERS         = L_PRIPAR
            VALID                  = L_VAL
       EXCEPTIONS
            ARCHIVE_INFO_NOT_FOUND = 01.
  CHECK SY-SUBRC = 0.

* Redirect output to printer
  NEW-PAGE PRINT ON
           NEW-SECTION
           PARAMETERS L_PRIPAR
           ARCHIVE PARAMETERS L_ARCPAR
           NO DIALOG.
ENDFORM.                               " RPT_PRINT
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM37
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM37.
  SORT I_TBTCO.
  T_SM37 = 'X'.
  NEW-PAGE.

  DESCRIBE TABLE I_TBTCO LINES LIN_P.
  IF LIN_P > 0.
    FORMAT COLOR COL_TOTAL INTENSIFIED.
    LOOP AT I_TBTCO.
      WRITE:/21 'Job:', ' ', I_TBTCO-JOBNAME,
                                 'Job scheduler: ',
                                  I_TBTCO-SDLUNAME,
                                  ' has ABORTED.'.
    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR ABORTED JOBS ****'.
  ENDIF.
  CLEAR T_SM37.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM37
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM12
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM13.
  T_SM13 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'Date',
         35'Time',
         45'Tcode',
         55'Status'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE I_VBHDR LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT I_VBHDR.
      WRITE:/  I_VBHDR-VBMANDT,
            10 I_VBHDR-VBUSR,
            25 I_VBHDR-VBDATE,
            45 I_VBHDR-VBTCODE,
            55 I_VBHDR-VBRC.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR HANGING UPDATES ****'.
  ENDIF.
  CLEAR T_SM13.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM13
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM35
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM35.
  T_SM35 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Session',
         15'Date',
         30'Time',
         45'Created by',
         60'Tran.',
         70'Authorization'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE I_APQI LINES LIN_P.
  IF LIN_P > 0.
    SORT I_APQI BY CREDATE CRETIME GROUPID.
    LOOP AT I_APQI.
      WRITE:/  I_APQI-GROUPID,
            15 I_APQI-CREDATE,
            30 I_APQI-CRETIME,
            45 I_APQI-CREATOR,
            55 I_APQI-TRANSCNTE,
            70 I_APQI-USERID.

    ENDLOOP.
  ELSE.
    WRITE '* NO RECORDS SELECTED FOR INCORRECT BATCH INPUT SESSIONS *'.
  ENDIF.
  FORMAT RESET.
  CLEAR T_SM35.
ENDFORM.                               " PRINT_SM35
*&---------------------------------------------------------------------*
*&      Form  PRINT_SCC4
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SCC4.
DATA: W_VALUE_TEXT LIKE DD07T-DDTEXT.  "HH03
  T_SCC4 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',                "HH03
         8'Name',                   "HH03
*         45'Currency',             "HH03
         35'Curr',                  "HH03
*         60'Cat.',                 "HH03
         40'Cat.',                  "HH03
*         70'Change User',          "HH03
         44'User',                  "HH03
*         85'Change Date'.          "HH03
         54'Change Date',           "HH03
         66'Last Settings'.         "HH03
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE I_T000 LINES LIN_P.
  IF LIN_P > 0.
    SORT I_T000 BY MANDT.
    LOOP AT I_T000.
**Start of insertion HH03
      CALL FUNCTION 'STF4_GET_DOMAIN_VALUE_TEXT'
           EXPORTING
                IV_DOMNAME      = 'CCNOCLIIND'
                IV_VALUE        = I_T000-CCNOCLIIND
           IMPORTING
                EV_VALUE_TEXT   = W_VALUE_TEXT
           EXCEPTIONS
                VALUE_NOT_FOUND = 1
                OTHERS          = 2.
**End of insertion HH03
      WRITE:/  I_T000-MANDT,
            8 I_T000-MTEXT,
            35 I_T000-MWAER,
            40 I_T000-CCCATEGORY,
            44 I_T000-CHANGEUSER,
            54 I_T000-CHANGEDATE,
            66 W_VALUE_TEXT.           "HH03
**Start HH03
      IF     I_T000-CCCORACTIV = SPACE.
        WRITE /66 'CLIENT DEPENDING: Changes_w/o_automatic_recording'.
      ELSEIF I_T000-CCCORACTIV = '1'.
        WRITE /66 'CLIENT DEPENDING: Automatic_recording_of_changes'.
      ELSEIF I_T000-CCCORACTIV = '2'.
        WRITE /66 'CLIENT DEPENDING: No_changes_allowed'.
      ELSEIF I_T000-CCCORACTIV = '3'.
        WRITE /66 'CLIENT DEPENDING: No_transports_allowed'.
      ENDIF.
**End HH03
    ENDLOOP.
  ELSE.
    WRITE '* NO RECORDS SELECTED FOR CLIENT CHANGES (SCC4) *'.
  ENDIF.
  FORMAT RESET.
  CLEAR T_SCC4.
ENDFORM.                               " PRINT_SCC4
*&---------------------------------------------------------------------*
*&      Form  PRINT_ALL_USR_GRP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_ALL_USR_GRP.

  USRGRP = 'X'.
  NEW-PAGE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  WRITE:/21 'All User are assigned to an User Group'.
  FORMAT RESET.
  USRGRP = ''.
ENDFORM.                               " PRINT_ALL_USR_GRP
*&---------------------------------------------------------------------*
*&      Form  PRINT_USMM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_USMM.
  SYMEAS = 'X'.
  NEW-PAGE.
  SORT SYS_MEAS BY BNAME.
  FORMAT COLOR COL_TOTAL INTENSIFIED.

  READ TABLE SYS_MEAS INDEX 1.
  IF SY-SUBRC <> 0.
    WRITE:/ 'All users master records contain system measurements'.
  ENDIF.
  LOOP AT SYS_MEAS.                    " Write out users

    WRITE:/21 'User'(018), ' ', SYS_MEAS-BNAME, 'in User Group',
                   SYS_MEAS-CLASS,
                               'has no system measurements'.
  ENDLOOP.
  FORMAT RESET.
  SYMEAS = ''.

ENDFORM.                               " PRINT_USMM
*&---------------------------------------------------------------------*
*&      Form  SELECT_SM12
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM SELECT_SM12.

  DATA: GUSR     LIKE  SEL-GUSR.
  DATA: GMODE    LIKE  SEL-GMODE.
  DATA: GNAME    LIKE  SEL-GNAME.
  DATA: GARG     LIKE  SEL-GARG.
  DATA: GTARG    LIKE  SEQG3-GTARG.
  DATA: GOBJ     LIKE  SEL-GOBJ.
  DATA: GUNAME   LIKE  SEL-GUNAME.
  DATA: GCLIENT  LIKE  SEL-GCLIENT.
  DATA: GTCODE   LIKE  SEL-GTCODE.
  DATA: GUSE     LIKE  SEL-GUSE.
  DATA: GUSEVB   LIKE  SEL-GUSEVB.
  DATA: GBCKTYPE LIKE  SEL-GBCKTYPE..
  DATA: GRANULE  LIKE SEQTA.
  DATA: SUBRC TYPE I.

  REFRESH ENQ.
  REFRESH DEL.

  GNAME   = ' '.
  GUNAME  = ' '.
  GCLIENT = SY-MANDT.
  GARG    = ' '.
  GTARG   = ' '.

  DO 3 TIMES.
    CALL FUNCTION 'ENQUEUE_READ'
         EXPORTING
              GCLIENT = GCLIENT
              GUNAME  = GUNAME
              GNAME   = GNAME
              GARG    = GARG
         IMPORTING
              SUBRC   = SUBRC
         TABLES
              ENQ     = ENQ
         EXCEPTIONS
              OTHERS  = 1.
    IF SY-SUBRC = 0.
      EXIT.
    ENDIF.
  ENDDO.
ENDFORM.                               " SELECT_SM12
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM12
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM12.

  T_SM12 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'Locked Object',
         50'TCode',
         60'Date',
         75'Time'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE ENQ LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT ENQ.
      WRITE:/ ENQ-GCLIENT,
            10 ENQ-GUNAME,
            25 ENQ-GTARG,
            50 ENQ-GTCODE,
            60 ENQ-GTDATE,
            75 ENQ-GTTIME.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM12 ****'.
  ENDIF.
  CLEAR T_SM12.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM12
*&---------------------------------------------------------------------*
*&      Form  FIND_PRF_NOT_USED
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM FIND_PRF_NOT_USED.

  DATA:   BEGIN OF CPROF1 OCCURS 50,
            SIGN,
            OPTION(2),
            LOW   LIKE UST10C-PROFN,
            HIGH  LIKE UST10C-PROFN,
          END OF CPROF1.

  REFRESH PROFILES. CLEAR PROFILES.
  SELECT *
         FROM UST10S
         INTO UST10S
         WHERE PROFN NE ' '.

    TPROF-PROFN = UST10S-PROFN.
    COLLECT TPROF.
  ENDSELECT.

  LOOP AT TPROF.
    REFRESH PROFILES. CLEAR PROFILES.
    PROFILES-PROFILE = TPROF-PROFN.
    COLLECT PROFILES.

    CALL FUNCTION 'SUSI_GET_FATHER_PROFILES'
*      exporting
*           aktps    = tprof-profn
         TABLES
              PROFILES = PROFILES
         EXCEPTIONS
              OTHERS   = 1.

    CLEAR CPROF1.
    REFRESH CPROF1.
    CPROF1-SIGN = 'I'.
    CPROF1-OPTION = 'EQ'.
    CLEAR CPROF1-HIGH.
    LOOP AT PROFILES.
      CPROF1-LOW = PROFILES-PROFILE.
      APPEND CPROF1.
    ENDLOOP.

    SELECT SINGLE *
           FROM UST04
           INTO UST04
           WHERE PROFILE IN CPROF1.

    IF SY-SUBRC <> 0.
      IF TPROF-PROFN(1) = 'Z' OR TPROF-PROFN(1) = 'Y' OR
          TPROF-PROFN(2) = 'T-' OR  TPROF-PROFN(1) = 'E'.
        PROF_USD-PROFILE = TPROF-PROFN.
        APPEND PROF_USD.
      ENDIF.
      CLEAR  PROF_USD.
    ENDIF.
  ENDLOOP.

ENDFORM.                               " FIND_PRF_NOT_USED
*&---------------------------------------------------------------------*
*&      Form  PRINT_ALL_PROFILES
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_ALL_PROFILES.

  T_PROF = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'Profile'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  SORT PROF_USD.
  DESCRIBE TABLE PROF_USD LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT PROF_USD.
      WRITE:/ SY-MANDT,
              10 PROF_USD-PROFILE.

    ENDLOOP.
  ELSE.
    WRITE '**** NO PROFILES WITHOUT USEDID ****'.
  ENDIF.
  CLEAR T_PROF.
  FORMAT RESET.
ENDFORM.                               " PRINT_ALL_PROFILES
*&---------------------------------------------------------------------*
*&      Form  PRINT_SE38
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SE38.

  T_SE38 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSE38 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSE38.
      WRITE:/ TSE38-MANDT,
            10 TSE38-ACCOUNT,
            25 TSE38-CLASS,
            40 TSE38-DATE,
            50 'SE38'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SE38 ****'.
  ENDIF.
  CLEAR T_SE38.
  FORMAT RESET.

ENDFORM.                               " PRINT_SE38

*&---------------------------------------------------------------------*
*&      Form  PRINT_SE16
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SE16.

  T_SE16 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSE16 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSE16.
      WRITE:/ TSE16-MANDT,
            10 TSE16-ACCOUNT,
            25 TSE16-CLASS,
            40 TSE16-DATE,
            50 'SE16'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SE16 ****'.
  ENDIF.
  CLEAR T_SE16.
  FORMAT RESET.

ENDFORM.                               " PRINT_SE16
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM31
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM31.

  T_SM31 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM31 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM31.
      WRITE:/ TSM31-MANDT,
            10 TSM31-ACCOUNT,
            25 TSM31-CLASS,
            40 TSM31-DATE,
            50 'SM31'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM31 ****'.
  ENDIF.
  CLEAR T_SM31.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM31
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM18
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM18.
  T_SM18 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM18 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM18.
      WRITE:/ TSM18-MANDT,
            10 TSM18-ACCOUNT,
            25 TSM18-CLASS,
            40 TSM18-DATE,
            50 'SM18'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM18 ****'.
  ENDIF.
  CLEAR T_SM18.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM18
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM19
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM19.
  T_SM19 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM19 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM19.
      WRITE:/ TSM19-MANDT,
            10 TSM19-ACCOUNT,
            25 TSM19-CLASS,
            40 TSM19-DATE,
            50 'SM19'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM19 ****'.
  ENDIF.
  CLEAR T_SM19.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM19
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM36
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM36.
  T_SM36 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM36 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM36.
      WRITE:/ TSM36-MANDT,
            10 TSM36-ACCOUNT,
            25 TSM36-CLASS,
            40 TSM36-DATE,
            50 'SM36'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM36 ****'.
  ENDIF.
  CLEAR T_SM36.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM36
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM36
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM36WIZ.
  T_SM36WIZ = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM36WIZ LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM36WIZ.
      WRITE:/ TSM36WIZ-MANDT,
            10 TSM36WIZ-ACCOUNT,
            25 TSM36WIZ-CLASS,
            40 TSM36WIZ-DATE,
            50 'SM36WIZ'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM36WIZ ****'.
  ENDIF.
  CLEAR T_SM36WIZ.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM36WIZ
*&---------------------------------------------------------------------*
*&      Form  PRINT_SA38
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SA38.
  T_SA38 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSA38 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSA38.
      WRITE:/ TSA38-MANDT,
            10 TSA38-ACCOUNT,
            25 TSA38-CLASS,
            40 TSA38-DATE,
            50 'SA38'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SA38 ****'.
  ENDIF.
  CLEAR T_SA38.
  FORMAT RESET.
ENDFORM.                               " PRINT_SA38
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM38
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM38.
  T_SM38 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM38 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM38.
      WRITE:/ TSM38-MANDT,
            10 TSM38-ACCOUNT,
            25 TSM38-CLASS,
            40 TSM38-DATE,
            50 'SM38'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM38 ****'.
  ENDIF.
  CLEAR T_SM38.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM38
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM64
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM64.
  T_SM64 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM64 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM64.
      WRITE:/ TSM64-MANDT,
            10 TSM64-ACCOUNT,
            25 TSM64-CLASS,
            40 TSM64-DATE,
            50 'SM64'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM64 ****'.
  ENDIF.
  CLEAR T_SM64.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM64
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM65
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM65.
  T_SM65 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM65 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM65.
      WRITE:/ TSM65-MANDT,
            10 TSM65-ACCOUNT,
            25 TSM65-CLASS,
            40 TSM65-DATE,
            50 'SM65'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM65 ****'.
  ENDIF.
  CLEAR T_SM65.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM65
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM01
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM01.
  T_SM01 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM01 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM01.
      WRITE:/ TSM01-MANDT,
            10 TSM01-ACCOUNT,
            25 TSM01-CLASS,
            40 TSM01-DATE,
            50 'SM01'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM01 ****'.
  ENDIF.
  CLEAR T_SM01.
  FORMAT RESET.
ENDFORM.                               " PRINT_SM01
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM31
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM31.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM31.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM31-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM31.
      CLEAR  TSM31.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.                               " MOVE_SM31
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM18
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM18.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM18.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM18-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM18.
      CLEAR  TSM18.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.                               " MOVE_SM18
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM19
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM19.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM19.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM19-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM19.
      CLEAR  TSM19.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.                               " MOVE_SM18
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM36
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM36.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM36.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM36-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM36.
      CLEAR  TSM36.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM36WIZ
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM36WIZ.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM36WIZ.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM36WIZ-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM36WIZ.
      CLEAR  TSM36WIZ.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SA38
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SA38.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSA38.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSA38-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSA38.
      CLEAR  TSA38.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM38
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM38.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM38.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM38-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM38.
      CLEAR  TSM38.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM64
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM64.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM64.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM64-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM64.
      CLEAR  TSM64.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM65
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM65.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM65.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM65-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM65.
      CLEAR  TSM65.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM01
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM01.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM01.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM01-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM01.
      CLEAR  TSM01.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.
*&---------------------------------------------------------------------*
*&      Form  MOVE_SE38
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SE38.
  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSE38.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSE38-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSE38.
      CLEAR  TSE38.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.                               " MOVE_SE38
*&---------------------------------------------------------------------*
*&      Form  MOVE_SE16
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SE16.

  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSE16.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSE16-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSE16.
      CLEAR  TSE16.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.
ENDFORM.                               " MOVE_SE16
*&---------------------------------------------------------------------*
*&      Form  MOVE_SM30
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_SM30.

  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TSM30.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TSM30-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TSM30.
      CLEAR  TSM30.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.

ENDFORM.                               " MOVE_SM30
*&---------------------------------------------------------------------*
*&      Form  PRINT_SM30
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_SM30.

  T_SM30 = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TSM30 LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TSM30.
      WRITE:/ TSM30-MANDT,
            10 TSM30-ACCOUNT,
            25 TSM30-CLASS,
            40 TSM30-DATE,
            50 'SM30'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SM30 ****'.
  ENDIF.
  CLEAR T_SM30.
  FORMAT RESET.

ENDFORM.                               " PRINT_SM30
*&---------------------------------------------------------------------*
*&      Form  MOVE_LST_CUS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM MOVE_LST_CUS.

  IF SY-SUBRC = 0.
    LOOP AT USR.
      MOVE-CORRESPONDING USR TO TST_CUS.
      SELECT SINGLE CLASS
             FROM USR02
             INTO USR02-CLASS
             WHERE BNAME = USR-ACCOUNT.

      IF SY-SUBRC = 0.
        TST_CUS-CLASS = USR02-CLASS.
      ENDIF.
      APPEND TST_CUS.
      CLEAR  TST_CUS.
    ENDLOOP.
  ENDIF.
  CLEAR USR.
  REFRESH USR.

ENDFORM.                               " MOVE_LST_CUS
*&---------------------------------------------------------------------*
*&      Form  PRINT_TST_CUS
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_TST_CUS.

  T_TST_CUS = 'X'.
  NEW-PAGE.

  FORMAT COLOR COL_HEADING INTENSIFIED.
  WRITE:  /'Client',
         10'User',
         25'User Group',
         40'Date',
         50'Tcode'.
  ULINE.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  SKIP 1.
  DESCRIBE TABLE TST_CUS LINES LIN_P.
  IF LIN_P > 0.
    LOOP AT TST_CUS.
      WRITE:/ TST_CUS-MANDT,
            10 TST_CUS-ACCOUNT,
            25 TST_CUS-CLASS,
            40 TST_CUS-DATE,
            50 'SCC4'.

    ENDLOOP.
  ELSE.
    WRITE '**** NO RECORDS SELECTED FOR SCC4 ****'.
  ENDIF.
  CLEAR T_TST_CUS.
  FORMAT RESET.

ENDFORM.                               " PRINT_TST_CUS
*&---------------------------------------------------------------------*
*&      Form  SELECT_BACKUP_ACTIVITIES
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM SELECT_BACKUP_ACTIVITIES.

  CALL FUNCTION 'DB_ORA_BACKUP_TAB'
       IMPORTING
            TABCNT     = TABCNT
       TABLES
            BACKUP_TAB = BACKUP_TAB
       EXCEPTIONS
            OTHERS     = 1.

  LOOP AT BACKUP_TAB.

    CHECK BACKUP_TAB-FUNCT(1) = 'a'    "extended for compatibility
    OR BACKUP_TAB-FUNCT(1) = 'f'       "with RFC entries MS
    OR BACKUP_TAB-FUNCT(1) = 'i'
    OR BACKUP_TAB-FUNCT(1) = 'A'
    OR BACKUP_TAB-FUNCT(1) = 'F'
    OR BACKUP_TAB-FUNCT(1) = 'I'.
    if backup_tab-rc = 0 or backup_tab-rc = 1.
      IF LAST_FULL_BACKUP-BEG = SPACE.
        last_full_backup = backup_tab.
        last_succ_backup = backup_tab.
      ELSE.
        LAST_SUCC_BACKUP = BACKUP_TAB.
      ENDIF.
      exit.
    ELSEIF LAST_FULL_BACKUP-BEG = SPACE.
      last_full_backup = backup_tab.
    ENDIF.
  endloop.

* select * from sdbad where beg = :backup_tab-beg
*                      and funct = : backup_tab-funct
*                      order by pos.
*
*   bl = sdbad-line.
*   append bl.
* endselect.
ENDFORM.                               " SELECT_BACKUP_ACTIVITIES
*&---------------------------------------------------------------------*
*&      Form  PRINT_BACKUP
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_BACKUP.

  T_CUS = 'X'.
  NEW-PAGE.
  if last_full_backup-rc <> 0
         and last_full_backup-rc <> 1. "1 = warning
    workdate = last_full_backup-beg(8).
    worktime = last_full_backup-beg+8(6).
    write:  workdate to unsucc_datetime.
    write:  worktime to unsucc_datetime+11.
    FORMAT COLOR 3.
    WRITE:/ 'Last Unsuccessfull DB Backup - ', UNSUCC_DATETIME.
    FORMAT COLOR OFF.
    rc = last_full_backup-rc.
  endif.
  IF LAST_SUCC_BACKUP-BEG IS INITIAL.
    succ_datetime = 'None available'(059).
  else.
    workdate = last_succ_backup-beg(8).
    worktime = last_succ_backup-beg+8(6).
    write:  workdate to succ_datetime.
    write:  worktime to succ_datetime+11.
    FORMAT COLOR 3.
    WRITE:/ 'Last Successfull DB Backup - ', SUCC_DATETIME.
    FORMAT COLOR OFF.
  endif.

  T_CUS = 'X'.

*
* DATA:  FLIPFLOP(1),
*        WDATEE LIKE SY-DATUM,
*        WTIMEE LIKE SY-UZEIT,
*        SHORT_FILE_NAME(116),
*        FILE_ID(5)                      TYPE N,
*        FILE_POS(4)                     TYPE N,
*        REDO_NR(6)                      TYPE N,
*        TS_STATUS(9)                    TYPE C,
*        DBF_STATUS(11)                  TYPE C.
*
* NEW-PAGE.
* HEAD_TAB    = SY-VLINE.
* HEAD_TAB+1  = 'Volume'.
* HEAD_TAB+11 = SY-VLINE.
* HEAD_TAB+12 = 'Pos.'.
* HEAD_TAB+16 = SY-VLINE.
* HEAD_TAB+18 = 'Backup time'.
* HEAD_TAB+38 = SY-VLINE.
* HEAD_TAB+42 = 'Compr.'.
* HEAD_TAB+48 = SY-VLINE.
* HEAD_TAB+49 = 'File ID'.
* HEAD_TAB+56 = SY-VLINE.
* HEAD_TAB+57 = 'File name'.
* HEAD_TAB+170 = SY-VLINE.
* HEAD_TAB+171 = 'Tablespace'.
* HEAD_TAB+201 = SY-VLINE.
* HEAD_TAB+203 = 'Redo nr'.
* HEAD_TAB+210 = SY-VLINE.
* HEAD_TAB+211 = 'TS status'.
* HEAD_TAB+220 = SY-VLINE.
* HEAD_TAB+221 = 'File status'.
* HEAD_TAB+232 = SY-VLINE.
* HEAD_TAB+233 = 'Backup utility'.
* HEAD_TAB+249 = SY-VLINE.
*
* T_CUS = 'X'.
* FLIPFLOP = 'X'.
* DETAIL.
* LOOP AT BL.
*   IF FLIPFLOP = 'X'.
*     FLIPFLOP = SPACE.
*     FORMAT COLOR 2 INTENSIFIED OFF.
*   ELSE.
*     FLIPFLOP = 'X'.
*     FORMAT COLOR 2 INTENSIFIED.
*   ENDIF.
*   WDATEE = BL-TIME_END(8).
*   WTIMEE = BL-TIME_END+8(6).
*   SHORT_FILE_NAME = BL-DBF_NAME.
*   FILE_ID = BL-FILE_ID.
*   IF BL-VOLUME <> SPACE.
*     FILE_POS = BL-FILE_POS.
*   ELSE.
*     FILE_POS = SPACE.
*   ENDIF.
*   REDO_NR = BL-REDO_NR.
*   CASE BL-TS_STATUS.
*     WHEN 'N'.
*       TS_STATUS = 'ONLINE'.
*     WHEN 'F'.
*       TS_STATUS = 'OFFLINE'.
*     WHEN 'I'.
*       TS_STATUS = 'INVALID'.
*     WHEN 'R'.
*       TS_STATUS = 'READONLY'.
*     WHEN OTHERS.
*       IF FILE_ID > 0 AND FILE_ID < 9998.
*         TS_STATUS = 'UNKNOWN'.
*       ELSE.
*         TS_STATUS = ' '.
*       ENDIF.
*   ENDCASE.
*
*   CASE BL-DBF_STATUS.
*     WHEN 'A'.
*       DBF_STATUS = 'AVAILABLE'.
*     WHEN 'N'.
*       DBF_STATUS = 'ONLINE'.
*     WHEN 'F'.
*       DBF_STATUS = 'OFFLINE'.
*     WHEN 'S'.
*       DBF_STATUS = 'SYSTEM'.
*     WHEN 'O'.
*       DBF_STATUS = 'SYSOFF'.
*     WHEN 'R'.
*       DBF_STATUS = 'RECOVER'.
*     WHEN OTHERS.
*       IF FILE_ID > 0 AND FILE_ID < 9998.
*         DBF_STATUS = 'UNKNOWN'.
*       ELSE.
*         DBF_STATUS = ' '.
*       ENDIF.
*   ENDCASE.
*   IF FILE_ID >= 9998.
*     FILE_ID = 0.
*   ENDIF.
*   WRITE: / SY-VLINE,
*          2 BL-VOLUME,
*          12 SY-VLINE,
*          13 FILE_POS NO-ZERO,
*          17 SY-VLINE,
*          19 WDATEE,
*          29 ' ',
*          30 WTIMEE,
*          39 SY-VLINE,
*          40(9) BL-COMPR_RATE USING EDIT MASK '______.__' NO-ZERO,
*          49 SY-VLINE,
*          51 FILE_ID NO-ZERO,
*          57 SY-VLINE,
*          58 SHORT_FILE_NAME,
*          171 SY-VLINE,
*          172 BL-TS_NAME,
*          202 SY-VLINE,
*          204 REDO_NR NO-ZERO,
*          211 SY-VLINE,
*          212 TS_STATUS,
*          221 SY-VLINE,
*          222 DBF_STATUS,
*          233 SY-VLINE,
*          234 BL-BACKUP_ID,
*          250 SY-VLINE.
* ENDLOOP.
* WRITE:/ SY-ULINE.
* CLEAR T_CUS.
ENDFORM.                               " PRINT_BACKUP
*&---------------------------------------------------------------------*
*&      Form  PRINT_RSPARAM
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_RSPARAM.
  T_PARAM = 'X'.
  NEW-PAGE.
  FORMAT COLOR COL_HEADING INTENSIFIED OFF.
  ULINE.
  WRITE: / SY-VLINE
       ,   'Profile parameters valid in the current system:'
       ,   'Substituted form'
       , AT SY-LINSZ SY-VLINE NO-GAP.
  WRITE: / SY-VLINE
       , 5 'Param. name'
       , AT SY-LINSZ SY-VLINE NO-GAP.
*   loop at pname.
*       write: / sy-vline
*        , 5 pname-low  intensified off
*        ,   pname-high intensified off
*        ,   pname-sign intensified off
*        ,   pname-option intensified off
*        , at sy-linsz sy-vline no-gap.
*   endloop.
  FORMAT COLOR COL_HEADING INTENSIFIED OFF.
  ULINE.
  WRITE: /    SY-VLINE                         NO-GAP
       , (40) 'Parameter name'
       ,      SY-VLINE                         NO-GAP
       , (44) 'User-defined value'             NO-GAP
       ,      SY-VLINE                         NO-GAP
       , (43) 'System default value'           NO-GAP
       ,      SY-VLINE                         NO-GAP  .
  FORMAT COLOR COL_NORMAL INTENSIFIED.
  ULINE.

  SELECT *
         FROM ZEBCWATCH
         INTO CORRESPONDING FIELDS OF TABLE T_RSPARAM
         WHERE PROG = SY-REPID.

  LOOP AT PAR_SUB.
    TMP_PNAME = PAR_SUB-PNAME.
    TRANSLATE TMP_PNAME TO UPPER CASE.
    READ TABLE T_RSPARAM WITH KEY PARAM = TMP_PNAME.
    CHECK SY-SUBRC = 0.

    PAR_NAME         = PAR_SUB-PNAME.

    PAR_STATUS       = PAR_SUB-STATUS.
    PAR_USER_WERT    = PAR_SUB-USER_WERT.
    PAR_DEFAULT_WERT = PAR_SUB-DEFAULT_WERT.

    PERFORM WRITE_DESCR.

    LAST_PAR_NAME = PAR_NAME.
  ENDLOOP.
  ULINE.

  T_PARAM = ' '.
ENDFORM.                               " PRINT_RSPARAM
*&---------------------------------------------------------------------*
*&      Form  WRITE_DESCR
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM WRITE_DESCR.
  IF PAR_STATUS = PAR_USER_ONLY.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED OFF.
  ELSE.
    FORMAT COLOR COL_NORMAL   INTENSIFIED.
  ENDIF.
  IF LAST_PAR_NAME = PAR_NAME.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED.
  ENDIF.
  WRITE: / SY-VLINE              NO-GAP
         ,   PAR_NAME(41)          NO-GAP
         ,   SY-VLINE              NO-GAP
         ,   PAR_USER_WERT(44)     NO-GAP
         ,   SY-VLINE              NO-GAP
         ,   PAR_DEFAULT_WERT(43)  NO-GAP
         ,   SY-VLINE              NO-GAP  .
  HIDE PAR_NAME.

* if withtext = 'X'.
*   clear ipfypropty.
*   ipfypropty-paraname = par_name.
*   translate ipfypropty-paraname to upper case.
*   read table ipfypropty
*     with key paraname = ipfypropty-paraname binary search.
*   if ipfypropty-descr = 'missing'. "$EC NOTEXT
*     clear ipfypropty-descr.
*   endif.
*   format color col_total intensified off.
*   write: /   sy-vline no-gap,
*              ipfypropty-descr(40),
*           42 sy-vline no-gap,
*           93 sy-vline no-gap,
*          144 sy-vline no-gap.
*   hide par_name.
*   format reset.
* endif.

ENDFORM.                               " WRITE_DESCR
*&---------------------------------------------------------------------*
*&      Form  FIND_TRANSPORT_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM FIND_TRANSPORT_LIST.

  SELECT *
         FROM E070
         WHERE AS4DATE IN S_RDATE
           AND STRKORR = ' '.

*   check e070-trkorr+1(2) = sy-sysid+1(2).

    SELECT SINGLE *
           FROM E07T
           WHERE TRKORR = E070-TRKORR.

    CHECK SY-SUBRC = 0.

    ITAB9-TRKORR  = E070-TRKORR.
    ITAB9-AS4USER = E070-AS4USER.
    ITAB9-AS4DATE = E070-AS4DATE.
    ITAB9-AS4TEXT = E07T-AS4TEXT.
    APPEND ITAB9.
    CLEAR  ITAB9.
  ENDSELECT.

  DESCRIBE TABLE ITAB9 LINES L_TR_LST.

ENDFORM.                               " FIND_TRANSPORT_LIST
*&---------------------------------------------------------------------*
*&      Form  PRINT_TRANSPORT_LIST
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM PRINT_TRANSPORT_LIST.

  SORT ITAB9 BY TRKORR.
  TRNLST = 'X'.
  NEW-PAGE.

  WRITE:  /'Transport Number', 22 'User ID', 35 'Transport Date',
                         55 'Transport Text'.
  FORMAT COLOR COL_TOTAL INTENSIFIED.
  ULINE.
  LOOP AT ITAB9.                       " Write out users

    WRITE:/
    ITAB9-TRKORR,
    ITAB9-AS4USER,
    ITAB9-AS4DATE,
   55  ITAB9-AS4TEXT.
  ENDLOOP.
  SKIP 1.
* write:/21 'Total number of users : ', l_notlog.
  FORMAT RESET.
  TRNLST = ''.
ENDFORM.                               " PRINT_TRANSPORT_LIST


Code:


*----------------------------------------------------------------------*
*   INCLUDE ZIINCL01                                                   *
*----------------------------------------------------------------------*
*       FORM PMI-DATE-CONV
*---------------------------------------------------------

*       THIS ROUTINE CONVERTS DATES INTO PMI DISPLAY FORMA
*       SY-SUBRC = 00 IF SUCCESSFULLY CONVERTED
*                = 04 IF UNSUCCESSFUL & DATE WILL BE MM/DD
*---------------------------------------------------------
*       VALUE(DATE-IN)  DATE IN DD/MM/YY OR MM/DD/YY FORMA
*       VALUE(FORM-OUT) FORMAT OF OUTPUT DATE S-SHORT L-LO
*       CHANGING
*       VALUE(DATE-OUT) DATE IN DD MMM YYYY FORMAT (PMI)
***********************************************************************
***                    CHANGE HISTORY                               ***
* PMDE00000 - 02/14/1996 Initial Ver of Standard Report Heading Routine
*
***********************************************************************
* CTS:                DEVK904303
* Author:             Elton D. Milton
* Date:               3/26/1998
* Description:        Changed l_date-in declaration from type 1 to type
*                     d, this is for the upgrade project 2.2 to 3.1H.
***********************************************************************
*     Name: Jeff Graffeo
*     Date: 01/02/2001
*     Description: The day in the date format was incorrectly retrieving
*                  the first 2 bytes of a date field which is part of
*                  the year.  It needs to be the 7th and 8th byte.
*     Change #: CHG01
*----------------------------------------------------------------------*
* Name:  Jeff Graffeo
* Date:  02/01/2001
* Description: The date displayed in the header incorrectly uses
*              the year to determine the month name from T247.
* Change #: CHG02
*----------------------------------------------------------------------*
FORM   PMI-DATE-CONV USING    VALUE(DATE-IN)
                              VALUE(FORM-OUT)
                     CHANGING VALUE(DATE-OUT).

*   TABLE CONTAINS MONTH ABREVIATIONS

  TABLES : T247.

*   LOCAL VARIABLES FOR CONVERSION

  DATA : L_STANDARD-DATE TYPE D,
*         l_date-in       type 1,
          L_DATE-IN       TYPE D,
         L_DATE-OUT(11).

  L_DATE-IN       = DATE-IN.
  L_STANDARD-DATE = L_DATE-IN.

*   READ T247 TO GET THE MONTH ABREVIATION

  SELECT SINGLE * FROM T247
         WHERE SPRAS = SY-LANGU AND
*               MNR = L_DATE-IN+2(2).                   "CHG02
               MNR = L_DATE-IN+4(2).                    "CHG02

  IF SY-SUBRC = 0.

*    MOVE : L_DATE-IN(2)       TO L_DATE-OUT(2),         "CHG01
    MOVE : L_DATE-IN+06(02)   TO L_DATE-OUT(2),          "CHG01
           T247-KTX           TO L_DATE-OUT+3(3),
           L_STANDARD-DATE(4) TO L_DATE-OUT+7(4),
           00                 TO SY-SUBRC.

  ELSE.

    WRITE L_DATE-IN TO L_DATE-OUT DD/MM/YY.
    MOVE 04         TO SY-SUBRC.

  ENDIF.

*   MOVE THE CONVERTED DATE OUT TO THE OUTPUT PARAMETER

  IF FORM-OUT = 'S'.
    MOVE L_DATE-OUT+9(2) TO L_DATE-OUT+7(4).
  ENDIF.
  MOVE L_DATE-OUT TO DATE-OUT.

ENDFORM.

*---------------------------------------------------------
*       FORM PMI-HEADINGS
*---------------------------------------------------------
*       THIS FORM PRODUCES A STANDARD HEAD FOR PMI REPORTS
*       THE HEADINGS AUTOMATICALLY ON A PAGE
*---------------------------------------------------------
*       VALUE(LINE3) - TEXT TO APPEAR IN THE CENTER OF LIN
*       VALUE(LEN3)  - LENGTH OF LINE 3 TEXT
*       VALUE(LINE4) - TEXT TO APPEAR IN THE CENTER OF LIN
*       VALUE(LEN4)  - LENGTH OF LINE 4 TEXT
*---------------------------------------------------------
FORM PMI-HEADINGS USING VALUE(LINE2) VALUE(LEN2)
                        VALUE(LINE3) VALUE(LEN3)
                        VALUE(LINE4) VALUE(LEN4).

  DATA :
    MID-LINE  TYPE P,     "  CALCULATE THE CENTER OF THE L
    END-LINE1 TYPE P,                  "  CALCULATE THE END of the line
    END-LINE2 TYPE P,     "     "       "   "  "   "    "
    O-FORM    VALUE 'L',               "  FORMAT OF OUTPUT
    O-DATE(11).                        "  DATE IN PMI FORM MMM DD YYYY

  DATA:
    W-TEXT-001(7)   VALUE 'REPORT:',
    W-TEXT-002(5)   VALUE 'PAGE:',
    W-TEXT-003(5)   VALUE 'DATE:',
    W-TEXT-005(5)   VALUE 'TIME:',
    W-TEXT-004(7)   VALUE 'SYSTEM:'.

*  UNPACK SY-MANDT TO T000-MANDT.
*  SELECT  * FROM  T000 WHERE  MANDT = T000-MANDT.
*  ENDSELECT.
  SKIP TO LINE 1.
  MID-LINE = ( SY-LINSZ / 2 ) - 10.
  END-LINE1 = SY-LINSZ - 17.
  END-LINE2 = SY-LINSZ - 7.

  WRITE : / W-TEXT-001, SY-REPID.
  POSITION MID-LINE.
*  WRITE : T000-MTEXT.
  POSITION END-LINE1.
  WRITE : W-TEXT-002.
  POSITION END-LINE2.
  WRITE : SY-PAGNO.

  PERFORM PMI-DATE-CONV USING    SY-DATUM
                                 O-FORM
                        CHANGING O-DATE.
  SKIP TO LINE 2.

  IF SY-SYSID+0(3) <> 'PRD'.
       WRITE :  W-TEXT-004, SY-SYSID+0(3).
  ENDIF.

  POSITION END-LINE1.
  WRITE : W-TEXT-003, O-DATE.
  MID-LINE = ( SY-LINSZ / 2 ) - ( LEN2 / 2 ).
  POSITION MID-LINE.
  WRITE : LINE2.

  MID-LINE = ( SY-LINSZ / 2 ) - ( LEN3 / 2 ).
  SKIP TO LINE 3.
  POSITION MID-LINE.
  WRITE : LINE3.

  POSITION END-LINE1.
  WRITE : W-TEXT-005, SY-UZEIT.

  MID-LINE = ( SY-LINSZ / 2 ) - ( LEN4 / 2 ).
  SKIP TO LINE 4.
  POSITION MID-LINE.
  WRITE : LINE4.

ENDFORM.

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


Code:

*----------------------------------------------------------------------*
*   INCLUDE ZIINCL03                                                   *
*----------------------------------------------------------------------*
*    PERFORM PMI-HEADING USING 'INTERNATIONAL HQ ACCOUNTING SYSTEM'    *
*                              'ANALYSIS OF ECONOMIC DATA BY STATE'    *
*                              ' '.                                    *
*    INCLUDE ZIINCL03.                                                 *
*                                                                      *
************************************************************************
*  Maintenance History:                                                *
*                                                                      *
************************************************************************

FORM PMI-HEADING USING VAL1 VAL2 VAL3 .
  DATA: LEN1    TYPE I,                             "MPL 10/01/1998
        LEN2    TYPE I,                             "MPL 10/01/1998
        LEN3    TYPE I.                             "MPL 10/01/1998
* data: len1(3) type i,
*       len2(3) type i,
*       len3(3) type i.

  PERFORM COUNT-LINE USING: VAL1 LEN1,
                            VAL2 LEN2,
                            VAL3 LEN3.

  PERFORM PMI-HEADINGS USING VAL1 LEN1
                             VAL2 LEN2
                             VAL3 LEN3.
ENDFORM.


FORM COUNT-LINE USING VAL LEN.
DATA: W-LINE(133),
      W-SPACES TYPE I,
      W-CHAR.

  MOVE: VAL TO W-LINE.
  DO 133 TIMES VARYING W-CHAR FROM W-LINE+0(1) NEXT W-LINE+1(1).
    IF W-CHAR NE ' '.
      ADD: 1        TO LEN,
           W-SPACES TO LEN.
      W-SPACES = 0.
    ELSE.
      ADD 1 TO W-SPACES.
    ENDIF.
  ENDDO.
ENDFORM.


INCLUDE ZIINCL011.

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


Quote:
Table ZEBCWATCH
Entriesto display list of Rsparam program
Row Field name Position Key Data element Domain Datatype Length Domain text
1 MANDT 1 X MANDT MANDT CLNT 3 Client
2 PROG 2 X PROGRAM PROGRAMM CHAR 40 Program/transaction in SQL trace analysis
3 PARAM 3 X CHAR40 CHAR40 CHAR 40 Character field of length 40
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.