ABAP Keyword Documentation → ABAP - Reference → Processing External Data → ABAP File Interface → Statements for the ABAP File Interface → OPEN DATASET
OPEN DATASET - error_handling
Other versions: 7.31 | 7.40 | 7.54
Syntax
... [MESSAGE msg]
[IGNORING CONVERSION ERRORS]
[REPLACEMENT CHARACTER rc] ...
Extras
2. ... IGNORING CONVERSION ERRORS
3. ... REPLACEMENT CHARACTER rc
Effect
In the case of errors, these additions enable operating system messages to be received, exceptions to be suppressed, and a replacement character to be defined for unknown characters.
Addition 1
... MESSAGE msg
Effect
If an error occurs when a file is opened, the associated operating system message is assigned to the
data object msg
. A character-like variable can be specified for msg
.
Example
Produces the operating system message after an attempt to open a file with an empty name.
DATA mess TYPE string.
OPEN DATASET `` FOR INPUT IN BINARY MODE MESSAGE mess.
IF sy-subrc = 8.
MESSAGE mess TYPE 'I'.
ENDIF.
Addition 2
... IGNORING CONVERSION ERRORS
Effect
This addition can be used to suppress a handleable exception defined by the class CX_SY_CONVERSION_CODEPAGE. This exception can be raised by reads or writes if a conversion between code pages takes place and a character cannot be converted to the target code page.
This addition is possible when opening text files, legacy text files, or legacy binary files, but not when opening binary files.
Notes
REPLACEMENT CHARACTER
. The addition
IGNORING CONVERSION ERRORS
defines whether or not the user is notified of this by an exception. SET DATASET
.
Addition 3
... REPLACEMENT CHARACTER rc
Effect
If a conversion between code pages
takes place while data is being read or written, every character that cannot be converted to the target
code page is replaced by the character specified in rc
. rc
expects a character-like data object containing a single character. If the addition is not specified, the character "#" is used as a replacement character.
This addition is possible when opening text files, legacy text files, or legacy binary files, but not when opening binary files.
Notes
IGNORING CONVERSION ERRORS
. SET DATASET
.