Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

abap multiple method call

Tags:

methods

abap

While debugging abap code I found an interessting code construct.

method_name(: Parameter1 ), Parameter2 ).

As far as I can tell this one calls the method twice. The first time with the first parameter and the second time with the second. Unfortunately I have no idea how this construct is called and so I can't find any documentation in the SAP docu or with google.

I can tell that this works but is this an official construct? Does it work with more than two parameters? (E.g. four times)

Best regards, Dirk

like image 369
Dirk Köhler Avatar asked Dec 21 '16 08:12

Dirk Köhler


2 Answers

Congratulations, you've found an obscure and most certainly discouraged use of a so-called chained statement. Using this for method calls is not recommended, but since it was once allowed, SAP will be very reluctant to remove this again...

like image 52
vwegert Avatar answered Nov 16 '22 00:11

vwegert


When the ABAP compiler finds a colon, it first expands it blindly without any syntax check (expanding A:B,C,D. into A B. A C. A D.).

And only then it analyses the syntax of each of them - to tell whether it is an assignment, method call or whatever. Pavel

like image 37
Pavel Jelínek Avatar answered Nov 15 '22 23:11

Pavel Jelínek