SAP OPEN DATASET ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for OPEN_DATASET

OPEN DATASET

Short Reference
• OPEN DATASET ABAP Statement
• IN OPEN DATASET
• FOR OPEN DATASET

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

What does it do? 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.

Latest 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.

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.

ABAP_SUBRC_GENERAL sy-subrcMeaning 0The file was opened. 8The operating system could not open the file.



Runtime Exceptions

Catchable Exceptions
CX_SY_FILE_OPEN
Reason for error:
The file is already open.
Runtime error:
DATASET_REOPEN

CX_SY_CODEPAGE_CONVERTER_INIT
Reason for error:
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
Reason for error:
Internal error in the conversion.
Runtime error:
CONVT_CODEPAGE

CX_SY_FILE_AUTHORITY
Reason for error:
No authorization for access to file
Runtime error:
OPEN_DATASET_NO_AUTHORITY
Reason for error:
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
Reason for error:
The operating system does not support pipes.
Runtime error:
DATASET_NO_PIPE

CX_SY_TOO_MANY_FILES
Reason for error:
Maximum number of open files exceeded.
Runtime error:
DATASET_TOO_MANY_FILES


Non-catchable Exceptions
Reason for error:
An attempt was made to open a pipe that is already open.
Runtime error:
DATASET_PIPE_POSITION

Return to menu