Skip to Content
avatar image
Former Member

Java Mapping - Add New Nodes

Hi Experts ,

I am facing some issues forone of my developments . I need to do the following with my input XML data -

Input XML -

<?xml version="1.0" encoding="UTF-8"?>

<DOCUMENT04>

</DOCUMENT04>

Output XML -

output.jpeg

Please help the same by using Java Mapping

Br,

Abhishek

output.jpeg (23.0 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Oct 02, 2017 at 11:49 AM

    Hi Abhishek!

    As far as I remember, it's a well-known behaviour: you can't create more than one IDOC element in graphical mapping since you have 1..1 occurence defined for that element and I guess, it's checked by graphical mapping processor. So, you have two ways: either use external definition for your IDOC type with 1..9999 occurence or use Java/XSLT mapping program in which no check against the target scheme is performed.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2017 at 01:19 PM

    Hi Abhishek!

    public class MultiMessageWrapper extends AbstractTransformation {
    @Override
    public void transform(TransformationInput in, TransformationOutput out)throws StreamTransformationException {
    executeMapping(in.getInputPayload().getInputStream(), out.getOutputPayload().getOutputStream());
    }
    
    public void executeMapping(InputStream is, OutputStream os) throws StreamTransformationException {
    try {
    byte input[] = new byte[is.available()];
    is.read(input);
    
    String inxml = new String(input, "UTF-8");
    String outxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
    "<ns0:Messages xmlns:ns0=\"http://sap.com/xi/XI/SplitAndMerge\"><ns0:Message1>" +
    inxml.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "") +
    "</ns0:Message1></ns0:Messages>";
    is.close();
    os.write(outxml.getBytes("UTF-8"));
    }
    catch (Exception e) {
    throw new StreamTransformationException(e.getMessage());
    }
    } }

    Regards, Evgeniy

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 27, 2017 at 06:07 AM

    Hi,

    The messages and message1 in your screenshot just means that you are using multi-mapping. You only need to follow that structure when testing in ESR. At runtime, you can send the document as is and it will get processed. There is no need to use java mapping.

    Regards,

    Mark

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Mark ,

      There is no mapping for Messages & Message1.I am having issue in the Message Mapping ( after successful Java Mapping ) . The node "IDOC" can be multiple in the source structure ( created after Step 1 conversion of WSDL using JM), but the Message Mapping is not working in the Target structure for multiple "IDOC" nodes. Please refer to the attached screen shot mapping-issue.jpg

      Br,

      Abhishek

  • avatar image
    Former Member
    Oct 01, 2017 at 08:37 AM

    Hi All ,

    I am using Java Mapping ( to convert Source WSDL to Idoc format ) , and then Message Mapping for the same Idoc in source and target ( for some internal mapping ).

    The issue is actually in Message Mapping where the node "IDOC" can be multiple from the Java Mapping in the Source Structure.

    But the issue is in the Step 2 , the message mapping is unable to convert the same with the current mapping , attached in the document mapping-issue.jpg

    Br,

    Abhishek

    Add comment
    10|10000 characters needed characters exceeded