Editing Functions

Use

You edit functions when you want to define or change the function's implementation, its name or signature. When defining the function's implementation, you define how the function does a complex data transformation to produce (a new value) a result. The function's implementation depends on the type you defined when you created the function. You cannot change the function's type once you created the function.

You define the function's signature when you create it. You can change the function's return type, the names and types of its input parameters.

You can also rename the function and provide a description.

Prerequisites

  • You have opened the Process Development or Service Composer perspective in the SAP NetWeaver Developer Studio and have expanded your project in the Project Explorer view.

  • You have created a function. For more information about creating functions, see Performing Complex Data Transformation with Functions .

Procedure

To open the function's editor, expand the Functions node in your project. In the context menu of a function, choose Open .

Defining the Implementation of a Function

You define the function's implementation depending on the function's type:

  • Expression function

    1. Open the Expression tab page of the function's editor.

    2. Specify an expression that produces the return value when the function is evaluated. For more information about expressions, see Creating Expressions .

  • Mapping function

    1. Open the Mapping tab page of the function's editor.

    2. Drag the function's arguments on the left to the function's result data on the right to define the mappings.

    3. (Optional) Change already defined or erroneous mappings.

      You can drag the mapping line of already created mappings to another target node. You can modify the defined expressions for the different mappings.

    In process modeling, you can use the mapping function you defined if a similar mapping is required to show how data is used in the process model. For more information about data mappings, see Defining Data Mappings .

    In process modeling, you can also use mapping functions to create an instance of a complex type.

                         processPrincipals(
    (
    createPrincipal("principalId_1", 1),
    createPrincipal("principalId_2", 1)
    )
    )
                      
  • EJB function

    On the Overview tab page of the function editor, specify a Java Naming Directory Interface (JNDI) name of the EJB under EJB .

    The EJB has a special method that executes the EJB function. An EJB function can be included in every expression. When the mapping is done also the EJB function is executed.

    For more information about how to implement an EJB function and use it in a mapping, see Creating an External Function, Exposing It as an EJB and Using It as a Mapping Function .

(Optional) Editing the Function Signature

  1. Expand the Functions node in your project.

  2. In the context menu of a function, choose Open .

    The function editor opens.

  3. Select a new return type from the dropdown menu in the Return Type field under Signature on the Overview tab page.

    You can select the Returns a collection checkbox if the parameter type is a list of elements.

    You can select the Deprecated checkbox if you want to make the function deprecated, that is, you should avoid using it anymore.

  4. Choose the Add pushbutton to add function parameters.

  5. Click the parameter's type in the Type field to activate the dropdown menu and select a type.

    You can select the checkbox in the Collection field if the parameter type is a list of elements.

  6. Click the parameter's name in the Name field to rename the parameter.

  7. Click a parameter and choose the Up or Down pushbutton to change the parameters' order.

(Optional) Editing Function Name and Description

You specify a name of the function when you create the function. In the function editor you have the option to rename the function.

  1. Expand the Functions node in your project.

  2. In the context menu of a function, choose Open .

    The function editor opens.

  3. Choose the Rename... pushbutton under General Information on the Overview tab page.

  4. In the dialog that appears, specify a new name of the function in the New Name field and choose the OK pushbutton.

  5. Specify a description of the function in the Documentation field.