SharpSapRfc is a great helper for calling SAP functions and getting the retrieved data mapped. Great work.
Using it in a real project, I ran into a problem handling nested XML "tables".
By calling an SAP Function Module using SoapSapRfcConnection.ExecuteFunction(), I get an XML from SAP that looks like:
<CT_WF_USERS>
<item>
<VBELN>4300303500</VBELN>
<USERS>
<item>
<PARVW>ZE</PARVW>
<PERNR>04040803</PERNR>
</item>
<item>
<PARVW>ZL</PARVW>
<PERNR>01981291</PERNR>
</item>
<item>
<PARVW>ZM</PARVW>
<PERNR>04042574</PERNR>
</item>
</USERS>
</item>
<item>
<VBELN>4300303477</VBELN>
<USERS>
<item>
<PARVW>ZE</PARVW>
<PERNR>04042574</PERNR>
</item>
<item>
<PARVW>ZM</PARVW>
<PERNR>04044878</PERNR>
</item>
</USERS>
</item>
</CT_WF_USERS>
I want to map this XML into an object structure like:
User {
string PARVW,
string PERNR
}
WfUsers {
string VBELN,
User[] USERS
}
Using RfcResult.GetTable<WfUser>("CT_WF_USERS"), I am not able to achieve this. The reason is, that GetTable<>() does not handle the inner items list correctly, but simply treats it as a string.
Looking at you code in SoapRfcStructureMapper.FromXml<T>() I figured out that SetProperty() is always called passing the InnerText of an XML node. In short, it does not consider inner XML "tables".
Is there a chance to get this functionality added to your component? Otherwise, I would have to create a workaround in order to get this case working.
I'm looking forward to your feedback.
SharpSapRfc is a great helper for calling SAP functions and getting the retrieved data mapped. Great work.
Using it in a real project, I ran into a problem handling nested XML "tables".
By calling an SAP Function Module using SoapSapRfcConnection.ExecuteFunction(), I get an XML from SAP that looks like:
I want to map this XML into an object structure like:
Using
RfcResult.GetTable<WfUser>("CT_WF_USERS"), I am not able to achieve this. The reason is, thatGetTable<>()does not handle the inner items list correctly, but simply treats it as a string.Looking at you code in
SoapRfcStructureMapper.FromXml<T>()I figured out thatSetProperty()is always called passing theInnerTextof an XML node. In short, it does not consider inner XML "tables".Is there a chance to get this functionality added to your component? Otherwise, I would have to create a workaround in order to get this case working.
I'm looking forward to your feedback.