SAP RUNTIME ERROR DATA OBJ - Guide
Get Example source ABAP code based on a different SAP table
GUIDELINE
Runtime Errors When Accessing Data Objects
ABAP_BACKGROUND
Using data objects can cause runtime errors if the data object contains unsuitable content or the access to the data object is unsuitable. Examples:
ABAP_RULE
You need to prevent runtime errors that can occur when accessing data objects. Robust applications should always be programmed to avoid these errors.
ABAP_DETAILS
If it not possible to determine by filling data objects appropriately whether subsequent access causes errors, then either the relevant properties must be checked before data access or possible exceptions (subclasses of
Bad Example
The following source code illustrates a typical situation that can easily cause a runtime error if the subarea defined by
...
substring = text+offset(length).
...
Good Example
The following two source codes illustrate how the above example can be changed to avoid runtime errors using prevention or exception handling.
substring = text+offset(length).
ELSE.
...
ENDIF.
substring = text+offset(length).
CATCH cx_sy_range_out_of_bounds.
...
ENDTRY.