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

File Location When Using Open Dataset

Former Member
0 Likes
3,825

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,144

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

9 REPLIES 9
Read only

Peter_Inotai
Active Contributor
0 Likes
2,144

Hi,

You have to use CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD, if y ou wish to download to your PC.

Best regards,

Peter

Read only

Former Member
0 Likes
2,145

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

Read only

0 Likes
2,144

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.

Read only

Former Member
0 Likes
2,144

hi,

Open data set is used only for files on application server.

Regards

Sailaja.

Read only

Former Member
0 Likes
2,144

OPEN DATASET is used to open files in application server

use GUI_UPLOAD FM and store the data in internal table

Read only

andreas_mann3
Active Contributor
0 Likes
2,144

or transfer yor file to application server with tcode CG3Z

A.

Read only

Former Member
0 Likes
2,144

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?

Read only

0 Likes
2,144

Would help if the file wasn't blank - sorry all.

Raj

Read only

Former Member
0 Likes
2,144

Would help if the file wasn't blank - sorry all.

Raj