2025 Mar 13 8:39 PM - edited 2025 Mar 13 9:00 PM
Hello,
I had a weird error when transporting a custom exception class (ZCX inheriting from CX_NO_CHECK).
I explain what the issue was, how I solved, but my question is about how to avoid the issue in the future.
So, here was the issue:
I had a transport request which contains all sections and all methods of the class as LIMU entries (CLSD, CPUB, CPRO, CPRI, METH).
After importing the transport request in a system, I had a syntax error although the code should be theoretically the same as the code in the development system.
To my big surprise, in the target system, in the table TMDIR (index of methods), I can see that the methods are "duplicated", I expect only the methods with the interface names:
Via SE24, I can see that the code of IF_MESSAGE~GET_LONGTEXT contains the old code (I suspect that it looks at the method at index 2), but the code of IF_MESSAGE~GET_TEXT contains the new code (I guess it's the method at index 5). The transport log doesn't show any error (except the syntax error), and if I compare "import phase" of the transport logs of two systems, one with error, one without error, the import phases show exactly the same information, which mention only the method at indexes 4 and 5, e.g. "method IF_MESSAGE~GET_LONGTEXT include ZCX======CM004 will be imported as ZCX======CM004")
Probably the history of the source code explains the situation (but it's not sufficient to explain why it didn't happen in the other systems):
Version 1: the class creation was via Eclipse ADT with this code:
METHODS get_longtext REDEFINITION.
METHODS get_text REDEFINITION.
Version 2: it was changed via Form-Based ABAP Editor (transport was OK) - The only explanation I could find why the interface name was added to the method redefinitions is that the menu "Utilities > Regenerate sections" was used, other modifications and functions don't seem to add the interface name:
methods IF_MESSAGE~GET_LONGTEXT redefinition .
methods IF_MESSAGE~GET_TEXT redefinition .
Version 3: the source code was changed again via Eclipse ADT, and the transport failed:
METHODS get_longtext REDEFINITION.
METHODS get_text REDEFINITION.
That's also weird because in some other systems, although the transports were done exactly in the same sequence, and they seem to be all the same versions and support packages, the two "alias methods" were removed between version 2 and version 3: in these systems, in TMDIR, after version 3 was imported, I see the two methods IF_MESSAGE~GET_LONGTEXT and IF_MESSAGE~GET_TEXT (which demonstrates that using METHODS get_text REDEFINITION without the interface name is not always an issue). Note that in these systems, these methods are assigned the indexes "4" and "5".
The issue was solved by transporting the whole class using R3TR CLAS ZCX... The two old methods "2" and "3" were removed, only the latest code is kept, as you can see:
So, my two questions are:
I'd love it if you can find some links to SAP documentation about this issue.
Thanks for reading!
Sandra
Systems: all are 7.40 SP 23, kernel 753 SP 1300
NB: I guess that the error is not limited to exceptions classes (but I can't be sure of course), it's probably related to any classes where the methods are:
(For my reference, the transport request is XXXK910882)
Request clarification before answering.
| User | Count |
|---|---|
| 6 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.