Skip to Content
0

Java Mapping - Add New Nodes

Sep 25, 2017 at 11:16 AM

87

avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Evgeniy Kolmakov Oct 02, 2017 at 11:49 AM
1

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.

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Sep 25, 2017 at 01:19 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Mark Dihiansan Sep 27, 2017 at 06:07 AM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Mark ,

Yes 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 )

While executing at runtime , following error message is received in the PI Monitor .

com.sap.aii.mappingtool.tf7.IllegalInstanceException: Cannot create target element /ns0:Messages. Values missing in queue context. Target XSD require~

Br,

Abhishek

0

Hi Abhishek,

Please remove any mapping logic you have for Messages and Message1.

Regards,

Mark

0
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

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

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


mapping-issue.jpg (70.9 kB)
Share
10 |10000 characters needed characters left characters exceeded