SAP® Documentation

Single view

ABAPOPEN_DATASET_ACCESS - OPEN DATASET ACCESS

Addresses (Business Address Services)   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

OPEN DATASET - access

Short Reference



Syntax

... INPUT
  $| OUTPUT
  $| APPENDING
  $| UPDATE ...

Alternatives:

1. ... INPUT

2. ... OUTPUT

3. ... APPENDING

4. ... UPDATE

Effect

These mandatory additions are used to open the file for reading, writing, appending, or changing.

Alternative 1

... INPUT


Effect

The addition FOR INPUT opens the file for reading. By default, the file pointer is set to the start of the file. If the file specified does not exist, sy-subrc is set to 8. Writes cannot be performed on a file opened for reads.

Example

Opens a binary file to read binary data.

DATA(dset) = 'test.dat'.
OPEN DATASET dset FOR INPUT IN BINARY MODE.

Alternative 2

... OUTPUT


Effect

The addition FOR OUTPUT opens the file for writing. If the specified file already exists, its content is deleted. If the file specified does not exist, it is created. Reads are also permitted.

Example

Opens a binary file to write binary data.

DATA(dset) = 'test.dat'.
OPEN DATASET dset FOR OUTPUT IN BINARY MODE.

Alternative 3

... APPENDING


Effect

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 reads to a file opened with FOR APPENDING with the statement READ DATASET fail, and return the value 4 for sy-subrc.

Example

Opens a binary file to append binary data.

DATA(dset) = 'test.dat'.
OPEN DATASET dset FOR APPENDING IN BINARY MODE.

Alternative 4

... UPDATE


Effect

The addition FOR UPDATE opens the file for changes to the existing content. By default, the file pointer is set to the start of the file. If the specified file does not exist, no file is opened and sy-subrc is set to 8.

Example

Opens a binary file to update binary data.

DATA(dset) = 'test.dat'.
OPEN DATASET dset FOR UPDATE IN BINARY MODE.






Addresses (Business Address Services)   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 3807 Date: 20200219 Time: 054431     sap01-206 ( 40 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.