SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

Exception is not handled and is not declared in the RAISING clause


ABAP Test Cockpit (ATC) checks enables SAP programmers to catch code blocks with unhandled exceptions. For example Exception is not handled and is not declared in the RAISING clause ATC message informs the ABAP developer to code blocks where exception handling should be done by using ABAP TRY-CATCH method.

ATC check on a SAP HANA ABAP program resulted with following messages:
Extended Program Check (SLIN) Exception is not handled and is not declared in the RAISING clause

Exception is not handled and is not declared in the RAISING clause

When I jump to the ABAP code block where the ATC check message occurs by clicking on the Object Name column value, I see that the reported problem occured where I called the ABAP class method cl_shdb_seltab=>combine_seltabs without catching the method exception cx_shdb_exception

ABAP code without exception handling missing

I used the code that ABAP Object Pattern tool suggests.
When I enclose this ABAP method call within a TRY...CATCH code block, I got following ABAP code.

*try.
call method cl_shdb_seltab=>combine_seltabs
exporting
it_named_seltabs =
* iv_client_field =
receiving
rv_where =
.
* catch cx_shdb_exception .
*endtry.
Code

Uncomment ABAP TRY-CATCH code lines

I modified the original code for its final version as seen below

try .
call method cl_shdb_seltab=>combine_seltabs
exporting
it_named_seltabs = value #(
( name = 'AUART' dref = ref #( s_auart[] ) )
( name = 'VBTYP' dref = ref #( s_vbtyp[] ) )
( name = 'SPERR' dref = ref #( r_sperr[] ) )
)
* iv_client_field =
receiving
rv_where = data(lv_where).

catch cx_shdb_exception.

endtry.
Code

call class method with exception handling in ABAP

Or as follows helped me to get rid of the ATC check messages related with missing catch statements for the class method exceptions.

ABAP Try Catch code for exception handling

try.
data(lv_where) = cl_shdb_seltab=>combine_seltabs( it_named_seltabs = value #(
( name = 'AUART' dref = ref #( s_auart[] ) )
( name = 'VBTYP' dref = ref #( s_vbtyp[] ) )
( name = 'SPERR' dref = ref #( r_sperr[] ) )
) ).
catch cx_shdb_exception.

endtry.
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.