SAP Function FILE_GET_NAME - Assign the Physical File Name Using a Logical File Name

Parameter Reference Type Length Default Optional Text
CLIENT SYST-MANDT C 3 SY-MANDT X Client for reading the file name table
ELEMINATE_BLANKS SYST-DATAR C 1 'X' X Eliminate blank characters = 'X'
INCLUDING_DIR SYST-DATAR C 1 SPACE X Selection for Screen Field Input
LOGICAL_FILENAME FILENAME-FILEINTERN C 60 Logical file name
OPERATING_SYSTEM SYST-OPSYS C 10 SY-OPSYS X Operating system
PARAMETER_1 0 SPACE X Parameter for variable
PARAMETER_2 0 SPACE X Parameter for variable
PARAMETER_3 0 SPACE X Parameter for variable
USE_BUFFER 0 SPACE X Buffering flag
USE_PRESENTATION_SERVER 0 SPACE X Use SAPtemu operating system
WITH_FILE_EXTENSION 0 SPACE X Append file format to file names

Parameter Reference Type Length Text
EMERGENCY_FLAG 0 Fall-back operation required flag
FILE_FORMAT FILENAME-FILEFORMAT C 3 File format
FILE_NAME 0 Physical file name

Exception Text
FILE_NOT_FOUND Logical file name is unknown

