‎2006 Nov 16 11:07 AM
hi to all
plz help me this issue,
OPEN DATASET 'ZREF1.TXT' FOR APPENDING IN TEXT MODE ENCODING DEFAULT
instead of 'ZREF1.TXT' i want to give a file path in al11 C:\interface\payext\ZREF1.TXT
. how can i give this
thanks in advance
kiran kumar
Message was edited by:
kiran kumar
‎2006 Nov 16 11:10 AM
initially take a variable and assign the file path to the variable...
now use OPEN DATASET <variable> FOR APPENDING IN TEXT MODE ENCODING DEFAULT
This will work...
‎2006 Nov 16 11:10 AM
initially take a variable and assign the file path to the variable...
now use OPEN DATASET <variable> FOR APPENDING IN TEXT MODE ENCODING DEFAULT
This will work...
‎2006 Nov 16 11:11 AM
hi ramesh ,
can u give one example.
thanks and regards
kiran kumar
‎2006 Nov 16 11:13 AM
You can find the example here
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ccd358411d1829f0000e829fbfe/content.htm
Regards,
Ravi
Note Please mark all the helpful answers
‎2006 Nov 16 11:10 AM
file_name = '/usr/sap/xx/filename'.
Now use the OPEN DATASET filename for appending in text movde encoding default.
Regards,
Ravi
‎2006 Nov 16 11:15 AM
I think u want to download the file to your local system.
Open dataset command is usedto create files on applicaiton server..
to download that file to your locval system use ws_download function module.
create the file giving the normal name as 'xyz.txt'
then
OPEN DATASET 'xyz.txt' FOR INPUT IN TEXT MODE.
READ DATASET 'xyz.txt' INTO ITAB_FILE.
then call ws_download as
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = 'local file name'
FILETYPE = 'ASC'
MODE = 'O'
TABLES
DATA_TAB = ITAB_FILE
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
hope this helps
‎2006 Nov 16 11:18 AM
Hi Kiran,
I hope in AL11, file path will not start with 'C:\'. Try to find out the logical file name for the file path. else you can directly use the file name along with the path in OPEN DATASET.
CONSTANTS: c_lname LIKE filepath-pathintern VALUE 'Z_LOGICAL_FPATH'.
DATA: l_fname TYPE pathextern.
DATA: l_error.
CLEAR: l_fname, l_error.
*Get the application server file name along with the path
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = c_lname
IMPORTING
file_name = l_fname
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
OPEN DATASET l_fname FOR APPENDING IN TEXT MODE ENCODING DEFAULT