You have opened the Process Development or the Service Composer perspective in the SAP NetWeaver Developer Studio and have expanded your project in Project Explorer view .
The expression is a combination of values, variables and functions that are evaluated at runtime to produce a new value. You create expressions in an expression editor using a subset of the XML Path Language (XPath) grammar. For more information about XPath, see
http://www.w3.org.
The expression editor contains a context and functions. The context contains all the data, relevant for the expression scope. You use the functions to process the data from the context.
You can use comments in the expression editor. Comments delimited in the following way are supported:
// some text
The text after the // delimiter until the end of the line is part of the comment.
/* some text */
The text, which can consist of multiple lines, between the delimiters /* */ is part of the comment.
After creating an expression, you can extract it to create a new function directly from the expression editor. For more information about creating functions, see Performing Complex Data Transformation with Functions .
Using Functions from Different DCs
In the expression editor, you can also use functions that were created in different development components (DC) than the one you create your project in. To do that, you proceed as follows:
You configure dependencies to the DC containing the function you want to use. For more information about dependencies, see Defining Development Component Dependencies .
You define in the expression editor the namespace prefix of the DC containing the function you want to use, before using the function.
You want to use the function "ExampleFunction" , created in the project "my.company.com/myProject1" . You define the namespace prefix of the DC containing the project in the following way:
xmlns:myProject1="my.company.com/myProject1"
You use the function "ExampleFunction" after you defined the namespace prefix, in the following way:
myProject1:ExampleFunction( argument1,argument2... )
When you use functions created in the current DC, you can omit the namespace prefix.
When you apply changes to an expression or a mapping function defined in one DC and referenced in other DCs, you must rebuild and redeploy all referencing DCs.
Casting Data Types
You can use the cast as function in case you want to process one data type as another. With the cast as function you define how the expression editor must treat the original data type when it evaluates the expression.
The required data type is xsd:byte but you provide myDecimalRef as xsd:decimal. You cast xsd:decimal as xsd:byte in the following way:
myDecimalRef cast as xsd:byte
When you cast data types, you have to do that in compliance with the World Wide Web Consortium data type hierarchy. For more information about the data type hierarchy, see
http://www.w3.org.
Here is a list of examples for creating expressions in the expression editor.
The context to use in the examples is the following:
SourceRoot1 SubRoot mInt( xsd:int ) mInt1( xsd:int )
SourceRoot2 mInt2( xsd:int ) mStr( xsd:string )
In this example, the data in the context is of type integer and the expected result after the expression is evaluated is also integer (xsd:int):
SourceRoot1/SubRoot/mInt + SourceRoot2/mInt2
In this example, the data in the context is of type integer and the expected result after the expression is evaluated is String (xsd:string). The expression converts the xsd:int into xsd:string:
string( SourceRoot1/SubRoot/mInt )
In this example, the data in the context is of type String and the expected result after the expression is evaluated is also String:
concat( "Prefix ", concat( SourceRoot2/mStr, " Sufix") )
This example shows the usage of list of function arguments. The data used is of type String and the expected result is also String. The list is defined in the following way:
( "ElementOne", "ElementTwo", "ElementThree" )
The defined list is used as function argument in the following way:
myFunc( ( "ElementOne", "ElementTwo", "ElementThree" ) )
The following is an example of an expression, which returns a Boolean value:
not( true AND 1<=2 )