2017 Feb 24 1:06 PM
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
.
2017 Feb 27 7:31 AM
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.
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
.
2017 Feb 24 8:08 PM
I'd like that SLIN or SCI sends message like this:
In CALL FUNCTION, the exception "ID" is not handled
2017 Feb 24 9:55 PM
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
2017 Feb 25 10:09 AM
Thanks. Yes, in last resort, I would write a new code inspector check, that would be easy.
2017 Feb 25 9:34 PM
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.
2017 Feb 25 10:12 PM
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 ).
2017 Feb 26 1:52 PM
Oh I completely agree, I was merely offering some approach that may help.
2017 Feb 26 3:53 PM
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 0But 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.
2017 Feb 26 9:39 PM
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!
2017 Feb 27 7:31 AM
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.
2017 Feb 27 8:15 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |