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 SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




CRM Companies List
Web Based CRM Software


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.

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.

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.





SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table








Copyright © 2004 - 2017 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems