ABAP Keyword Documentation → ABAP - Reference → ABAP Syntax → ABAP Statements → Operands → Functions and Expressions at Operand Positions
Method Chaining
This example demonstrates method chaining in an operand position.
Other versions: 7.31 | 7.40 | 7.54
Source Code
    DATA oref TYPE REF TO demo.
    DATA msg  TYPE string.
    CREATE OBJECT oref.
    msg = oref->meth( `Hello ` )->meth( `world` )->meth( `!` )->text.
    MESSAGE msg TYPE 'I'.
Description
A chained attribute
access is performed on the attribute text of the class demo. The attribute is changed by three chained method calls.