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

OPEN DATA SET PROBLEM

Former Member
0 Likes
1,654

Hello ,

I use the command OPEN DATA SET in order to upload file content from server ,

the problem is that i getting error :_No such file or directory ._

the file is exist in server I can see it when i put the path on windows start->run

and i give the permission for the folder to everyone .

1. My question is what i miss here

2. when i do little test and try to use GUI_UPLOAD i see the file content so i don't understand what is wrong here the file is not on my local PC

Regards

James

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,578

Hello,

What do you mean by server? Which server is it? Check whether the file is available in the application server through the transaction AL11. Only then will OPEN DATASET will work.

Vikranth

14 REPLIES 14
Read only

Former Member
0 Likes
1,579

Hello,

What do you mean by server? Which server is it? Check whether the file is available in the application server through the transaction AL11. Only then will OPEN DATASET will work.

Vikranth

Read only

0 Likes
1,578

HI Vikranth ,

The file is not exist in AL11 ,it's exist on my colleague server

why do we have to use AL11 ,what is it ?

Regards

James

Read only

0 Likes
1,578

Hello James,

AL11 is the transaction code used to view the files in the Application server of the SAP system. OPEN DATASET is only used to read the files available in the application server. If the file is available in your colleague's server, OPEN DATASET will not work. If GUI_UPLOAD works, that's the way it is.

Vikranth

Read only

0 Likes
1,578

OPEN DATASET cann NOT read files from any server. It can read files from the application server where SAP is runnig at. For any other machine you need a samba share, but dont know if OPEN DATASET can handle samba shares.

Read only

0 Likes
1,578

HI Vikranth,

I have a report that need to run as daily job and upload the file

from server does GUI_UPLOAD works in this case.

And what do you mean by Application server of the SAP system which server is it ?

Regards

James

Read only

0 Likes
1,578

HI Rainer ,

There is a way to upload file from foreign server ?

Regards

James

Read only

0 Likes
1,578

You shuld use the transacion FILE to define logical and phisical paths, then use the funciton 'FILE_GET_NAME_USING_PATH' in your program

CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
    EXPORTING
      client                     = sy-mandt
      logical_path               = l_path
      file_name                  = p_filename
    IMPORTING
      file_name_with_path        = file_trg
    EXCEPTIONS
      path_not_found             = 1
      missing_parameter          = 2
      operating_system_not_found = 3
      file_system_not_found      = 4
      OTHERS                     = 5.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  OPEN DATASET file_trg FOR APPENDING

regards, Sebastian

Read only

0 Likes
1,578

HI Sebastia ,

I want to test it,

what should i put in file_name ?

Regards

James

Read only

0 Likes
1,578

hi James,

the parameter file_name receives the name of the file (ja, ja, ja.......)

here comes the explanation:

in the transaction FILE you must define phisical and logical path for a file:

for example:

MY_FILE => pointing to the folder /host/temp/

and here comes the call to the function in your program:

CALL FUNCTION 'FILE_GET_NAME_USING_PATH'
    EXPORTING
      client                     = sy-mandt
      logical_path               = l_path    " the name of your logical path defined in trx FILE (MY_FILE)
      file_name                  = p_filename " the name of the file you want to read (for example: file.txt     )
    IMPORTING
      file_name_with_path        = file_trg
    EXCEPTIONS
      path_not_found             = 1
      missing_parameter          = 2
      operating_system_not_found = 3
      file_system_not_found      = 4
      OTHERS                     = 5.

in the variable file_trg you should get the value /host/temp/file.txt (from the example) to do the open dataset.

sorry about my english

regards, Sebastiá

Read only

0 Likes
1,578

HI Sebastian ,

Thanks ,

I have created the logical file as you mention in your previous post (via transaction file )

now after do open data set i get subrc = 0 but the problem is that when i read the file

with read data set i get subrc = 4 despite the file is not empty ?

what can be the reason in this case ?

Regards

James

Edited by: James Herb on Mar 25, 2010 9:18 AM

Read only

0 Likes
1,578

Could you please paste the piece of code here, and also mention the file and directory details. There could also be possibility of authorization, or even opening a wrong data set.

thanks,

Kaleem

Read only

0 Likes
1,578

Hello James,

I agree with Kaleemullah, please paste a piece of code to give you a more exact answer.

regards, sebastiá

Read only

Roc31
Participant
0 Likes
1,578

Hi James,

What's your operation system? Unix or Windows?

If for Unix try the directory absolute, sample:

/usr/sap/project/sample.txt

If Windows try:

C:\usr\sap\sample.txt

Regards,

Welinton Rocha

Read only

Former Member
0 Likes
1,578

What you want exactly...

If want to read from application server then only you can use OPEN DATASET

if want to read from presentation then can use GUI_UPLOAD, GUI_DOWNLOAD like...