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: 

OPEN DATASET......FOR APPENDING

Former Member
0 Kudos

Hello ppl,

I found the following help for OPEN DATASET in APPENDING mode:

If the file already exists, its contents are retained, and the system moves to the end of the file. If the file does not exist, the system creates it. If the file was already open, the system moves to the end of the file.

But, I am not sure what exactly will happen if the file is already open.

Please help me understand it better.

Thanks,

Dawood.

2 REPLIES 2

Former Member
0 Kudos

Hello,

From SAP HELP.

Attempted read access to a file opened with FOR APPENDING with the statement READ DATASET fails, and returns the value 4 for sy-subrc.

It will not let you write to a already opened file.

Hope it helps.

Thanks,

Jayant

Former Member
0 Kudos

The addition FOR APPENDING opens the file for appending.

If the file specified already exists, it is opened and the file pointer is set at the end of the file.

If the file specified does not exist, it is created. Attempted read access to a file opened with FOR APPENDING with the statement READ DATASET fails, and returns the value 4 for sy-subrc.