sapdev logo background
sapdev logo sapdev logo
Comments

ABAP RETRY Statement syntax, information and example SAP source code



Return to Statement index



RETRY

Short Reference

ABAP Syntax RETRY.

What does it do? This statement exits the CATCH
handling of a class-based exception and continues processing with the TRY
statement of the current TRY control structure.
The RETRY statement can only be executed in a CATCH block of a TRY control structure.
Latest notes: The RETRY statement enables a TRY block that raised an exception to be executed again right from the start.
If the BEFORE UNWIND addition is declared for a CATCH block, exiting using RETRY deletes the context of the exception and creates it again in the TRY block. With respect to the context, therefore, RETRY responds like any exit of a CATCH
block (with the exception of RESUME .
The cause of the exception must be removed either before RETRY in the CATCH block or after RETRY in the TRY block. If a TRY block is repeated and the cause of the exception is not removed, an endless loop results.

Example ABAP Coding The following exception handling extends the ABAP-specific handling of a division by zero to dividends not equal to zero.
PARAMETERS: number1 TYPE i,
number2 TYPE i.

DATA result TYPE p DECIMALS 2.

TRY.
result = number1 / number2.
MESSAGE |Result: { result ALIGN = LEFT }| TYPE 'I'.
CATCH cx_sy_zerodivide.
number1 = 0.
RETRY.
ENDTRY.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




RESUME
RETURN




comments powered by Disqus