Skip to Content
-2

File is not open in READ DATA SET

May 02, 2017 at 08:41 PM

331

avatar image
Former Member

Hi folks.

I have the next code:

DATA: l_text TYPE String.

lv_file = '/repo/FI/exit/ACCESS_FILE.TXT'.

TRY.
OPEN DATASET lv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT WITH SMART LINEFEED.
CATCH cx_sy_file_authority.
      g_message = 'No authorization'.
ENDTRY.

READ DATASET lv_file INTO l_text.------>ERROR

When I try read dataset, there are an error in this point with the next description:

When accessing the file "/repo/FI/exit/ACCESS_FILE.TXT", the system recognized that this file is not open. Therefore, the file cannot be accessed.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Raymond Giuseppi
May 03, 2017 at 05:38 AM
1

There are other exceptions to handle, also check sy-subrc. Try to add the MESSAGE msg option to the OPEN DATASET statement to get the actual error during open: does the file exist, is it complient with the required options?

Share
10 |10000 characters needed characters left characters exceeded
Mangesh Parihar May 03, 2017 at 04:57 AM
0

Hi,

Can you please share what is the error coming?

Regards,

Mangesh

Share
10 |10000 characters needed characters left characters exceeded
satyapriyanka vana May 03, 2017 at 10:39 AM
0

Hi,

Use this statement instead of catching one exception.

OPEN DATASET file FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE msg.

if msg is initial u can proceed reading the file.

Regards,

Priyanka.

Share
10 |10000 characters needed characters left characters exceeded