Functionality
R/3 applications run on various platforms with variousfile systems. This function module enables you to useplatform-independent logical file names in your application programs.
Based on definitions maintained in customizing tables forplatform-independent file names, the function module converts a logicalfile name to the corresponding physical file name and path for thehardware platform concerned.
For this conversion to work for different platforms, the definition ofa logical file name must include a logical file path, which in turn isconverted to different physical file paths, depending on the particularplatform. The platform-specific file name returned by the functionmodule is composed of the physical file path for the current platformand the physical file name associated with the logical file name.Placeholders in physical file and path names are substituted at runtimeby the corresponding current values.
logical file name:,,MONTHLY_SALES_FILE
physical file name:,,VALUES
logical path:,,SALES_DATA_PATH
physical path (UNIX):,,/usr//
physical path (Windows):,,C:\SALES\

  • Example 1

  • Get file name for UNIX platform
    (current system: K11)
    CALL FUNCTION 'FILE_GET_NAME'
    EXPORTING
    LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
    IMPORTING
    FILE_NAME = FILE
    FILE_FORMAT = FORMAT.
    Result:
    FILE = /usr/K11/VALUES
    FORMAT = WK1
    • Example 2

    • Get file name for UNIX platform, passing a parameter
      (current system: K11)
      CALL FUNCTION 'FILE_GET_NAME'
      EXPORTING
      LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
      PARAMETER_1 = '_TST'
      IMPORTING
      FILE_NAME = FILE
      FILE_FORMAT = FORMAT.
      Result:
      FILE = /usr/K11/VALUES_TST
      FORMAT = WK1
      • Example 3

      • Get file name for WINDOWS platform, with file name extension
        CALL FUNCTION 'FILE_GET_NAME'
        EXPORTING
        LOGICAL_FILENAME = 'MONTHLY_SALES_FILE'
        WITH_FILE_EXTENSION = 'X'
        IMPORTING
        FILE_NAME = FILE
        FILE_FORMAT = FORMAT.
        Result:
        FILE = C:\SALES\VALUES.WK1
        FORMAT = WK1

        Notes
        All definitions needed for the platform-independent assignment of filenames are maintained client-independently with transaction FILE.Logical file names (but not logical file paths) can alsobe defined specifically for the current client with transactionSF01. Transaction SF07 generates a list of currentdefinitions.
        The following concepts are used in the platform-independent assignmentof file names:

        • Logical file name

        • A descriptive name for a file which is associated with these values:
          physical file name
          file format
          logical file path.
          If no logical file path is specified, the function module returns thephysical file name only; placeholders are substituted by currentvalues.
          • Physical file name

          • The physical file name may contain placeholders.
            • Logical file path

            • A descriptive name for a path which is associated with these values:
              syntax groups (groups of operating systems)
              physical file paths.
              • Physical file path

              • The physical file path is defined for a particular syntax group. Itmust contain the reserved word as a placeholder for the filename. It may also contain other placeholders.
                • Operating system

                • Presentation server and application server can run under differentoperating systems. The current value for the application server can beobtained from the system field SY-OPSYS, the value for the presentationserver by calling function module WS_QUERY.
                  Both operating systems must be defined and assigned to a syntax group.
                  • Syntax group

                  • Group of operating systems with a common syntax for file and path names(e.g. HP-UX and SINIX).
                    • Placeholder

                    • Reserved words, set in angle brackets, which can be included inphysical file and path names (e.g. , ). You can findinformation on possible reserved words in the online help (F1 help) forthe fields physical file name andphysical file path when maintainingplatform-independent file names with transaction FILE.
                      If the logical path associated with a logical file name does notspecify a physical path for the current operating system (syntaxgroup), the path stored in the profile parameter DIR_GLOBAL of thecurrent system is used for generating a complete platform-specific filename.

                      Description
                      If the parameter EMERGENCY_FLAG does not have the value SPACE, then nophysical file path was found for the file. In this case, the pathstored in the profile parameter DIR_GLOBAL is used for generating theplatform-specific file name.
                      Possible causes are:

                      • the logical file path is unknown

                      • the operating system is not defined

                      • the operating system is not assigned to a group

                      • no physical file path is stored for the operating system group
                      • Description
                        Here, the file format defined for the logical file name is returned.You need this value for downloading files to the presentation server.

                        Description
                        Here, the platform-specific file name and path are returned, completelyinstantiated.
                        File systems can differ as to the use of mixed-case letters in file andpath names. If mixed-case physical file and path names have been storedthen a new file may be created in one system, while an existing file isoverwritten in another system.
                        Example:
                        The file names ABCD.C and Abcd.c are different in UNIX,however they both translate to the same file name in DOS.

                        Description
                        Logical file name definitions can be client-specific. If you do notwant to use the file name definition of the current client, you canspecify the client to be used.

                        Default
                        Value of system field SY-MANDT (current client).

                        Description
                        This indicator defines whether all spaces are to be removed from thereturned file names.
                        If this indicator is set, all spaces are removed.
                        If the indicator is not set, only the leading spaces are removed.Spaces within the file name are retained. This can lead to problems,depending on how the file name is used. If you use it in non-Unicodeprograms, the file names are truncated as of the first space. Formore information, see the documentation for the ABAP file interface.

                        Value range
                        Space or "X" . All other characters are handled as "X".

                        Default
                        "X" This means that all spaces are removed from file names.

                        Description
                        Here you specify the platform-independent logical file name.
                        Uppercase letters are required, as this is the format in which logicalfile names are stored in the customizing tables.

                        Value range
                        Any logical file name that has been defined in the customizing tablesfor platform-independent file names.

                        Description
                        Here you can specify the operating system for which theplatform-specific file name is to be generated.
                        The value of this parameter is also used for substituting the reservedword in physical file and path names.

                        Value range
                        Any operating system defined in the customizing tables forplatform-independent file names.

                        Default
                        Value of system field SY-OPSYS (operating system of applicationserver).

                        Description
                        The reserved word in physical file and path names is replacedby the contents of the parameter PARAMETER_1. If no value is specified,the reserved word is deleted or replaced by blank characters.When you call the function module, you must make sure that the reservedword is given a value.

                        Description
                        The reserved word in physical file and path names is replacedby the contents of the parameter PARAMETER_2. If no value is specified,the reserved word is deleted or replaced by blank characters.When you call the function module, you must make sure that the reservedword is given a value.

                        Description
                        The reserved word in physical file and path names is replacedby the contents of the parameter PARAMETER_3. If no value is specified,the reserved word is deleted or replaced by blank characters.When you call the function module, you must make sure that the reservedword is given a value.

                        Description
                        This flag specifies that control tables are to be buffered.
                        If the flag is not set, then entries from control tables for thelogical file name and its logical path are re-read at each functionmodule call.
                        If the flag is set, the function module checks whether the requiredtable entries required have already been read. This setting improvesperformance if the function module is called in a loop.

                        Value range
                        "SPACE" or "not SPACE"

                        Default
                        "SPACE" (unbuffered mode)

                        Description
                        This flag specifies that the operating system of the presentationserver is to be used to determine the file name. As standard, theoperating system is identified by the import parameterOPERATING_SYSTEM.
                        The flag does not affect the replacement of the reserved word in the physical filename.
                        The flag is not evaluated if the function module is called for alogical filename without a logical path.

                        Value range
                        SPACE, not SPACE

                        Default
                        SPACE

                        Description
                        If the value specified here is not SPACE, then the file format of thelogical file name is appended as file name extension to theplatform-specific file name.
                        If no file format is defined for the logical file name, the parameterhas no effect.
                        If the function module is called for a logical file name without alogical path, the parameter is not evaluated.

                        Value range
                        'SPACE', not 'SPACE'

                        Default
                        'SPACE'

148328Operating system upgrade and DATASET_CANT_CLOSE