on ‎2019 Feb 28 8:13 PM
Hi Experts,
We are on SAP PO 7.5.
When we are executing the java mapping in ESR, it is throwing the below error..
Error Details:
Unable to display tree view; Error when parsing an XML document (XML document structures must start and end within the same entity.)
I have verified the output payload and could see the end tag "</ns0:MT_BD_QP_ECC>"is missing after last </row> tag.
It should not repeat after every </row> tag.
Expected output
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_BD_QP_ECC xmlns:ns0="urn:BDG-is.com/xi/KWE/KIG/01_db">
<row>
<pSystemId>DUK</pSystemId>
<pRecordType>BD</pRecordType>
<pSourceSystem>SAPXI</pSourceSystem>
<pStatus>1</pStatus>
<pPlantCodeCHO</pPlantCode>
<pBlockCode>B</pBlockCode>
<pDateTimeFrom>2019-01-01T00:00:00.000+00:00</pDateTimeFrom>
<pDateTimeTo>2019-01-31T23:59:59.999+00:00</pDateTimeTo>
<pMaterial>Apple</pMaterial>
<pAmount>106789.055</pAmount>
<pAmountUnit>HW</pAmountUnit>
</row>
<row>
<pSystemId>DUK</pSystemId>
<pRecordType>BD</pRecordType>
<pSourceSystem>SAPXI</pSourceSystem>
<pStatus>1</pStatus>
<pPlantCode>CHO</pPlantCode>
<pBlockCode>B</pBlockCode>
<pDateTimeFrom>2019-01-01T00:00:00.000+00:00</pDateTimeFrom>
<pDateTimeTo>2019-01-31T23:59:59.999+00:00</pDateTimeTo>
<pMaterial>Orange</pMaterial>
<pAmount>189567.055</pAmount>
<pAmountUnit>HW</pAmountUnit>
</row>
</ns0:MT_BD_QP_ECC>
Error Output
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_BD_QP_ECC xmlns:ns0="urn:BDG-is.com/xi/KWE/KIG/01_db">
<row>
<pSystemId>DUK</pSystemId>
<pRecordType>BD</pRecordType>
<pSourceSystem>SAPXI</pSourceSystem>
<pStatus>1</pStatus>
<pPlantCodeCHO</pPlantCode>
<pBlockCode>B</pBlockCode>
<pDateTimeFrom>2019-01-01T00:00:00.000+00:00</pDateTimeFrom>
<pDateTimeTo>2019-01-31T23:59:59.999+00:00</pDateTimeTo>
<pMaterial>Apple</pMaterial>
<pAmount>106789.055</pAmount>
<pAmountUnit>HW</pAmountUnit>
</row>
<row>
<pSystemId>DUK</pSystemId>
<pRecordType>BD</pRecordType>
<pSourceSystem>SAPXI</pSourceSystem>
<pStatus>1</pStatus>
<pPlantCode>CHO</pPlantCode>
<pBlockCode>B</pBlockCode>
<pDateTimeFrom>2019-01-01T00:00:00.000+00:00</pDateTimeFrom>
<pDateTimeTo>2019-01-31T23:59:59.999+00:00</pDateTimeTo>
<pMaterial>Orange</pMaterial>
<pAmount>189567.055</pAmount>
<pAmountUnit>HW</pAmountUnit>
</row>
In our mapping, we are using startElement / endElement (String uri, String localName, String qName) methods to Receive notification of the start and end of an element.
public void endElement (String uri, String localName, String qName) throws SAXException
{
newContent = true;
if(qName.equals("row"))
{
if(currentRecord.flag != null &&
currentRecord.flag.equals("OK")) // Create result entry if flag OK set
{
if (targetsystem.equals("ECC")) // ECC Result
{
// ECC is only interested in records having VTBT_DATUM >= 2010
if(Tools.DateHasValidYearECC(currentRecord.VTBT_DATUM, 2010))
{
mapToTargetRecordsXem();
}
}
}
}
else if(qName.equals("ES_MT_BD_QP_transit_ECC"))
{
// end ECC result document
result.append("</ns0:MT_BD_QP_ECC>");
}
}
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Hi Bhargava Krishna!
Try to use localName instead of qName in your "endElement" method. qName stands for Fully Qualified Name (namespace + element name).
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Evgeniy,
Thanks for your response.
If we use localName, we are not getting any output. so we have changed it to qName in both StartElement () and endElement() and could see the output, but the only problem is end tag is missing here.
We are migrating the interfaces from 7.31 dual stack to 7.5 single stack system.
java code is working with localName in 7.31 but not in 7.5 system.Even we have no clue how it is working with qName in SAP PO 7.5.
We even compared the mapping output from the old and new systems and could see except end tag the remaining output data is generating as expected.
We have around 10K lines of code and from one java class they are calling 6 different classes to build the target structure / Trigger script programming / Authentication / Fetch the records by keying the query and generate source xml structure, and sending it to SAP PI etc, value mapping etc..
Since there is no documentation, it is difficult for us to simplify the mapping and check why the code has been written.
Regards
Bhargava Krishna
Hi Hasan,
Thanks for your reply.
It's error while pasting the payload here. We could see the below code in the output payload.
<<pPlantCode>CHO</pPlantCode>
Only problem is with end tag </ns0:MT_BD_QP_ECC>
Regards
Bhargava Krishna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 9 | |
| 4 | |
| 4 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.