Handle and show SQL Exception show in popup message box in SAP ABAP


1. Delare a variable (lo_exc). You can use any word.

DATA  lo_exc TYPE REF TO cx_root.

2. Use TRY and CATCH Syntax

TRY.

select single MATNRR from MARA INTO (varable) UP TO 1 ROWS.

CATCH    CX_SY_DYNAMIC_OSQL_SEMANTICS INTO lo_exc.
MESSAGE lo_exc TYPE 'I' DISPLAY LIKE 'E'.

ENDTRY.



Note: This ExceptionCX_SY_DYNAMIC_OSQL_SEMANTICS ) return SQL Query Errors.



Result:



Comments

Popular posts from this blog

How to use GUID in asp.net C# for unique ID?

How to access an internal table of one program in another program