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 / TCODE FILE

Former Member
0 Likes
3,071

In a selection screen I have put a parameters called p_log type fileintern.

I'd like to read this file, is there any function module that would help me to do this or should I use open dataset....

what if the name look like this
<system>\hello.txt

thanks 4 the help

5 REPLIES 5
Read only

Former Member
0 Likes
1,104

Hi,

If you looking a FM to get the physical file name for a logical file then use the FM FILE_NAME_GET..

If you want to get the file value..Check this code..

DATA: v_buffer(2047) TYPE c.

DATA: BEGIN OF i_buffer OCCURS 0,

line(2047) TYPE c,

END OF i_buffer.

  • Open the unix file..

OPEN DATASET p_unix FOR INPUT IN TEXT MODE.

IF sy-subrc NE 0.

DO.

CLEAR: v_buffer.

READ DATASET p_unix INTO v_buffer.

IF sy-subrc NE 0.

EXIT.

ENDIF.

MOVE v_buffer TO i_buffer.

APPEND i_buffer.

ENDDO.

ENDIF.

Thanks,

naren

Read only

Former Member
0 Likes
1,104

hi,

1. look at FM <b>'FILE_GET_NAME_USING_PATH'</b> to convert the logical file path into physical file (full path)

2. look at FM <b>'FILE_GET_NAME'</b> that Assigns the Physical File Name Using a Logical File Name

reward if useful..

Read only

0 Likes
1,104

Hi Stephan,

We have to use open data set only to read data from Application Server....... FILE_GET_NAME_USING_PATH not used for reading data, just useful when you maintian logical file name using FILE transaction to make file path operating system independent.

Regarding,

Arun

Read only

Former Member
0 Likes
1,104

Use OPEN DATASET and READ DATASET.

Read only

Former Member
0 Likes
1,104

As already mentioned by others..you can use the FM FILE_GET_NAME or FILE_GET_NAME_USING_PATH. Also, you can define the logical to physical file map or name using the transaction FILE.

Also, note that you can define parameters for FILE_GET_NAME and use them for you filename.

Being specific to your case where you want the file name to be
<system>\hello.txt

Using FILE define the physical path as the above "\<sysid>\" and use the FILE_GET_NAME_USING_PATH and pass the filename as "hello.txt" and logical path as defined during FILE transaction....the outcome would be as your requirement.