REPORT ZEXAMPLE.

DATA: BEGIN OF ITAB OCCURS 0,

ATYPE(20),

END OF ITAB.

PARAMETER P_FNAME LIKE AUTHB-FILENAME.

PARAMETERS: P_READ AS CHECKBOX DEFAULT 'X',

P_WRITE AS CHECKBOX DEFAULT 'X',

P_RWF AS CHECKBOX DEFAULT 'X',

P_WWF AS CHECKBOX DEFAULT 'X',

P_DELETE AS CHECKBOX DEFAULT 'X'.

CLEAR: ITAB, ITAB[].

IF P_READ EQ 'X'.

ITAB-ATYPE = 'READ'.

APPEND ITAB.

ENDIF.

IF P_WRITE EQ 'X'.

ITAB-ATYPE = 'WRITE'.

APPEND ITAB.

ENDIF.

IF P_RWF EQ 'X'.

ITAB-ATYPE = 'READ_WITH_FILTER'.

APPEND ITAB.

ENDIF.

IF P_WWF EQ 'X'.

ITAB-ATYPE = 'WRITE_WITH_FILTER'.

APPEND ITAB.

ENDIF.

IF P_DELETE EQ 'X'.

ITAB-ATYPE = 'DELETE'.

APPEND ITAB.

ENDIF.

LOOP AT ITAB.

CALL FUNCTION 'AUTHORITY_CHECK_DATASET'

EXPORTING

ACTIVITY = ITAB-ATYPE

FILENAME = P_FNAME

EXCEPTIONS

NO_AUTHORITY = 1

ACTIVITY_UNKNOWN = 2

OTHERS = 3.

CASE SY-SUBRC.

WHEN 0.

WRITE:/ 'You have', ITAB-ATYPE, 'access to', P_FNAME.

WHEN 1.

WRITE:/ 'You do not have', ITAB-ATYPE, 'access to', P_FNAME.

WHEN OTHERS.

WRITE:/ 'Error with function'.

ENDCASE.

ENDLOOP.