Applying Multiple Authority-checks in ABAP Program

Multiple Authority-checks mainly depends on hierarchy of Authorizations apart from its dependency on the way pragrammer handles it.

Multiple Authority-checks can be of two types depending upon the programming logic and needs.


(a) A programmer can suppose, that if the first AUTHORITY-CHECK fails, the program shouldn’t test the others, but try to elaborate the next data:
LOOP AT ITAB.
 
   AUTHORITY-CHECK OBJECT <OBJ>
      ID <FIELD> FIELD <VALUE>.
 IF SY-SUBRC  0.
      CONTINUE. ” Check next record
 ELSE.
         AUTHORITY-CHECK OBJECT <OBJ2>
           ID <FIELD> FIELD <VALUE>.
      IF SY-SUBRC  0.
     CONTINUE. ” Check next record
      ELSE.
          AUTHORITY-CHECK OBJECT <OBJ3>
                 ID <FIELD> FIELD <VALUE>.
         IF SY-SUBRC  0.
      … Commands/Processing …
       ENDIF.
      ENDIF.
 ENDIF.
ENDLOOP.
 
In this situation it’s very important the user has all authorization objects of course.

(b) In AUTHORITY-CHECK OBJECT statament only one value can be checked. So it can checks if the user has 02 or 03, not both together.

So if you give 02, the AUTHORITY-CHECK will work for 02 only.

Anway the developer can skip the check for a certain fields of a an authority object

AUTHORITY-CHECK OBJECT <OBJ>
        ID ………………………………….
        ID ACTIVITY FIELD DUMMY.

In this situation the authority-check is not dependent on value of activity.

You might also be interested in these posts:

  1. Authority Check Trace in SAP
  2. ABAP Program for Table Maintenance in SAP
  3. ABAP program to get User Exits and BADI List for a T-Code
  4. ABAP Program to Display SE78 pictures on Screen
  5. ABAP Program to Unlock Login ID in SAP

One Response to “Applying Multiple Authority-checks in ABAP Program”
Jalen Posted on July 24, 2011 at 6:14 PM

Short, sweet, to the point, FREE-eaclxty as information should be!

Post a Comment