Skip to end of metadata
Go to start of metadata
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'
REPORT ZUSRTRAN MESSAGE-ID ZZ NO STANDARD PAGE HEADING
       LINE-SIZE 132 LINE-COUNT 65.
********************************************************************
* This program SCANS a transaction Code and Shows Authority       **
* Checks being Used.  Also shows Objects being checked for        **
* that Transaction.                                               **
********************************************************************
TABLES: TRDIR, TSTC, TSTCA.
PARAMETERS: BNAME LIKE USR04-BNAME DEFAULT SY-UNAME.
DATA: COUNTFOUNDOBJ TYPE P.
DATA: RPT2IND.
DATA: BEGIN OF TABVAL OCCURS 500,
         USERID     LIKE  USR04-BNAME,
         PROFILE    LIKE  XU213-PROFILE,
         OBJECT     LIKE  USR12-OBJCT,
         RULE       LIKE  USR12-AUTH,  "Authorization
         SFIELD     LIKE  TOBJ-FIEL1,  "Field Name
         VON(18),                      "Value From
         BIS(18),                      "Value To
         USEDINREPORTALREADY,
      END OF TABVAL.
DATA: BEGIN OF TAB3 OCCURS 10,
      SIGN(1),
      OPTION(2),
      LOW LIKE USR04-BNAME,
      HIGH LIKE USR04-BNAME,
        END OF TAB3.
SELECT-OPTIONS: TCODE FOR TSTC-TCODE.
DATA:       SSTRING(20) VALUE 'AUTHORITY-CHECK',
            INCLU       VALUE   'X',
            MASK.
