2023 Nov 30 4:46 AM
hi experts,
i am trying to convert this XML file into Abap internal table where the root tag <CBISDDStsRptLogMsg.... > contains namespace and my STRANS xml transformation is dumping an exception without much clear information.
Here is the screenshot of the exception CX_ST_MATCH_ELEMENT.
My objective is to get the bolded values below:
<TxInfAndSts> <----NOTE: this is repetitive
<StsRsnInf>
<Rsn>
<CD>ABC</CD>
</Rsn>
<AddtlInf>XYZ</AddtlInf>
This is the provided XML file from the client:
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<CBISDDStsRptLogMsg xmlns="urn:CBI:xsd:CBISDDStsRptLogMsg.00.01.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<GrpHdr>
<MsgId>.....</MsgID>
</GrpHdr>
<OrgnlGrpInfAndSts>
...
...
</OrgnlGrpInfAndSts>
<OrgnlPmtInfAndSts>
<OrgnlPmtInfId>...</OrgnlPmtInfId>
<TxInfAndSts>
<OrgnlInstrId>.....</OrgnlInstrId>
<OrgnlEndToEndId>.....</OrgnlEndToEndId>
<TxSts>.....</TxSts>
<StsRsnInf>
<Orgtr>
<Nm>.....</Nm>
</Orgtr>
<Rsn>
<Cd>ABC</Cd>
</Rsn>
<AddtlInf>XYZ</AddtlInf>
</StsRsnInf>
and here is my STRANS deserialization transformation code:
if i debug this transformation, it is dumping when it reaches the <OrgnlPmtInfAndSts> tag.
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary">
<tt:root name="CBISDDStsRptLogMsg" type="ddic:ZEUDDR_XML_IT"/>
<tt:template>
<CBISDDStsRptLogMsg xmlns="urn:CBI:xsd:CBISDDStsRptLogMsg.00.01.00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" tt:ref=".CBISDDStsRptLogMsg">
<tt:skip name="GrpHdr"/>
<tt:skip name="OrgnlGrpInfAndSts"/>
<OrgnlPmtInfAndSts>
<tt:skip name="OrgnlPmtInfId"/>
<tt:loop ref="ITEMS">
<TxInfAndSts>
<tt:skip name="OrgnlInstrId"/>
<tt:skip name="OrgnlEndToEndId"/>
<tt:skip name="TxSts"/>
<StsRsnInf>
<tt:skip name="Orgtr"/>
<Rsn>
<Cd tt:value-ref="REASON_CODE"/>
</Rsn>
<AddtlInf tt:value-ref="REASON_TEXT"/>
</StsRsnInf>
I do have any further idea why the error is happening even when I have provided the exact tag names. Would appreciate if you could advise what is the error about and how to resolve it.
2023 Nov 30 9:02 AM
solved by digging deeper into the forum with the correct keywords
2023 Nov 30 9:02 AM
solved by digging deeper into the forum with the correct keywords
2023 Nov 30 11:47 AM
Was the issue mainly related to skip and referring to the element with namespace?
Did you fix it something like below, using "dummy" (or whatever name) namespace prefix?
<CBISDDStsRptLogMsg
xmlns="urn:CBI:xsd:CBISDDStsRptLogMsg.00.01.00"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
tt:ref=".CBISDDStsRptLogMsg"
xmlns:dummy="urn:CBI:xsd:CBISDDStsRptLogMsg.00.01.00"> <!-- added xmlns:dummy="..." -->
<tt:skip name="dummy:GrpHdr"/> <!-- added dummy: -->
<tt:skip name="dummy:OrgnlGrpInfAndSts"/> <!-- added dummy: -->
2023 Dec 01 1:40 AM
yup i used name="dummy:GrpHdr" and so on for all the tags that i would like to skip, and it works though i must admit that i do not understand the reason behind this
i also tried this tt:extensible="deep-dynamic" at the Root tag and it works too. This way i do not need to declare a dummy namespace or use the tt:skip at all, and i can straight away access the tags that i want. However in my case, i am afraid my XML could contain tags with same names but at different parent nodes, so i used the first method instead.
2023 Nov 30 10:43 AM
I cannot reproduce your issue. Probably it's not related at all with namespaces.
Possibly it's due to how is defined ZEUDDR_XML_IT versus what you have in your transformation and XML.
Can't say more for now. Please share the exact definition of ZEUDDR_XML_IT. I recommend a screenshot of the Hierarchy view of ZEUDDR_XML_IT.
NB: if it's a short dump, you have to add a TRY CATCH block to catch the ST exceptions.