Question

Since upgrading from 4.7 to ECC6 the ABAP compiler has become a lot stricter on the use of certain statements in the OO context.

For instance you're not allowed to use the statement LIKE, but in stead have to use TYPE and internal tables does not have an implicit header line, etc.

These restrictions are explained in greater detail here

MY QUESTION: To what extent does this restriction affect your existing code-base?.

We have over a thousand "Classes" written since 1998 in OO as far as it was available at the time. For the most part each class is its own include in SE38, with the class definition and implementation together in this include.

Up to now, we could successfully change and activate these classes as long as the main program was pre-existing in 4.7. Now we are trying to use one of these older classes in a new main program for regression test purposes, and we are getting the following error:

"Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary types (not "LIKE" or "STRUCTURE")."

This error is valid as per the current definition of the SAP language.

I would like to know wheter the SAP interpreter continues to run old code with obsolete statements intentionally, or whether a future patch may correct this "feature" and cause these classes to stop compiling.

Was it helpful?

Solution

Each development object is tagged with a version corresponding to the SAP version it was developed on. You can see this in version management or table VRSD.

As I understand it, that is there specifically so that code with statements that have been made illegal in later versions will survive an upgrade and continue to run.

This is why, when you attach an include developed in 4.5b to a class that was developed in NW700, it won't compile. The compiler knows that this is new dev, and its applying the rules accordingly.

OTHER TIPS

The ABAP community has been informed for a really long time (years) that LIKEs, work areas, RANGEs etc. are obsolete.

I don't think SAP will kill any old code, but I wouldn't count on it if I were in charge.

So can they cause it to stop compiling: yes, will they: probably not.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top