Skip to Content
avatar image
Former Member

any idea how to use AUTHORITY_CHECK_DATASET

Hello Friends,

anybody knows how to use these FM 'AUTHORITY_CHECK_DATASET' and FILE_GET_NAME_USING_PATH.

i know the logical path has been created in my system as 'zzzzz' but i don't how to use that.

thanks,

john.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Aug 16, 2007 at 01:31 PM

    this object used when u are writing files to application servers ?

    FU FILE_GET_NAME_USING_PATH

    ____________________________________________________

    Short Text

    Generate a complete file name with file name and logical path

    Functionality

    R/3 applications run on various hardware platforms with various file systems. This function module allows you to use platform-independent logical file names in application programs.

    It returns the physical file path with the desired file name for a logical file path.

    An operating system-dependent physical file path must be assigned to the logical file path for this to work for various platforms. The file name returned by the function module is derived from the physical file path of the current operating system and the file name. Place holders in the logical path are replaced at rutime by the current values.

    Example

    Get file names for UNIX platforms

    (current system: K11)

    logical path: SALES_DATA_PATH

    physical path (UNIX): /usr/<SYSID>/<FILENAME>

    CALL FUNCTION 'FILE_GET_NAME_USING_PATH'

    EXPORTING

    LOGICAL_PATH = 'SALES_DATA_PATH'

    FILENAME = 'sales.dat'

    IMPORTING

    FILENAME_WITH_PATH = FILE.

    Result:

    FILE = /usr/K11/sales.dat

    Notes

    Definitions required for the platform-independent assignment of file names are maintained client-independently with the transaction FILE. This data can be listed with the transaction SF07.

    Parameters

    CLIENT

    LOGICAL_PATH

    OPERATING_SYSTEM

    PARAMETER_1

    PARAMETER_2

    PARAMETER_3

    USE_BUFFER

    FILE_NAME

    USE_PRESENTATION_SERVER

    ELEMINATE_BLANKS

    FILE_NAME_WITH_PATH

    Exceptions

    PATH_NOT_FOUND

    MISSING_PARAMETER

    OPERATING_SYSTEM_NOT_FOUND

    FILE_SYSTEM_NOT_FOUND

    Function Group

    SFIL

    FU AUTHORITY_CHECK_DATASET

    ____________________________________________________

    Short Text

    Check Authorization for File Access

    Functionality

    This function module allows you to check authorization to access files (with the key words OPEN DATASET, READ DATASET, TRANSFER and DELETE DATASET). A check should be performed before opening a file.

    The authorization check is performed uwing the authorization object S_DATASET.

    Description of function parameters:

    PROGRAM: Name of the ABAP program from which the file access is performed. If no program name is specified, the system assumes the current program.

    ACTIVITY: Access type. The possible values are:

    READ: Read file

    WRITE: Change file

    READ_WITH_FILTER: Read file with filter function

    WRITE_WITH_FILTER: Change file with filter function

    DELETE: Delete file

    FILENAME: Name of accessed file

    Example

    TYPE-POOLS SABC.

    CALL FUNCTION 'AUTHORITY_CHECK_DATASET'

    EXPORTING PROGRAM = 'ZDATASET'

    ACTIVITY = SABC_ACT_READ

    FILENAME = '/tmp/sapv01'

    EXCEPTIONS NO_AUTHORITY = 1

    ACTIVITY_UNKNOWN = 2.

    Notes

    The values to be passed as the ACTIVITY are defined as constants in the TYPE-POOL SABC.

    Parameters

    PROGRAM

    ACTIVITY

    FILENAME

    Exceptions

    NO_AUTHORITY

    ACTIVITY_UNKNOWN

    Function Group

    SABC

    Regards

    Peram

    Add comment
    10|10000 characters needed characters exceeded

    • I know its an old thread, but maybe it helps someone: I used the following code to test the AUTHORITY_CHECK_DATASET:

      REPORT ZTEST1.

      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.


      Marko