Posts

A Walk through on New and Old Abap Syntax

With release 7.40 and 7.50 several new ABAP language elements have been introduced. Learning them in theory is one thing, using them in daily life quite another. While working on that, the idea of an overview sheet came up, comparing “old” and “new” syntax, in the form of: “When i notice things are done in this “old” way, can we use some new elements here?” This overview is meant to be printable, to have it right on the desk or wall beside you for a quick reference. And one more thing, i do not mention or care about releases and service packs here. Depending on your system, some or all of the new features will not be available. Old ABAP  New ABAP DATA and FIELD-SYMBOLS declarations Inline declarations MOVE CORRESPONDING Constructor expression CORRESPONDING , or  CL_ABAP_CORRESPONDING struc1-field1 = struc2-fielda struc1-field2 = struc2-fieldb … Constructor expression CORRESPONDING , or  CL_ABAP_CORRESPONDING ; Constructor expression VALUE CREATE...

ABAP 7.50 – CORRESPONDING

But as you all know there is a  prominent exception  to that rule: All the syntax forms involving  CORRESPONDING  for assigning structure components that (by chance) have the same name. Before ABAP 7.40, these were mainly  MOVE-CORRESPONDING  for the components of structures, the  CORRESPONDING  addition to Open SQL’s  SELECT , and some obsolete calculation statements. With ABAP 7.40  MOVE-CORRESPONDING  was enabled to handle structured internal tables and a new constructor operator  CORRESPONDING  was introduced that allows an explicit mapping of structure components with different names. What was still missing?  A dynamic mapping capability! And this was introduced with ABAP 7.50. The new system class CL_ABAP_CORRESPONDING allows you to assign components of structures or internal tables with dynamically specified mapping rules. The mapping rules are created in a mapping table that is...

ABAP 7.40 – Inline Declarations

Inline declarations are a new way of declaring variables and field symbols at operand positions. Data Declarations In ABAP you have many operand positions, where the value of the operand is changed by the statement. The most typical of these “write positions” is the left hand side  lhs  of an assignment. lhs = rhs. But of course there are more. The data objects you can use at these write positions are either writable formal parameters of the procedure you are working in or variables declared with  DATA  in front of the statement. In many cases the variables filled by a statement are helper variables that you only need close to the statement. For each of  these helper variables you had to write a data declaration with the  DATA statement and of course it was your task to give the variable an adequate type. Well, the operand type of most write positions is statically fixed and well known to the compiler. And this is why ABAP can of...