Application Development 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: 

DATASET_NOT_OPEN error.

Former Member
0 Kudos

Hello friends-Any help will be greatly appreciated.

I am trying to execute the following command in SAP 6.0 in the START-OF-SELCTION section. Even though I have the OPEN DATASET staement I am still getting the ABAP dump with error DATASET_NOT_OPEN.

please see the code below:

file_usp = '
fla-file-04\Groups\Common\Data\masterdata_products\us_products_.txt'.

OPEN DATASET file_USP FOR OUTPUT IN TEXT MODE encoding default.

concatenate 'MATNR'

'LDATE'

'DDATE'

into string separated by ','.

TRANSFER string to file_USP.

CLOSE DATASET file_USP.

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

>

> file_usp = '
fla-file-04\Groups\Common\Data\masterdata_products\us_products_.txt'.

You cannot access server *
fla-file-04* directly I think (?)

I don't know how to do it but you can search forum.

7 REPLIES 7

Former Member
0 Kudos

You have to make sure that sy-subrc = 0 after the OPEN DATASET command.

You may have mistyped the name of the file. Remember - it is case sensitive.

Rob

0 Kudos

I checked. No spelling or case issue. Its identical everywhere

0 Kudos

>

> I checked. No spelling or case issue. Its identical everywhere

Yes, but the program still doesn't test sy-subrc to see if the OPEN actually worked.

Rob

Sandra_Rossi
Active Contributor
0 Kudos

>

> file_usp = '
fla-file-04\Groups\Common\Data\masterdata_products\us_products_.txt'.

You cannot access server *
fla-file-04* directly I think (?)

I don't know how to do it but you can search forum.

0 Kudos

I have access to the server. I can access it if I enter the path in Start-Run

former_member156446
Active Contributor
0 Kudos

Hi Syed..

OPEN DATASET file_USP FOR OUTPUT IN TEXT MODE encoding default.
if sy-subrc eq 0.  "<<<<<<<<<<check
concatenate 'MATNR'
'LDATE'
'DDATE'
into string separated by ','.
TRANSFER string to file_USP.
CLOSE DATASET file_USP.
else.
exit.
endif.

0 Kudos

Even better would be to catch the exceptions that the OPEN statement throws instead of checking for sy-subrc to be non zero.

Have a look at the keyword documentation of the OPEN DATASET. At the bottom you will find what exceptions you can catch.


try.
open dataset ....

catch...

This way you will know exactly why the file failed to open.

regards,

Advait