Expressions: Functional Methods
You can use a functional method within an expression on the source side of a binding row. You can use a functional method for the following purposes:
· Performing calculations
· Performing data conversions, for example, currency conversions
· Calling a GET method to read a private attribute of the object

A functional method is a method of a business object or ABAP class that returns one return value only (parameter Result or Returning). However, you can also use a different method with at least one export parameter. In this case you have to specify which export parameter to use as the return value.
You have implemented the method in the corresponding ABAP class or for the BOR object.
An expression for calling a method is generated automatically when you select a particular object in the container and then select the corresponding functional method from the _Methods node.
You can call an instance method or a class method (static method). These calls are structured as follows:
&containerelement.method(parameterlist)&
Instance method call, enclosed by & symbols.
%class.method(parameterlist) %
Static method call, enclosed by % symbols.
Note the following conventions when you specify the parameters:
· Place the parameter list in round parentheses (), even if the list is empty.
· Separate the parameters with a semicolon ; or a comma ,.
You are not permitted to use both semicolons and commas as separators within the same call.
· To improve legibility, use as many blanks as you require in the parameter list.
You can specify the names of the parameters explicitly, or, to speed up inputting, just the parameter values. If you just specify the parameter values, you have to observe the parameter sequence defined in the method. The system adds the parameter names automatically. The following example shows both options.

Parameter names specified explicitly:
&My_Object.My_Method(Import01 = ’ A’ ; Import03 = 1)&
Parameter names not specified (positional parameters):
&My_Object.My_Method(’ A’ ; ; 1)&
You can use the following as parameter values:
· Expressions, for example, &Element01&, &My_Object.Component01&, or %UZEIT%
· String-type constants, for example, ’ USNAME’ or “ String Value“
You have to specify string-type constants in single quotation marks ‘ or double quotation marks ”.
· Numeric constants, for example, 1 or 1.5
All data types that can be used in the respective repositories (Business Object Repository and Class Builder) are also supported for import and export parameters of the method:
· Simple types
· Flat structures
· Objects
ABAP Objects also support reference types and deep structures:
· ref to object
· ref to data
· string
· Xstring
· Deep structures, for example, structures with reference types as components
A functional method returns one return value only (parameter Result for BOR objects, parameter Returning for ABAP classes). When using a functional method, you do not have to specify the parameter names for the return value explicitly in the parameter list, as shown in the following example:

&My_Object.My_Method()&
The expression returns the value that My_Method returns as the return value by using the parameter Result.
If you use a method with multiple Exporting or Changing parameters, you have to specify which of the export parameters to use as the return value. To do this, specify _result as the first parameter in the parameter list and assign it the name of the export parameter you want to use, as shown in the following example:

&My_Object.My_Method(_result=’ my_exp_param’ ;Param1=’ A’ ;Param2=’ B’ )&
The method returns the value my_exp_param. All other Exporting, Changing or Result parameters are ignored.
If the method returns a structure, you can access an individual field of the structure. To do this, specify the field you want to access after the closing parenthesis in the parameter list, as shown in the following example:

&My_Object.Get_Position(PosNumber=1).PositionID&
The expression returns the PositionID of the first position.
If the method returns a table, you can access a particular line of the table and its attributes by using an index, as shown in the following example:

&My_Object.Get_PositionList()[1].PositionID&
The expression returns the PositionID of the first line.
The following constraints apply to functional methods within expressions:
· Do not use dialog elements
You are not permitted to use methods in an expression that call screens or the ABAP command message, or that call a method containing such dialog elements.
Since the method specified in the expression is executed in the background, calling a dialog element terminates the method.
· Do not trigger a COMMIT
You are not permitted to use methods in an expression that call a database COMMIT (function module: DB_COMMIT) or the ABAP command commit work.
A call of this type would conflict with the commit logic of the SAP WebFlow Engine. This could lead to data errors and the loss of the workflow restart options.
· Do not use asynchronous methods
You are not permitted to use asynchronous methods in an expression. The SAP WebFlow Engine can only process method results in an expression that are returned synchronously.