‎2006 Sep 27 6:38 AM
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
‎2006 Sep 27 6:43 AM
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
‎2006 Sep 27 6:43 AM
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..
‎2006 Sep 27 6:50 AM
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
‎2006 Sep 27 7:45 AM
‎2006 Sep 27 9:43 AM
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.