Skip to Content

Map Message Structure

0 %
Map Message Structure

Map Message Structure

March 1, 2021
Created by
November 6, 2019
Use the mapping step to convert the message structure to a structure desired by the recipient.

You will learn

  • How to map message structures
  • How to use the visual mapping editor
  • How to use standard mapping functions
  • How to create a custom groovy function in Message mapping
  • How to create a custom function with multiple outputs
  • How to simulate mappings
  • How to work with resources
QR code

In this exercise, you shall convert the message structure from:

		<Address>23,Prime View,Redfield,Bangalore,Karnataka,560037,India</Address>
				<ProductDescription>Wireless Mouse</ProductDescription>
		<ShippingType>Priority 2-day</ShippingType>


		<CustomerName>Kiara Jain</CustomerName>
    <AddressLine1>Prime View</AddressLine1>
				<ProductDetails>Wireless Mouse</ProductDetails>
		<ShippingType>Priority 2-day</ShippingType>

Step 1: Add message mapping
  1. Add a Message Mapping step to message processing pipeline:
    • Click on the design Palette.
    • Choose Mapping.
    • Choose Message Mapping.
    Choose MMap
    • Drag it on to the execution pipeline after the Content Enricher.
    Add MMap
    • Select the mapping step and click on Create.
    • In the pop-up dialog, enter ConvertOrder and click Create.
    Define MMap Str
    • Right-click the Source XSD File and Target XSD file links and save them on your local folder. You will need them for the next steps.

    • On the following screen, upload the source and target XSD into your message map:

      • Click on Add source message.
      • Click Upload from File System in the next window.
      • Choose the file from the location where you saved the files before you started the exercise.
      • Repeat the above steps for the target message structure.
    • You should get the following screen:

    Source Target added
    • Map the following fields one-to-one by dragging a field from the source to the corresponding field on the target:

      • orders
      • order
      • orderID
      • OrderDate
      • ContactNumber
      • items
      • item
      • Quantity
      • ItemValue
      • Shipping
      • OrderValue
      • ShippingType
      • SpecialPackaging
      • PaymentType
      Add MMap Connections
    • Map the following fields:

      Source Target
      ProductID ProductCode
      ProductDescription ProductDetails
Log on to answer question
Step 2: Use Standard functions
  1. Link CustomerName on the source to CustomerName on the target.

  2. Link CustomerLastName on the source also to CustomerName on the target.

  3. Go to the visual mapping editor and look for the Concat standard function and drag it to the work area.

  4. Connect the following:




    Delimiter string → space

Log on to answer question
Step 3: Create a custom function with multiple output
  1. Connect Address on the source to the following fields on the target:

    • HouseNumber
    • AddressLine1
    • AddressLine2
    • City
    • State
    • Pin
    • Country
    Map Address
  2. Go to visual editor at the bottom and click on Create function.

  3. In the pop-up dialog, give SplitAddr as the Script Name and click OK.

    Add Script for Address
  4. Paste the following code in the script file:

    def void splitAddress(String[] Address, Output HouseNumber, Output AddressLine1, Output AddressLine2, Output City, Output State, Output Pin, Output Country)
        String Addr = Address[0];
        def splitAddr = Addr.split(',');
  5. Click OK.

  6. Click on Add functions.

  7. Choose splitAddr.groovy in the pop-up dialog.

  8. You will now see splitAddr added to the list of custom functions under the standard functions:

  9. Click on splitAddr and drag the function splitAddress to the visual editor and connect the relevant fields.

Finally, you should see the following:


Once all the fields are mapped, your mapping should look like:

Map 1Map 2
Log on to answer question
Step 4: Simulate mapping

You will now use the Simulate functionality to test if the mapping is configured correctly and the desired output is generated.

Store the Input Message to you file system.

  1. Click on Simulate.

  2. Click on Browse and import the Input Message.

  3. Click on Test.

  4. After the system executed the test, the system generated the output on the left side of the screen:

  5. Validate the result to check if it is as expected. Make the necessary changes if needed.

  6. Once you are satisfied with the results, click on OK to return back to the integration flow:

    Done Mapping
Log on to answer question
Step 5: Explore resources

In the process of defining a message map, you created or uploaded a lot of artifacts, like XML, XSD, scripts and message maps.

You can find each of the artifacts under the Resources view.

  1. Click on the Canvas.

  2. Go to the Properties Sheet.

  3. Go to the Resources tab.

    Find Resources
  4. You can find all the artifacts that belong to the integration flow listed here.

    You can upload an artifact once and reuse it multiple times in the same integration flows.

Where can I see the list of all mappings, scripts, etc. used in an integration flow in SAP Cloud Platform Integration?

Next Steps

Back to top