What does it do? Chaining of static method calls to a chained method call or a chained attribute access. meth>>, meth1>>, meth2>>, ..., expect functional methods> whose return values are reference variables that point to objects with the next method in question. All methods that follow meth> must be called using the object component selector. The parameters are passed to the functional methods meth>, meth1>, meth2>, ... using the syntax valid for functional method calls>. System Fields> Each method call sets the system field sy-subrc> to 0 in the moment the method is called.
What does it do? Chained method call. Call of the instance method methn> of an object. The reference variable for the object is the return value of the preceding method chaining. A chained method call can be specified as a standalone statement> or as a functional method call> in a suitable operand position>. The relevant rules apply in parameter passing to meth>. If the return value of the last method has a structured data type, the chained method call can, like a structure, be listed in front of the structure component selector> -> and be used to access a component of the structure.
Latest notes: In methn>, a constructor expression> can be specified with a constructor operator> NEW>> or CAST>> for oref> not only in a functional call, but also in standalone statements. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Call of the method m3> of an object of the class c3> that is addressed using method chaining. ABEXA 00077 ABAP_EXAMPLE_END
ABAP Alternative 2 meth( ... )->meth1( ... )->meth2( ... )->...->attr>
What does it do? Chained attribute access. Access to the instance attribute attr> of an object. The reference variable for the object is the return value of the preceding method chaining. If the attribute has a structured data type, the chained attribute access can, like a structure, be listed in front of the structure component selector> -> and be used to access a component of the structure. Chained attribute access can currently only be specified in suitable read positions>. Writes to an attribute addressed using method chaining are not yet possible.
ABAP_EXAMPLE_VX5 Chained attribute access in example class CL_DEMO_METHOD_CHAINING>>. cl_demo_output=>display( NEW demo( )->meth( `Hello ` )->meth( `world` )->meth( `!` )->text ).> ABAP_EXAMPLE_END