SAP ALIASES ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for ALIASES

ALIASES

Short Reference
• ALIASES ABAP Statement
• FOR ALIASES


ABAP Syntax ALIASES alias FOR intf~comp.


What does it do? This statement in the declaration section of a class or interface declares the alias name alias for a component comp of interface intf. For the name alias the naming conventions apply. The interface intf must be implemented in the same class or included in the same interface. You can use the alias name in any position, in which it is visible, instead of intf~comp to access the interface component comp.

An alias name belongs to the components of the class and the interface. It shares the namespace with the other components and is inh erited by subclasses. In classes, an alias name can be declared in every visibility section.

Latest notes:Within a context, such as a class declaration or method, only one label should be used to access components. The syntax check issues a warning, if you use both alias name and the complete label intf~meth. When implementing interface methods in the implementation section of classes using METHOD and when re-defining methods using METHODS ... REDEFINITION, you are allowed to use the alias name.



Example ABAP Coding
In the interfaces i2, i3 and the class
c1, alias names for the methods of the integrated or implemented interfaces are declared. In the implementation part of the class, the interface methods in the METHODS statements are implemented using the interface component selector. The alias names of the classes can also be used here. INTERFACE i1.
METHODS meth.
ENDINTERFACE.

INTERFACE i2.
INTERFACES i1.
ALIASES m1 FOR i1~meth.
METHODS meth.
ENDINTERFACE.

INTERFACE i3.
INTERFACES i2.
ALIASES: m1 FOR i2~m1,
m2 FOR i2~meth.
METHODS meth.
ENDINTERFACE.

CLASS c1 DEFINITION.
PUBLIC SECTION.
INTERFACES i3.
ALIASES: m1 FOR i3~m1,
m2 FOR i3~m2,
m3 FOR i3~meth.
ENDCLASS.

CLASS c1 IMPLEMENTATION.
METHOD i1~meth.
... m2( ) ...
ENDMETHOD.
METHOD i2~meth.
... m3( ) ...
ENDMETHOD.
METHOD i3~meth.
... m1( ) ....
ENDMETHOD.
ENDCLASS.

Return to menu