cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve XML from within XML

Former Member
0 Kudos

Hi,

I have an integration scenario that an XML string is stored in one field of an XML structure, e.g.

<root>

<Date>2006-01-01</Date>

<XMLString>.....XML message.....</XMLString>

</root>

How can I put the content of the <XMLString> tab into payload?

Regards,

Larry

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Larry,

Is it possible to just use the complete XML and ignoring the non-relevent XML elements, e.g. <Date>? Maybe you can send an example.

I am not sure what you mean.

Regards,

Bill

Former Member
0 Kudos

Hi Bill,

The scenario is SAP SRM making an RFC call to XI; one of the import parameters in RFC is a XML string. XI needs to extract this XML string and map to RFC export parameters of RFC and send back the response to SAP SRM.

SAP SRC<-RFC->XI

The original scenario is using SAPBC but now we need to replace BC by XI.

Regards,

Larry

Former Member
0 Kudos

Hi Larry,

I am still not sure that I understand what you are asking.

Even an XML is inside an XML, you can still access the elements, and, therefore, map them to a target document.

Do you have an example of a source XML document from SRM?

Regards,

Bill

Former Member
0 Kudos

Hi Bill,

Below is the sample RFC-XML request message. In which the tag <IV_XML_DOCUMENT> is the RFC export parameter and contains a XML document. The question is how I can map the data in this XML string into other XML document (import parameter of the RFC response)? I found I cannot map the content of this XML string because it is not defined in any data type, message type or RFC metadata.

Best regards,

Larry

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

<rfc:MAP_XML_TO_ITABS xmlns:rfc="urn:sap-com:document:sap:rfc:functions">

<IV_XML_DOCUMENT>&lt;?xml version="1.0"?&gt; &lt;BusinessDocument&gt;&lt;Catalog&gt;&lt;CatalogID&gt;&lt;/CatalogID&gt;&lt;Product ProductType="Good"&gt;&lt;CatalogKey&gt;85200&lt;/CatalogKey&gt;&lt;ParentCategoryID&gt;85200&lt;/ParentCategoryID&gt;&lt;Description Language="EN"&gt;W0018028:Zip 250MB Disk&lt;/Description&gt;&lt;ShoppingBasketItem RefVendorDescription="0" RefManufacturerDescription="1"&gt;&lt;Quantity UoM="PCE"&gt;4&lt;/Quantity&gt;&lt;NetPrice&gt;&lt;Price Currency="HKD"&gt;124.9&lt;/Price&gt;&lt;PriceUnit&gt;1&lt;/PriceUnit&gt;&lt;/NetPrice&gt;&lt;LeadTime&gt;1&lt;/LeadTime&gt;&lt;ItemText Language="EN"&gt;Computer Supplies&lt;/ItemText&gt;&lt;/ShoppingBasketItem&gt;&lt;VendorDescription ID="0"&gt;&lt;PartnerProductID Code="Other"&gt;0018028&lt;/PartnerProductID&gt;&lt;PartnerID&gt;&lt;/PartnerID&gt;&lt;BuyerContract&gt;&lt;ContractID&gt;&lt;/ContractID&gt;&lt;ContractItemID&gt;&lt;/ContractItemID&gt;&lt;/BuyerContract&gt;&lt;/VendorDescription&gt;&lt;/Product&gt;&lt;Product ProductType="Good"&gt;&lt;CatalogKey&gt;85200&lt;/CatalogKey&gt;&lt;ParentCategoryID&gt;85200&lt;/ParentCategoryID&gt;&lt;Description Language="EN"&gt;W0018034:Zip 100MB Disk&lt;/Description&gt;&lt;ShoppingBasketItem RefVendorDescription="0" RefManufacturerDescription="1"&gt;&lt;Quantity UoM="PCE"&gt;5&lt;/Quantity&gt;&lt;NetPrice&gt;&lt;Price Currency="HKD"&gt;83.6&lt;/Price&gt;&lt;PriceUnit&gt;1&lt;/PriceUnit&gt;&lt;/NetPrice&gt;&lt;LeadTime&gt;1&lt;/LeadTime&gt;&lt;ItemText Language="EN"&gt;Computer Supplies&lt;/ItemText&gt;&lt;/ShoppingBasketItem&gt;&lt;VendorDescription ID="0"&gt;&lt;PartnerProductID Code="Other"&gt;0018034&lt;/PartnerProductID&gt;&lt;PartnerID&gt;&lt;/PartnerID&gt;&lt;BuyerContract&gt;&lt;ContractID&gt;&lt;/ContractID&gt;&lt;ContractItemID&gt;&lt;/ContractItemID&gt;&lt;/BuyerContract&gt;&lt;/VendorDescription&gt;&lt;/Product&gt;&lt;/Catalog&gt;&lt;/BusinessDocument&gt;</IV_XML_DOCUMENT>

<XML_TYPE>ESAPO</XML_TYPE>

<LONGTEXT>

</LONGTEXT>

<NEW_BASKET>

</NEW_BASKET>

<XML_TABLE>

<item>

</item>

</XML_TABLE>

</rfc:MAP_XML_TO_ITABS>

Former Member
0 Kudos

Hi Larry,

There are 2 ways you can do this.

1. adapter user-module.

http://help.sap.com/saphelp_nw04/helpdata/en/e9/61e1407e858031e10000000a1550b0/frameset.htm

or

2. java mapping.

http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm

Both of these programs can extract the content of <IV_XML_DOCUMENT>. In addition, convert "&lt;" to "<" and "?&gt;" to ">". The resulting XML document will contain what you wanted.

Regards,

Bill

Answers (1)

Answers (1)

Former Member
0 Kudos

u got to parse the XML to get the that XML String.. u can parse the XML and get the particular element and element value..

u can use either Java code or XSLT for that..

thanks-GS