DATA:TEMPTEXT(80).
DATA:LIT1 VALUE ''''.
DATA: HIT_COUNT TYPE I,
      TEXT_LINE(79).
DATA: BEGIN OF ITAB OCCURS 50,
        REPNAME LIKE SY-REPID,
      END OF ITAB,
      BEGIN OF FTAB OCCURS 500,
        TCODE LIKE TSTC-TCODE,
        OBJECT LIKE USR12-OBJCT,
        TEXT(72),
     END OF FTAB,
     BEGIN OF RTAB OCCURS 1000,
       TEXT(72),
     END OF RTAB.
START-OF-SELECTION.
  REFRESH TAB3.
  CLEAR TAB3.
  MOVE BNAME TO TAB3-LOW.
  MOVE 'EQ'  TO TAB3-OPTION.
  MOVE 'I'   TO TAB3-SIGN.
  APPEND TAB3.
  SUBMIT ZAUTHRPT
     WITH BNAME IN TAB3
     WITH DO-EXPRT = 'X'
     AND RETURN.
  IMPORT TABVAL FROM MEMORY ID 'ZAUTHRPT'.
  SELECT  * FROM  TSTC
         WHERE  TCODE IN TCODE.
    SELECT  * FROM TSTCA WHERE TCODE EQ TSTC-TCODE.
      CLEAR FTAB.
      MOVE TSTCA-TCODE   TO FTAB-TCODE.
      MOVE TSTCA-OBJCT   TO FTAB-OBJECT.
      COLLECT FTAB.
    ENDSELECT.
    SELECT SINGLE * FROM TRDIR
      WHERE NAME = TSTC-PGMNA.
    IF NOT INCLU IS INITIAL.
      CALL FUNCTION 'GET_INCLUDES'
        EXPORTING
          PROGNAME = TRDIR-NAME
        TABLES
          INCLTAB  = ITAB.
    ENDIF.
    ITAB-REPNAME = TRDIR-NAME.
    INSERT ITAB INDEX 1.
    LOOP AT ITAB.
      READ REPORT ITAB-REPNAME INTO RTAB.
      IF MASK IS INITIAL.
        SEARCH RTAB FOR SSTRING.
        CHECK SY-SUBRC = 0.
      ELSE.
        SY-TABIX = 1.
      ENDIF.
      LOOP AT RTAB FROM SY-TABIX.
        CASE MASK.
          WHEN SPACE.
            IF RTAB-TEXT CS SSTRING.
              PERFORM APPEND_FTAB.
            ENDIF.
          WHEN OTHERS.
            IF RTAB-TEXT CP SSTRING.
              PERFORM APPEND_FTAB.
            ENDIF.
        ENDCASE.
      ENDLOOP.
    ENDLOOP.
    FREE: ITAB.
  ENDSELECT.
  SORT FTAB BY TCODE OBJECT.
  DESCRIBE TABLE FTAB LINES HIT_COUNT.
  IF HIT_COUNT = 0.
    WRITE: / 'No Authority Checks Found in Transactions'.
  ELSE.
    SY-TVAR1 = SSTRING.
    PERFORM DISPLAY_FTAB.
  ENDIF.
  MOVE 'Y' TO RPT2IND.
  NEW-PAGE.
  SORT TABVAL BY OBJECT.
  LOOP AT TABVAL WHERE USEDINREPORTALREADY NE 'Y'.
    WRITE: /01 TABVAL-USERID,
            14 TABVAL-PROFILE,
            27 TABVAL-OBJECT,
            38 TABVAL-RULE,
            51 TABVAL-SFIELD,
            62 TABVAL-VON,
            81 TABVAL-BIS.
  ENDLOOP.
*---------------------------------------------------------------------*
*       FORM APPEND_FTAB                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM APPEND_FTAB.
  CLEAR FTAB.
  FTAB-TEXT    = RTAB-TEXT.
  PERFORM MOVE-IN-OBJECT USING FTAB-TEXT.
  MOVE TSTC-TCODE TO FTAB-TCODE.
  CLEAR FTAB-TEXT.
  COLLECT FTAB.
ENDFORM.                    "APPEND_FTAB
*---------------------------------------------------------------------*
*       FORM MOVE-IN-OBJECT                                           *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  -->  FTABTEXT                                                     *
*---------------------------------------------------------------------*
FORM MOVE-IN-OBJECT USING FTABTEXT.
  MOVE FTABTEXT TO TEMPTEXT.
  DO 80 TIMES.
    IF TEMPTEXT(1) NE LIT1.
      SHIFT TEMPTEXT.
    ENDIF.
  ENDDO.
* move TEMPTEXT to ftab-object.
  REPLACE LIT1 WITH ' ' INTO TEMPTEXT.
  REPLACE LIT1 WITH ' ' INTO TEMPTEXT.
  IF TEMPTEXT(1) EQ ' '.
    SHIFT TEMPTEXT.
  ENDIF.
  MOVE TEMPTEXT TO FTAB-OBJECT.
ENDFORM.                    "MOVE-IN-OBJECT
*---------------------------------------------------------------------*
*       FORM DISPLAY_FTAB                                             *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
FORM DISPLAY_FTAB.
  LOOP AT FTAB.
    IF NOT FTAB-OBJECT IS INITIAL.
      WRITE: /  'Transaction Code =', FTAB-TCODE.
      CLEAR COUNTFOUNDOBJ.
      LOOP AT TABVAL WHERE OBJECT EQ FTAB-OBJECT.
        IF COUNTFOUNDOBJ    EQ 0.
          WRITE: /01 'User ID',
                  14 'Profile',
                  27 'Object',
                  38 'Rule',
                  51 'Field',
                  62 'Value From',
                  81 'Value To'.
        ENDIF.
        ADD 1 TO COUNTFOUNDOBJ.
        WRITE: /01 TABVAL-USERID,
                14 TABVAL-PROFILE,
                27 TABVAL-OBJECT,
                38 TABVAL-RULE,
                51 TABVAL-SFIELD,
                62 TABVAL-VON,
                81 TABVAL-BIS.
        MOVE 'Y' TO TABVAL-USEDINREPORTALREADY.
        MODIFY TABVAL.
      ENDLOOP.
      IF COUNTFOUNDOBJ EQ 0.
        WRITE: / 'No Data Found for Object', FTAB-OBJECT.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFORM.                    "DISPLAY_FTAB
INCLUDE ZCONINC3.
IF RPT2IND EQ 'Y'.
  WRITE: / 'List of Other Authority Check for User', BNAME,
           'Not Used in Selected Transactions'.
  WRITE: /01 'User ID',
          14 'Profile',
          27 'Object',
          38 'Rule',
          51 'Field',
          62 'Value From',
          81 'Value To'.
ELSE.
  WRITE: / 'User Name', BNAME.
ENDIF.
  • No labels