Ansicht
Dokumentation

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

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

ROGBILLS - Synchronize billing plans   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

Function

SAP 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 gets the corresponding physical file name for a logical file name and the file format for UPLOAD and DOWNLOAD if required.
For this to work for different platforms, a logical file path must be assigned to the logical file name, which itself must have OS-dependent physical file paths defined. The file name provided by the function module is then created from the physical file path valid for the current operating system and the physical file name. Any placeholders in the physical file name and the path are replaced by current values at runtime.

Examples

logical file name: MONTHLY_SALES_FILE
physical file name: VALUES<PARAM_1>
logical path: SALES_DATA_PATH
physical path (UNIX): /usr/<SYSID>/<FILENAME>
physical path (Windows): C:\SALES\<FILENAME>

  • 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 (parameter passing)
    (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

More Information

All definitions needed for the platform-independent assignment of file names are defined as cross-client definitions using transaction FILE. This data can be listed with the transaction SF07. Transaction SF01 defines logical file names for the current client.

The following concepts are used in the assignment of 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 the physical file name only; placeholders are substituted by current values.
  • 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. It must contain the reserved word <FILENAME> as a placeholder for the file name.
  • Operating system
    Presentation servers and application servers can run on different operating systems. The current values can be found in the following sources:
  • Application server: System field SY-OPSYS

  • Presentation server: Function module WS_QUERY

Both operating systems must be defined and assigned to a syntax group. The current values of the application server and the presentation server are added automatically when the table is edited (if not yet defined).
  • Syntax group
    Group of operating systems with a common syntax for file and path names (e.g. HP-UX and SINIX).
  • Placeholders
    Reserved words, set in angle brackets, which can be included in physical file and path names (for example, <DATE> , <FILENAME>). You can find information about possible reserved words in the online help (F1 help) for the fields physical file name and physical file path when editing platform-independent file names using transaction FILE.

If required
If the logical path associated with a logical file name does not specify a physical path for the current operating system (syntax group), the path stored in the profile parameter DIR_GLOBAL of the current system is used for creating a complete platform-specific file name.

name.





Parameters

CLIENT
ELEMINATE_BLANKS
EMERGENCY_FLAG
FILE_FORMAT
FILE_NAME
INCLUDING_DIR
LOGICAL_FILENAME
OPERATING_SYSTEM
PARAMETER_1
PARAMETER_2
PARAMETER_3
USE_BUFFER
USE_PRESENTATION_SERVER
WITH_FILE_EXTENSION

Exceptions

FILE_NOT_FOUND

Function Group

SFIL

RFUMSV00 - Advance Return for Tax on Sales/Purchases   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 8506 Date: 20240604 Time: 061355     sap01-206 ( 78 ms )