Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Looking for static check for CALL FUNCTION with missing classic exceptions

Sandra_Rossi
Active Contributor
0 Kudos

Hello experts,

Do you know if there's a static check (SLIN/SCI) for detecting missing classic exceptions in CALL FUNCTION? Or is there a reason it shouldn't be detected? Or is there an option to detect these? I'd also like that the non-presence of system_failure and communication_failure is detected for RFC calls, and so on)

Thanks a lot

Example code, for which I get none static check message about ID or OTHERS missing:

 DATA id TYPE ttxid-tdid.
 DATA object TYPE ttxid-tdobject.

 CALL FUNCTION 'CHECK_TEXT_ID'
   EXPORTING
     id = id
     object = object
*   EXCEPTIONS
*     ID = 1
*     OTHERS = 2
 .
1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert

I was deeply convinced that we have this basic check in SLIN.

Now I'm deeply shocked, because we havn't.

Brought it to the attention of the SLIN guys.

10 REPLIES 10

Sandra_Rossi
Active Contributor
0 Kudos

I'd like that SLIN or SCI sends message like this:

In CALL FUNCTION, the exception "ID" is not handled

former_member156446
Active Contributor

You could write a custom application to show which have missing exceptions

Using tables: TFDIR ( to get all the function module names) and FUPARAREF to see if PARAMTYPE is missing an X entry

Thanks. Yes, in last resort, I would write a new code inspector check, that would be easy.

0 Kudos

I know we usually catch these in the check about sy-subrc always being 0 because no EXCEPTIONS have been declared. It's not directly related but our coding standards designate that sy-subrc should always be checked after calling a function so as long as that is followed it would appear in the code inspector check.

0 Kudos

After the CALL FUNCTION of my example, there could be a test for SY-SUBRC (even if it's always zero as EXCEPTIONS is not mentioned, as you say), or not, anyway I'd still like a check message like "In CALL FUNCTION, the exception "ID" is not handled" in both cases.

By the way, same SLIN/SCI behavior with classic exceptions for methods (exceptions CNTL_ERROR and CNTL_SYSTEM_ERROR to handle, or at least OTHERS should be handled) :

cl_gui_control=>set_focus( control = cl_gui_container=>screen0 ).

Oh I completely agree, I was merely offering some approach that may help.

Oh sorry, I didn't understand what you meant. If I add IF sy-subrc <> 0 after CALL FUNCTION without EXCEPTIONS, then SLIN sends the error message

CALL FUNCTION 'CHECK_TEXT_ID' in line <number> has no EXCEPTION specification
that sets the SY-SUBRC Thus the value of SY-SUBRC is always 0

But then, how to make it detect that all CALL FUNCTION are followed with SY-SUBRC test? In my 7.31 system, there's no check for that. Even the SCI "Check of SY-SUBRC handling" for "CALL FUNCTION" does not check it!

I know that exceptions should now be class-based ones, but 99% of our client's custom code is only based on classic exceptions.

I'm afraid we need to develop a custom check, but it surprises me a lot that it doesn't exist in standard.

Yes, I am surprised by that also since it is easy to check statically against the function interface. Especially knowing that such a practice would result in a short dump anytime the system raises a classic exception at runtime!

horst_keller
Product and Topic Expert
Product and Topic Expert

I was deeply convinced that we have this basic check in SLIN.

Now I'm deeply shocked, because we havn't.

Brought it to the attention of the SLIN guys.

So was I (I mean, convinced ;-)). Thank you so much!