Function Module FILE_VALIDATE_NAMEUsing a logical file name, the function module FILE_VALIDATE_NAME checks if a physical file name corresponds to the rules of the logical file name.
The figure below uses a simplified example to illustrate the functional principle of FILE_VALIDATE_NAME. In this example, the operating system of the application server is Microsoft Windows.

The example program ACCESS_APPLSERVER_FILE knows the logical file name PHYS_FILE_VALIDATION as a constant value.
If a user accesses the file c:\tmp\my_file with the program, the following steps are processed:
● The system calls the function module FILE_VALIDATE_NAME.
● This calls the function module FILE_GET_NAME. The system uses this function module to determine the complete physical file name for the logical file name and the appropriate operating system. The function module returns this value to FILE_VALIDATE_NAME.
● The system compares the two physical file names – on the one hand, from the input on the selection screen, and on the other hand, the value returned from calling FILE_GET_NAME.
● If the two file names match, the user can access the file.
● If the two file names do not match, the function module FILE_VALIDATE_NAME triggers the VALIDATION_FAILED exception. The program can deny the user access to the file.
You do not need to restrict the check to specific file names, but can allow whole areas of a file system to be used as the access target. In this case, the system performs the check only for the path of the stored directory:

The prerequisite for this is that the logical file name has the data format DIR.
Function module FILE_VALIDATE_NAME also performs another function:
If a user has specified a physical file name that contains operating system commands for navigating in the file system, the system interprets this navigation before the comparison with the result from FILE_GET_NAME. The system also converts the physical file name that was found to an absolute file name to allow a proper comparison. In the following example the global work directory is defined as c:\tmp.

This ensures that the user can access only the intended files in this context.
Interfaces of Function Module FILE_VALIDATE_NAME
Import Parameter |
Function |
CLIENT |
Logical file names can also be defined as client-specific. The system uses the definition of the client specified by this parameter. The default value is the current client as specified in system field SY‑MANDT. |
LOGICAL_FILENAME |
Logical file name that is to be used for validation (uppercase is required). |
OPERATING_SYSTEM |
Specifies the operating system for which the file name is to be determined. The default value is the operating system of the application server, as specified in system field SY OPSYS. |
PARAMETER_1 PARAMETER_2 PARAMETER_3 |
Can pass any values to the placeholders labeled <PARAM_1> to <PARAM_3> in the physical file and path names. |
WITH_FILE_EXTENSION |
Indicates that the file format defined for the logical file name is to be attached to the physical file name as a file name extension. |
USE_BUFFER |
Indicates that the control tables are to be buffered. |
ELIMINATE_BLANKS |
Specifies whether all spaces are to be removed from the returned file name. |

The import parameters are passed by FILE_VALIDATE_NAME to FILE_GET_NAME, to determine a physical file name. The system compares this to the content of the CHANGING parameter PHYSICAL_FILENAME. You therefore influence the determination of the physical file name that is used for validation.
Export Parameter |
Function |
VALIDATION_ACTIVE |
If the value is not SPACE, the system could not determine a physical file name for the logical file name or an assigned alias. |
TS_ALIAS |
Sorted table of the defined aliases (including those for the passed logical file name). |
CHANGING Parameter |
Function |
PHYSICAL_FILENAME |
Describes the physical file name that FILE_VALIDATE_NAME compares with the settings of the transferred logical file name. Since the physical file name might need to be normalized, it has the type CHANGING. |
EXCEPTIONS |
Function |
LOGICAL_FILENAME_NOT_FOUND |
Triggered if the function module FILE_GET_NAME has propagated the exception FILE_NOT_FOUND to FILE_VALIDATE_NAME. |
VALIDATION_FAILED |
Triggered if the physical file name in PHYSICAL_FILENAME does not correspond to the restrictions in LOGICAL_FILENAME. |