cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Method transport syntax check error due to "old alias code" presence (ZCX exception class)

Sandra_Rossi
Active Contributor
178

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

Sandra_Rossi_2-1741883934127.png

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:

Sandra_Rossi_0-1741883013102.png

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:

Sandra_Rossi_1-1741883824037.png

So, my two questions are:

  1. Why is there an error, did I miss an SAP note?
  2. How to avoid this error in the future, should we always opt for one variant of METHODS REDEFINITION?

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:

  1. defined in interfaces,
  2. "aliased" in the class implementing the interface (as it happens in CX_ROOT),
  3. are redefined in a subclass (as it happens in my ZCX class)

(For my reference, the transport request is XXXK910882)

Accepted Solutions (0)

Answers (0)