Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP File Interface →  Statements for the ABAP File Interface 

OPEN DATASET

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


OPEN DATASET dset FOR access IN mode
[position] 
                                     [os_additions]
                                     [error_handling].

Effect

This statement opens the file specified in dset for the access specified in access in a storage mode specified in mode. dset expects a character-like data object containing the physical name of the file. The file must not yet be open in the current program; otherwise a handleable exception is raised.

Use the additions positions, os_addition, and error_handling to determine the position at which file is opened, specify platform-specific additions, and influence error handling.


Notes

  • Up to 100 files can be opened per internal session. The actual maximum number of simultaneously open files may be less, depending on the platform.
  • When a file is opened, automatic authorization checks are performed; self-programmed checks may also be necessary.

Return Value

sy-subrc Meaning
0 The file was opened.
8 The operating system could not open the file.

Exceptions


Catchable Exceptions

CX_SY_FILE_OPEN

  • Cause: The file is already open.
    Runtime Error: DATASET_REOPEN

CX_SY_CODEPAGE_CONVERTER_INIT

  • Cause: The desired conversion is not supported. (Due to specification of invalid code page or of language not supported in the conversion, with SET LOCALE LANGUAGE.)
    Runtime Error: CONVT_CODEPAGE_INIT

CX_SY_CONVERSION_CODEPAGE

  • Cause: Internal error in the conversion.
    Runtime Error: CONVT_CODEPAGE

CX_SY_FILE_AUTHORITY

  • Cause: No authorization for access to file
    Runtime Error: OPEN_DATASET_NO_AUTHORITY
  • Cause: Authorization for access to this file is missing in OPEN DATASET with addition FILTER.
    Runtime Error: OPEN_PIPE_NO_AUTHORITY

CX_SY_PIPES_NOT_SUPPORTED

  • Cause: The operating system does not support pipes.
    Runtime Error: DATASET_NO_PIPE

CX_SY_TOO_MANY_FILES

  • Cause: Maximum number of open files exceeded.
    Runtime Error: DATASET_TOO_MANY_FILES


Non-Catchable Exceptions

  • Cause: An attempt was made to open a pipe that is already open.
    Runtime Error: DATASET_PIPE_POSITION

Continue

cOPEN DATASET - access

OPEN DATASET - mode

OPEN DATASET - position

OPEN DATASET - os_additions

OPEN DATASET - error_handling