Show TOC

Parameterized Java MappingsLocate this document in the navigation structure

Use

Parameterized Java mappings enable you to increase the number of possible applications for a Java mapping. By defining an appropriate interface, you can query values from or to the Java mapping program.

More information: Parameterized Mapping Programs

Integration

To be able to access Java mapping parameters at runtime, in the binding of the operation mapping, define the relevant Java mapping parameters:

Figure 1: Access Java Mapping Parameters

You define the Java mapping parameters for a Java mapping program when you create the binding, and at the same time connect them to operation mapping parameters. When you access the Java mapping parameters in the Java mapping program, the mapping runtime checks whether you have defined the parameters in the Enterprise Services Repository. If not, an exception is raised.

Activities
  1. Create an operation mapping and reference the source and target interfaces. You also have the option of exporting the XSD schema of the request and response messages if you want to develop your Java mapping externally (see: Operation Mappings ).

  2. When you implement the Java mapping program, you access the mapping program parameters by using a mapping API (more information: Java-Mapping ):

    import com.sap.aii.mapping.api.AbstractTransformation; import com.sap.aii.mapping.api.StreamTransformationException; import com.sap.aii.mapping.api.TransformationInput; import com.sap.aii.mapping.api.TransformationOutput; import com.sap.aii.mapping.lookup.Channel;

    public class Parametrization_Java extends AbstractTransformation {

    public void transform( TransformationInput in, TransformationOutput out) throws StreamTransformationException {

    try { // Read Import Parameters

    String paramS = in.getInputParameters().getString("PARAM_S"); int paramI = in.getInputParameters().getInt("PARAM_I"); Channel paramC = in.getInputParameters().getChannel("PARAM_C");

    // Use Parameters during Mapping // ... // Set Export Parameters

    out.getOutputParameters() .setString("PARAM_ES", [String-Wert] ); out.getOutputParameters() .setInt("PARAM_EI", [Integer-Wert] ); out.getOutputParameters() .setValue("PARAM_EC", [java.lang.Object] );

    } catch (Exception e) { // Exception Handling } }

    }

    When you develop the Java mapping programs, maintain a list of these parameters so that you can enter them later in the binding of the operation mapping.

    Note

    You also have the option of creating the mapping program parameters before you implement them in the operation mapping (see steps 3 to 6).

    1. To create the necessary operation mapping parameters, choose Parameters . You can use an operation mapping import parameter to transfer values to multiple mapping program import parameters. Note that multiple mapping program export parameters cannot be connected to the same operation mapping export parameters.

    2. Import your Java mapping program to the Enterprise Services Repository (more information: Imported Archives (XSLT/Java) ) and then reference the parameterized Java mapping program from your operation mapping.

    3. In the table in frame Mapping Programs , locate the row in which you have entered your message mapping program. Choose column Binding to define a binding.

    4. In the table in the subsequent window, enter the required mapping program parameters for your Java mapping. In the second column, assign the operation mapping parameters to the mapping program parameters you entered. By doing so, you define both the binding and the type of the mapping program parameters.

    5. Save and activate your operation mapping.

    6. Assign values to the parameters:

      • Use an interface determination in the Integration Directory (import parameters only).

      • Use a transformation step of an integration or monitoring process (import and export parameters).