Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
sunilchandra007
Active Contributor

A letter from Java Mapping to ESR


Dear ESR,

I am happy that you have provided such a wonderful Graphical Editor with rich GUI for Message Mapping, but a bit jealous also that you never cared about me. They treat me as last resort when nothing else works. It's a bit unfair that I never had the privilege of friendly environment like you provided to your dear Message Mapping.

I agree that with swing based ESR it was difficult, but even with Eclipse based ESR I can't see any improvement. Everyone know that Message Mapping is also kind of Java Mapping at heart. Still you helped him compiling the code with Mapping API and generating jar. I'd also love to be more visible and flexible instead of just hiding behind Imported archive.

Regards,

Java Mapping


I am sure you agree writing Java Mapping outside ESR has always been a pain. Even for doing a small change, you have to follow the whole cycle of checking your source code in a Java Editor, recompiling it with Mapping API and finally uploading the jar generated as Imported archive. And what if you don't find the source code as earlier developer never bothered to keep a source code copy in Imported Archive, then one more unofficial step of decompiling the jar first.

Won't it be a cool idea if you could manage your Java mapping directly in ESR. Here is the list of advantage you get

1. No need of Mapping API

2. No need to write mapping class from scratch

3. No need of manual compilation and Jar creation

4. No need of importing the jar as Imported Archive

5. With visible code, changing the mapping would be more transparent

 

If you can't wait till the idea becomes reality, you have a workaround. Here you go!

1. Create Message Mapping

2. Select some dummy message type in Source and Target as that it is not validated in java mapping

3. Go to Functions tab > Attributes and Methods

4. Start with writing transform(PI >=7.1)/execute(PI< 7.1) method directly as all the import statement are already there in import section. For example to change namespace prefix from ns0 to pfx, you can try this code.

5. Save and test as is done for Message Mapping

 

 

public void transform (TransformationInput in, TransformationOutput out) throws StreamTransformationException {
    try {
        // Your logic goes here
    } catch (Exception e) {
        throw new StreamTransformationException (e.getMessage ());
    }
}

 

 

If you are lucky enough to have PI>=7.3, you can easily write code using Eclipse based ESR with auto completion feature(Ctrl + SPACE).

The first 2 steps are same as above.

3. Open Message Mapping in Java Editor

4. Start with writing the transform method

5. Save and test as is done for Message Mapping

Hope you like this idea of writing Java Mapping directly in ESR. You can also vote to promote this at IdeaPlace.

Reference:

daniel.graversen/blog/2006/12/29/hack-using-xpath-in-xi-message-mappings

28 Comments
Labels in this area