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

Issues with Open Dataset

Former Member
0 Likes
1,696

I am using the following to open a file:

  OPEN DATASET p_file FOR INPUT IN LEGACY TEXT MODE.

and no matter what file I try to open it fails. I also tried using:

  OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

but I have the same issues. I have verified that p_file contains the filename that I am retrieving. I am getting the filename by using the following on help request for the file:

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    CHANGING
      file_name     = p_file
    EXCEPTIONS
      mask_too_long = 1
      OTHERS        = 2.

Do you have any ideas?

Regards,

Aaron

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,504

It could be a Authorisation Issue. Does the user have authorization to open that file. U can check thru AL11 also.

I am using the following to open a file:

  OPEN DATASET p_file FOR INPUT IN LEGACY TEXT MODE.

and no matter what file I try to open it fails. I also tried using:

  OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.

but I have the same issues. I have verified that p_file contains the filename that I am retrieving. I am getting the filename by using the following on help request for the file:

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
    CHANGING
      file_name     = p_file
    EXCEPTIONS
      mask_too_long = 1
      OTHERS        = 2.

Do you have any ideas?

Regards,

Aaron

12 REPLIES 12
Read only

Former Member
0 Likes
1,505

It could be a Authorisation Issue. Does the user have authorization to open that file. U can check thru AL11 also.

Read only

0 Likes
1,504

Aparna, I was thinking the same but I am the author of the files and my SAP username has SAP_ALL.

Read only

0 Likes
1,504

Hi file path and the file name are case sensitive.. check that..

Read only

0 Likes
1,504

The authorization checked in this case is at the Directory (OS level). You SAP authorization doesnt matter. THe directory you are accessing should have the security setting to allow you to write/read files.

Read only

0 Likes
1,504

Jackandjay, I am not doing anything with the filename so it has to be in the correct case.

It is possible to use this command to open a file that is not on the application server correct? If not then that is the issue. All of these files are on my laptop.

Regards,

Aaron

Read only

0 Likes
1,504

OK, I looked and the directory I am pulling this from isn't in the list. I suppose that is my issue?

Aaron

Read only

0 Likes
1,504

sy-subrc Description

0 File was opened.

8 Operating system could not open file

Read only

0 Likes
1,504

"All of these files are on my laptop."

Use FM GUI_UPLOAD

OPEN/READ/etc are for application server.

Edited by: Paul Chapman on Jun 11, 2008 1:57 PM

Read only

Former Member
0 Likes
1,504

Hi Aaron,

What is the SY-SUBRC value after the OPen dataset statement?

Regards,

Ravi Kanth Talagana

Read only

0 Likes
1,504

sy-subrc = 8.

Read only

Former Member
0 Likes
1,504

have you tried


OPEN DATASET p_file FOR INPUT IN TEXT MODE.

Read only

Former Member
0 Likes
1,504

'KD_GET_FILENAME_ON_F4' is used to get file names which are on desktop where as OPEN DATASET is used to open the files on Application server.

As you are mentioning your files on your laptop, then you need to use GUI_UPLOAD..