01-31-2008 1:28 PM
01-31-2008 1:29 PM
look docu in se37
you get physical filename for your logical file
A.
01-31-2008 1:33 PM
hi mathew,
this is some information on this FM.
he 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
_SERVER
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:
o the operating system is not defined in the customizing tables
o the operating system is not assigned to a syntax group
o no physical path is assigned to the logical path for the relevant syntax group
o no logical path is assigned to the logical file name.
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
<REMOVED BY MODERATOR>
kushagra
Edited by: Alvaro Tejada Galindo on Jan 31, 2008 9:22 AM
01-31-2008 1:46 PM
Hi,
Check this out
http://help.sap.com/saphelp_45b/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
FU FILE_GET_NAME
____________________________________________________
Text
Assign the Physical File Name Using a Logical File Name
Functionality
R/3 applications run on various platforms with various file systems. This function module enables you to use platform-independent logical file names in your application programs.
Based on definitions maintained in customizing tables for platform-independent file names, the function module converts a logical file name to the corresponding physical file name and path for the hardware platform concerned.
For this conversion to work for different platforms, the definition of a logical file name must include a logical file path, which in turn is converted to different physical file paths, depending on the particular platform. The platform-specific file name returned by the function module is composed of the physical file path for the current platform and the physical file name associated with the logical file name. Placeholders in physical file and path names are substituted at runtime by the corresponding current values.
Example
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, 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 file names are maintained client-independently with transaction FILE. Logical file names (but not logical file paths) can also be defined specifically for the current client with transaction SF01. Transaction SF07 generates a list of current definitions.
The following concepts are used in the platform-independent 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. It may also contain other placeholders.
Operating system
Presentation server and application server can run under different operating systems. The current value for the application server can be obtained from the system field SY-OPSYS, the value for the presentation server 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 in physical file and path names (e.g. <DATE>, <FILENAME>). You can find information on possible reserved words in the online help (F1 help) for the fields physical file name and physical file path when maintaining platform-independent file names with transaction FILE.
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 generating a complete platform-specific file name.
Parameters
CLIENT
LOGICAL_FILENAME
OPERATING_SYSTEM
PARAMETER_1
PARAMETER_2
PARAMETER_3
USE_PRESENTATION_SERVER
WITH_FILE_EXTENSION
USE_BUFFER
ELEMINATE_BLANKS
EMERGENCY_FLAG
FILE_FORMAT
FILE_NAME
Exceptions
FILE_NOT_FOUND
Function Group
SFIL
Regards,
Satish
01-31-2008 2:18 PM
Hi,
PLease read below document extracted from SE37 directly.
FU FILE_GET_NAME
____________________________________________________
Text
Assign the Physical File Name Using a Logical File Name
Functionality
R/3 applications run on various platforms with various file systems. This function module enables you to use platform-independent logical file names in your application programs.
Based on definitions maintained in customizing tables for platform-independent file names, the function module converts a logical file name to the corresponding physical file name and path for the hardware platform concerned.
For this conversion to work for different platforms, the definition of a logical file name must include a logical file path, which in turn is converted to different physical file paths, depending on the particular platform. The platform-specific file name returned by the function module is composed of the physical file path for the current platform and the physical file name associated with the logical file name. Placeholders in physical file and path names are substituted at runtime by the corresponding current values.
Example
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, 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 file names are maintained client-independently with transaction FILE. Logical file names (but not logical file paths) can also be defined specifically for the current client with transaction SF01. Transaction SF07 generates a list of current definitions.
The following concepts are used in the platform-independent 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. It may also contain other placeholders.
Operating system
Presentation server and application server can run under different operating systems. The current value for the application server can be obtained from the system field SY-OPSYS, the value for the presentation server 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 in physical file and path names (e.g. <DATE>, <FILENAME>). You can find information on possible reserved words in the online help (F1 help) for the fields physical file name and physical file path when maintaining platform-independent file names with transaction FILE.
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 generating a complete platform-specific file name.
Parameters
CLIENT
LOGICAL_FILENAME
OPERATING_SYSTEM
PARAMETER_1
PARAMETER_2
PARAMETER_3
USE_PRESENTATION_SERVER
WITH_FILE_EXTENSION
USE_BUFFER
ELEMINATE_BLANKS
EMERGENCY_FLAG
FILE_FORMAT
FILE_NAME
Exceptions
FILE_NOT_FOUND
Function Group
SFIL
Thanks,
Sriram Ponna.