Using File Name Aliases 
To give the system administrator more flexibility and to enable the reuse of existing logical file names, the logical file name concept was extended to support the use of aliases in the logical file name validation context.
The system administrator can maintain aliases for a logical file name using the view V_FILEALIA. (In releases <= 4.6C, use the view V_FILEA31I.)
The program EXAMPLE_FILE_ACCESS uses the logical file name EXAMPLE_FIN1 to validate the input of a physical file name. The program is used by two different groups of business users. The system administrator and the business team agreed upon two different directories in the application server file system where the users should create their files. The system administrator creates two new logical file names and defines each as an alias for EXAMPLE_FIN1. This is shown in the tables below.
The first table shows the assignment of the two alias logical file names to the logical file name used by the application, EXAMPLE_FIN1. The second table shows the customizing table that maps the logical file name to the resulting physical file name.
Logical File Name From Application | Sequential Number | Alias Logical File Name |
|---|---|---|
EXAMPLE_FIN1 | 001 | ZZ_LOGFILE1 |
EXAMPLE_FIN1 | 010 | ZZ_LOGFILE2 |
The program EXAMPLE_FILE_ACCESS uses the logical file name EXAMPLE_FIN1 to validate the input of a physical file name. The program is used by two different groups of business users. The system administrator and the business team agreed upon two different directories in the application server file system where the users should create their files. The system administrator creates two new logical file names and defines each as an alias for EXAMPLE_FIN1.
Logical File | Resulting Physical File Name |
|---|---|
EXAMPLE_FIN1 | - |
ZZ_LOGFILE1 | /usr/SAP/PRD_100/home/FIN/EXAMPLE_FILE_ACCESS/group1/ |
ZZ_LOGFILE2 | /usr/SAP/PRD_100/home/FIN/EXAMPLE_FILE_ACCESS/group2/ |
Program EXAMPLE_FILE_ACCESS calls the function module FILE_VALIDATE_NAME, providing the physical file name entered by the user as well as the hard-coded logical file name EXAMPLE_FIN1. The function module logic will determine all defined aliases and compare the physical file name with that provided for each alias.
Note
The profile parameter DIR_HOME is specified as /usr/SAP/PRD_100/home/. This is the default directory used for OPEN DATASET and related statements if no path is specified when the command is executed.
The following table shows the validation results for the corresponding user input.
User Input | Validation Result |
|---|---|
File1.asc | Access is denied because the normalized physical file name would be /usr/SAP/PRD_100/home/File1.asc. |
../etc/pwd/File1.asc | Access is denied because the normalized physical file name would be /usr/SAP/PRD_100/etc/pwd/File1.asc. |
FIN/EXAMPLE_ACCESS/group1/File.asc | Access is granted because the path is correct according to the alias entry ZZ_LOGFILE1. The validation check for alias ZZ_LOGFILE2 is not processed. |
Note
In the above example it is still possible for the users from the two different groups to overwrite the files of each other. You may have scenarios where this must be avoided (for example, because a file with the wrong content in the wrong directory could disrupt the business process). In such a scenario, the system administrator needs to find a way to distinguish between the users of the user groups, for example, by using exit function modules or by providing parameter values from the selection screen to be included in the file name.