OPEN DATASET - error_handling
Short Reference
ABAP Syntax ... [MESSAGE msg]
[IGNORING CONVERSION ERRORS]
[REPLACEMENT CHARACTER rc] ... .
ABAP_ADDITIONS:
1 ... MESSAGE msg
2 ... IGNORING CONVERSION ERRORS
3 ... REPLACEMENT CHARACTER rc
What does it do? :These additions allow the system to receive operating
system messages , suppress exceptions, and
define a replacement character for unknown characters if an error
occurs.
ABAP_ADDITION_1 ... MESSAGE msg
What does it do? :If an error occurs when a file is opened, the
corresponding operating system message is assigned to the data object
msg . A character-type variable can be entered for msg .
Example ABAP Coding :Operating system message issued 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.
ABAP_ADDITION_2 ... IGNORING CONVERSION ERRORS
What does it do? :This addition can be used to suppress a treatable
exception defined by the class CX_SY_CONVERSION_CODEPAGE . This
exception can be triggered during reading or writing if conversion
between codepages takes place and a
character cannot be converted to the target codepage.
This addition is possible when opening text
files , legacy text files, or
legacy binary files, but not when
opening binary files .
Latest notes:
Each unconvertible character is replaced during conversion either by
the character "#" or with the character defined by the addition
REPLACEMENT CHARACTER . The addition IGNORING CONVERSION
ERRORS controls whether or not the user is notified of this by an
exception.
This setting can be changed in an opened file using the statement
SET DATASET .
ABAP_ADDITION_3 ... REPLACEMENT CHARACTER rc
What does it do? :If a conversion between
codepages takes place while data is being read or written, every
character that cannot be converted to the target codepage is replaced
with the character specified in rc . For rc , a
character-type data object with a single character is expected. 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 .
Latest notes:
If at least one character is replaced by a replacement character
during reading or writing, after conversion, the exception defined in
the class CX_SY_CONVERSION_CODEPAGE is triggered, if this is not
suppressed by the addition IGNORING CONVERSION ERRORS .
The replacement character of an opened file can be changed using the
statement SET DATASET .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved