2008 Feb 06 11:45 AM
Hi,
Is it possible to create a logical filename for the physical filename that I have in SAP? Is there any function module to create the logical filename?
Thanks,
Dishant
Hi,
Is it possible to create a logical filename for the physical filename that I have in SAP? Is there any function module to create the logical filename?
Thanks,
Dishant
2008 Feb 06 11:46 AM
2008 Feb 06 11:51 AM
Hi Amit,
I know that but if the user changes the path at runtime then how will I get the logical filename? Is it possible to create this dynamically?
Thanks,
Dishant
2008 Feb 06 11:52 AM
hi,
To create a physical file name from a logical file name in your ABAP programs, use the function module FILE_GET_NAME. To insert the function module call in your program, choose Edit ® Insert statement from the ABAP Editor screen. A dialog box appears. Select Call Function and enter FILE_GET_NAME. The parameters of this function module are listed below.
Import parameters
Parameters
Function
CLIENT
The maintenance tables for the logical files and paths are client-dependent. Therefore, the desired client can be imported. The current client is stored in the system field SY-MANDT.
LOGICAL_FILENAME
Enter the logical file name in upper case letters that you want to convert.
OPERATING_SYSTEM
You can import any operating system that is contained in the list in Transaction SF04 (see Assigning Operating Systems to Syntax Groups). The physical file name will be created according to the syntax group to which the operating system is linked. The default parameter is the value of the system field
SY-OPSYS.
PARAMETER_1
PARAMETER_2
If you specify these import parameters, the reserved words in the physical path names will be replaced by the imported values.
USE_PRESENTATION
_SERVER
With this flag you can decide whether to import the operating system of the presentation server instead of the operating system imported by the parameter OPERATING_SYSTEM.
WITH_FILE_EXTENSION
If you set this flag unequal to SPACE, the file format defined for the logical file name is appended to the physical file name.
Export Parameters
Parameters
Function
EMERGENCY_FLAG
If this parameter is unequal to SPACE, no physical name is defined in the logical path. An emergency physical name was created from table FILENAME and profile parameter DIR_GLOBAL.
FILE_FORMAT
This parameter is the file format defined for the logical file name. You can use this parameter, for example, to decide in which mode the file should be opened.
FILE_NAME
This parameter is the physical file name that you can use with the ABAP statements for working with files.
Exception Parameters
Parameters
Function
FILE_NOT_FOUND
This exception is raised if the logical file is not defined.
OTHERS
This exception is raised if other errors occur.
Suppose the logical file MYTEMP and the logical path TMP_SUB are defined as in the preceding topics and we have the following program:
DATA: FLAG,
FORMAT(3),
FNAME(60).
WRITE SY-OPSYS.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
LOGICAL_FILENAME = 'MYTEMP'
OPERATING_SYSTEM = SY-OPSYS
PARAMETER_1 = '01'
IMPORTING
EMERGENCY_FLAG = FLAG
FILE_FORMAT = FORMAT
FILE_NAME = FNAME
EXCEPTIONS
FILE_NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE: / 'Flag :', FLAG,
/ 'Format :', FORMAT,
/ 'Phys. Name:', FNAME.
ENDIF.
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 6, 2008 5:20 PM
2008 Feb 06 11:55 AM
Hi,
Thanks.Already tried this.Does not solve my problem.I want the logical filename to be created automatically :(.
Thanks,
Dishant
2008 Feb 06 12:05 PM
hi
good
You can call the Logical database using Function Module - LDB_PROCESS. There is enough documentation available in the FM itself on how to directly use in ABAP Code.
thanks
mrutyun^