tags:

views:

731

answers:

3

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.

A: 

So,

The ABAP community has been informed since a really long time (years) that LIKE's, work area's, RANGE's etc. are obsolete.

I dont think SAP will kill any old code, but I wouldnt count on it if I was in charge..

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

T.

tomdemuyt
Hi TomThanks for your answer. LIKE's, Work Areas etc only cause syntax errors in the OO context. They show up as obsolete in the extended program check outside of OO but still compiles.The odd thing is that when trying to use these "Obsolete" includes in NEW programs, it DOES NOT compile. BUT as long as you change the includes or the old programs only, it keeps compiling.CheersEsti
Esti
Furthermore, we've had problems in the past where the ABAP interpreter actually interprets the code incorrectly, and tries to execute a method that you did not call. I'm sort of wondering whether this can be because the tokens (syntax) we use are not correct. Of course this can be entirely unrelated. The fact remains that a 10-year old codebase is probably nearing end of life anyway.
Esti
A: 

I have to agree with tomdemuyt, here. There is a lot of legacy code in SAP's module. I can't see them going trough all code just to remove a LIKE or two, and crash all old user code in the same time.

IF they develop a tool to do it, and release it, then my answer does no more apply...

Guillaume

PATRY
+2  A: 

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.

Bryan Cain
Hi Bryan, thanks for your answer - I stumbled onto this table as well.
Esti