sapdev logo background
sapdev logo sapdev logo
Comments

SAP NEWS-46-OBJECTS-ENTWICKLUNGEN documentation, setup help and example usage



Return to SAP documentation index



ABAP Objects - Further Developments in Release 4.6A

In ABAP_99A the following components are added to the core ABAP Objects functions:

1 Creating objects with explicitly specified class
2 Non-public instantiation
3 Internal tables as collections
4 Functional methods in expressions
5 Instance destroyer
6 Change process for global interfaces
7 Compiler enhancements
8 Internal optimizations


ABAP_MODIFICATION_1 Creating Objects with Explicitly Specified Class

The statement CREATE OBJECT has two new variants that make it possible to specify the name of the class where the instance is created, both statically and dynamically. Previously, a reference variable with reference to the class had to be created before an object could be created. In the new variants of the statement
CREATE OBJECT , any reference variables can be used that are compatible with the specified class.


ABAP_MODIFICATION_2 Non-Public Instantiation

The new additions CREATE PROTECTED and CREATE PRIVATE of the statement CLASS class DEFINITION can be used to ensure that only the class itself or its subclasses can create instances of the class class . This makes instance management non-ambiguous.


ABAP_MODIFICATION_3 Internal Tables as Collections

If the row type of internal tables contains reference variables as components comp , the attributes attr of the object to which the reference of a row points can be used as key values for reading, sorting, and changing table rows. This is possible in the following statements:

LOOP AT itab ... WHERE comp- attr ...
READ TABLE itab ... WITH [TABLE] KEY comp- attr = ...
SORT itab BY comp- attr ...
DELETE itab WHERE comp- attr ...
MODIFY itab ... TRANSPORTING ... WHERE comp- attr ...

If a table contains non-structured rows of the type of a reference variable, the attributes of the object to which a row points can be addressed using table_line - attr .


ABAP_MODIFICATION_4 Functional Methods in Expressions

Functional method calls are supported for the following statements and expressions:

In arithmetic expressions ( COMPUTE )
In bit expressions ( COMPUTE )
In relational expressions
In multiple queries ( CASE , WHEN )
In loops ( LOOP )
In assignments ( = )


ABAP_MODIFICATION_5 Instance Destroyer

The instance destroyer can be used for releasing internal and external resources. External resources, for example the printer of a called class, must be released by the application involved, whereas internal resources are released automatically when the mode is closed. Currently a C function must be called for this purpose using SYSTEM-CALL .


ABAP_MODIFICATION_6 Change Process for Global Interfaces

If a method is missing in the implementation, the syntax check produces a warning message instead of an error message. If the method is called at runtime, it is canceled.

If an implemented method is not used, a warning message is produced instead of an error message. The code of the method is ignored.


ABAP_MODIFICATION_7 Compiler Enhancements

The statement CLASS class DEFINITION LOAD
is no longer required with the following statements:

CALL METHOD global_class= method
SET HANDLER global_class= method
METHODS m FOR EVENT e OF CLASS global_class

From within a global superclass, a subclass can be referenced provided that the superclass does not address components of the subclass.


ABAP_MODIFICATION_8 Internal Optimizations

Objects are now addressed indirectly using indexes instead of pointers. This makes the ABAP data layout platform-independent. In addition, this ensures object mobility as a basis for future developments such as:

- Integrated persistence services
- Shared memory objects
- Destroy for objects
- More compact memory management

Improved memory management is achieved because objects are managed without blocks. In addition, objects can be released individually.

Garbage Collector uses mark sweep instead of reference counting , which enables cycles to be detected. This provides efficient support for the debugger in finding all references to a specific object.

Finally, a separate interface load has been introduced to relieve the load of the implementing classes from some of its tasks.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




NEWS-46-OBJECTS-DYNAMIC
NEWS-46-OBJECTS-OBSOLETE




comments powered by Disqus