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

OPEN DATASET

Quick 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

Access to a file whose name dset is injected into a program from outside is a serious security risk. Any names passed to a program from outside must be checked thoroughly before being used. See Directory Traversal.

Return Value

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

Exceptions

Handleable 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-Handleable Exceptions



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