
The Function Module FILE_GET_NAME
Platform-independent file names are used in applications programs by the function module FILE_GET_NAME. For a given logical file name, the function module generates the corresponding platform-specific file name at runtime, based on definitions stored in customizing tables for converting platform-independent file names.
The following table gives an overview of its import and export parameters and of its exceptions.
Table: Interface of function module FILE_GET_NAME
IMPORT parameter |
Function |
CLIENT |
Logical file names can be client-specific. Here you can specify the client to be used. The current client as stored in the system field SY-MANDT is used as default. |
LOGICAL_FILENAME |
Here you specify the logical filename. (Uppercase letters must be used!) |
OPERATING_SYSTEM |
Here you can specify the operating system for which to generate the appropriate file name. The application server's operating system as stored in the system field SY-OPSYS is used as default. |
PARAMETER_1 PARAMETER_2 |
Here you can specify values that substitute the placeholders <PARAM_1> and <PARAM_2> in physical file names and paths. |
USE_PRESENTATION |
Specifies that the presentation server's operating system be used as the basis for generating a platform-specific file name. |
WITH_FILE_EXTENSION |
Specifies that the logical file name's data format be used as filename extension. |
USE_BUFFER |
Specifies that the customizing tables for converting platform-independent file names be buffered in main memory. |
EXPORT parameter |
Function |
EMERGENCY_FLAG |
If the returned value is not SPACE, then no physical path has been found for the logical filename under the current operating system. In this case the path specified in the profile parameter DIR_GLOBAL will be used as physical path. |
FILE_FORMAT |
Returns the data format defined for the logical file name. You can use this parameter to decide in which mode to open the file. It is also required as a parameter for DOWNLOAD of files to the presentation server. |
FILE_NAME |
Returns the fully instantiated platform-specific file name and path. |
Exceptions |
Function |
FILE_NOT_FOUND |
Raised if logical file name is not defined. |
OTHERS |
Raised if other errors occur. |

If the function module cannot find a physical path for the current operating system (see parameter EMERGENCY_FLAG), this may have various causes:

Assume that in the customizing tables for platform-independent file names the following definitions exist for the logical file name DATA_FILE and the logical path DATA_PATH:
DATA_FILE phys. file: file<PARAM_1>
data format: BIN
logical path: DATA_PATH
DATA_PATH syntax group: UNIX phys. path: /tmp/<FILENAME>
syntax group: DOS phys. path: c:\tmp\<FILENAME>
Assume also that the application server's operating system has been assigned to syntax group UNIX while the presentation server's operating system has been assigned to syntax group DOS.
The following two calls of the function module will then return the respective values.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = 'DATA_FILE'
PARAMETER_1 = '01'
IMPORTING
EMERGENCY_FLAG = FLAG
FILE_FORMAT = FORMAT
FILE_NAME = FNAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
Returned values:
FLAG:
FORMAT: BIN
FNAME: /tmp/file01
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = 'DATA_FILE'
USE_PRESENTATION_SERVER = X
WITH_FILE_EXTENSION = X
IMPORTING
EMERGENCY_FLAG = FLAG
FILE_FORMAT = FORMAT
FILE_NAME = FNAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
Returned values:
FLAG:
FORMAT: BIN
FNAME: c:\tmp\FILE.BIN