Skip to Content
0

Looking for static check for CALL FUNCTION with missing classic exceptions

Feb 24, 2017 at 01:06 PM

285

avatar image

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
 .
10 |10000 characters needed characters left characters exceeded

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

In CALL FUNCTION, the exception "ID" is not handled
0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Horst Keller
Feb 27, 2017 at 07:31 AM
5

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

3
Jay Raj Feb 24, 2017 at 09:55 PM
1

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

Show 6 Share
10 |10000 characters needed characters left characters exceeded

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

1

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

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 ).
0

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

1

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.

1

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!

1