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

OPEN DATASET  Syntax Diagram

Short Reference

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

Security Note

When specified dynamically, dset is a dynamic programming technique and can present a serious security risk if not used correctly. If the content of dset is used in a program from an external source, it must first be checked thoroughly. See Directory Traversal.

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

CX_SY_CODEPAGE_CONVERTER_INIT

CX_SY_CONVERSION_CODEPAGE

CX_SY_FILE_AUTHORITY

CX_SY_PIPES_NOT_SUPPORTED

CX_SY_TOO_MANY_FILES

Non-Catchable Exceptions




Continue
cOPEN DATASET - access
OPEN DATASET - mode
OPEN DATASET - position
OPEN DATASET - os_additions
OPEN DATASET - error_handling