‎2007 May 15 10:45 AM
Hi Guys/Dolls
I'm having problem with the following piece of code.
I think its something to do with the location of the file.
It seems that the open datasource command requires the file to reside on the server but I need my file to reside at C:\LOCALDATA.
Code below returns a sy-subrc of 8; any ideas on how I can make it work.
Many thanks in advance.
C_IFILE = 'C:LOCALDATAHRLAB-070514.TXT'.
C_EFILE = 'C:LOCALDATAHRLAB-070514E01.TXT'.
OPEN DATASET C_IFILE FOR INPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
MESSAGE E001(Z1) WITH C_IFILE.
EXIT.
ENDIF.
OPEN DATASET C_EFILE FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC NE 0.
MESSAGE E002(Z1) WITH C_EFILE.
EXIT.
ENDIF.
‎2007 May 15 10:49 AM
Hi
Where is your file? On Appln server or on Local machine?
this code works when the file is in Server.
If it is on local system, don't use this DATSET concept just use GUI_UPLOAD etc.
Reward points if useful
Regards
Anji
‎2007 May 15 10:48 AM
Hi,
You have to use CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD, if y ou wish to download to your PC.
Best regards,
Peter
‎2007 May 15 10:49 AM
Hi
Where is your file? On Appln server or on Local machine?
this code works when the file is in Server.
If it is on local system, don't use this DATSET concept just use GUI_UPLOAD etc.
Reward points if useful
Regards
Anji
‎2007 May 15 1:53 PM
Hi All
I've tried the code as suggested but don't seem to be getting the contents of the file within the internal table? The value of sy-subrc is 0 after the 'GUI_UPLOAD' statement.
Can you tell me what I am doing wrong?
DATA: ld_filename TYPE string.
DATA: begin of it_datatab occurs 0,
row(500) type c,
end of it_datatab.
ld_filename = ''C:LOCALDATAHRLAB-070514.TXT'.
call function 'GUI_UPLOAD'
exporting
filename = ld_filename
filetype = 'ASC'
tables
data_tab = it_datatab[]
exceptions
file_open_error = 1
file_write_error = 2
others = 3.
IF SY-SUBRC NE 0.
MESSAGE E001(Z1) WITH C_IFILE.
EXIT.
ENDIF.
‎2007 May 15 10:49 AM
hi,
Open data set is used only for files on application server.
Regards
Sailaja.
‎2007 May 15 10:49 AM
OPEN DATASET is used to open files in application server
use GUI_UPLOAD FM and store the data in internal table
‎2007 May 15 10:51 AM
or transfer yor file to application server with tcode CG3Z
A.
‎2007 May 15 2:20 PM
Don't seem to be getting the contents of the file within the internal table? The value of sy-subrc is 0 after the 'GUI_UPLOAD' statement.
Can you tell me what I am doing wrong?
‎2007 May 15 2:31 PM
‎2007 May 15 2:32 PM