SAP NEWS-610-OBJECTS



Get Example source ABAP code based on a different SAP table
  



ABAP Objects in ABAP Release 6.10
ITOC

ABAP_MODIFICATION_NN Dynamic Access: Dynamic Access to Object Attributes

The following variants of the statement ASSIGN make it possible to access the attributes of classes dynamically:
assign oref->(f) to <(><)>.
assign iref->(f) to <(><)>.
assign (f1)=>(f2) to <(><)>.
assign c=>(f) to <(><)>.
assign (f)=>f to <(><)>.
The attribute search is first carried out for the static type. If the search was unsuccessful or the attributes are not visible in the context, the system performs a search for the dynamic type.

ABAP_MODIFICATION_NN CALL METHOD Optional when Calling Methods

In static method calls of the form CALL METHOD meth( ), the CALL METHOD expression is optional. It is sufficient to simply write meth( ).

ABAP_MODIFICATION_NN Friends - Friendship Between Classes

The Friends concept means that a class can offer friendship to other classes or interfaces (GLOBAL FRIENDS and LOCAL FRIENDS are possible here). These friends can then access all the components of the provider class, and can always instantiate the class. The PROTECTED and PRIVATE components always become PUBLIC for friends. Classes offer friendship to other classes or interfaces using the addition FRIENDS of the statement CLASS ... DEFINITION. The new concept makes the previous language construction DATA TYPE REF TO class %_friend obsolete.

ABAP_MODIFICATION_NN New Additions for Implementing Interfaces

The statement INTERFACES has the new additions ABSTRACT $| FINAL METHODS and ALL METHODS ABSTRACT $| FINAL, which make it possible to make methods in the implementing class abstract or final. DATA VALUES is another new addition. It assigns start values to interface attributes when implemented in a class.

ABAP_MODIFICATION_NN Pass by Parameter in Dynamic Instantiations

Parameters can now be passed and classic exceptions handled in the dynamic variant CREATE OBJECT (class).

ABAP_MODIFICATION_NN Object Transactions

In Transaction Maintenance, you can classify a transaction code as an object transaction (OO transaction). The transaction code is then linked with a global or local class of a program, either using the transaction service of ABAP - Object Services for persistent objects, or using any method. When this type of transaction is called, the system loads the program linked with the class, creates an object for instance methods, and executes the method.

ABAP_MODIFICATION_NN Enhanced Syntax for Interfaces

All the component interfaces of a compound interface are handled in the same way in the interface and in the implementing class. This means that the components of inner interfaces can be accessed directly using interface references. Previously, this was only possible using class reference variables.
ABEXA 01151
In previous releases, this example would have caused a syntax error with the expressions containing i1~a1 and it would have been necessary to use aliases. In ABAP_RELEASE 6.10, however, the interface component selector (~) should only be used outside classes or interfaces in exceptional circumstances.

ABAP_MODIFICATION_NN Enhanced Syntax for Event Handling

In the statement SET HANDLER, the system now checks the exact type of the reference variable that points to a triggering object. The type must be of the same class or subclass as the one specified in the declaration of event handlers as METHODS after FOR EVENT evt OF. This means objects of superclasses cannot be registered, even if the event was inherited from a superclass. If an interface has been declared after FOR EVENT evt OF, the type of the reference variable must either be the interface itself, a class or subclass that implements the interface, or another interface that contains the interface as a component.
From ABAP_RELEASE 6.10 onwards, the type of the implicit event parameter sender (which can be imported by a handler method and passed using RAISE EVENT) is determined using the class or interface specified in the declaration of the event handler (after the addition FOR EVENT OF of the statement METHODS). In previous releases, the type was determined by the class or interface where the event was declared using EVENTS.

ABAP_MODIFICATION_NN Enhanced Syntax in the Instance Constructor of Subclasses

In the instance constructor of subclasses, the constructor of the superclass must always be called using $[CALL METHOD$] super->constructor, even if this superclass was not explicitly defined there. Direct subclasses of the root class OBJECT are the only exception. This means instance constructors can be implemented in superclasses retroactively, without invalidating the subclasses. If the superclass constructor is not called, the following program produces a syntax warning in ABAP_RELEASE 6.10 and higher.

ABAP_EXAMPLE_VX5
ABEXA 01152
ABAP_EXAMPLE_END

ABAP_MODIFICATION_NN Dynamic Access to Interface Constants

Interface constants can now be accessed dynamically using intf=>const. To make this possible, the logic for dynamic ASSIGN , dynamic access, and dynamic invoke was changed so that global classes are now hidden by local types or interfaces. In previous r eleases, if constants were accessed using class=>attr, the system only searched for class names.