Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Logical Filename

Former Member
0 Likes
931

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

5 REPLIES 5
Read only

amit_khare
Active Contributor
0 Likes
853

That is done through TCODE FILE.

Read only

0 Likes
853

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

Read only

Former Member
0 Likes
853

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

Read only

0 Likes
853

Hi,

Thanks.Already tried this.Does not solve my problem.I want the logical filename to be created automatically :(.

Thanks,

Dishant

Read only

Former Member
0 Likes
853

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^