‎2010 Apr 28 3:32 PM
Hi,
I'm get the Below XML File.
- <XML>
- <DataMapping>
<Field Name="AssociatedBlueSheet" Destination="MH_Bluesheet" Type="boolean">True</Field>
<Field Name="CloseDate" Destination="CloseDate" Type="date">2006%2E12%2E31</Field>
<Field Name="BlueSheetUpdated" Destination="Timestamp" Type="date">timestamp</Field>
<Field Name="RedFlags" Destination="RedFlags" Type="memo">r1%0D%0Ar2%0D%0A</Field>
<Field Name="ManagersNotes" Destination="ManagersNotes" Type="memo">Single%20Sales%20Objective%20%3A%20ss%0D%0A</Field>
<Field Name="ManagersNotesExist" Destination="ManagersNotesFlag" Type="boolean">True</Field>
<Field Name="AdditionalNotesExist" Destination="OpportunityNotesFlag" Type="boolean">True</Field>
- <Table Name="OpportunityContactRole" Destination="Influences">
- <Row>
<Field Name="ContactID" Type="STANDARD">1</Field>
<Field Name="RoleID" Type="STANDARD">U</Field>
<Field Name="RoleName" Type="STANDARD">User</Field>
</Row>
- <Row>
<Field Name="ContactID" Type="STANDARD">1</Field>
<Field Name="RoleID" Type="STANDARD">T</Field>
<Field Name="RoleName" Type="STANDARD">Technical</Field>
</Row>
- <Row>
<Field Name="ContactID" Type="STANDARD">2</Field>
<Field Name="RoleID" Type="STANDARD">E</Field>
<Field Name="RoleName" Type="STANDARD">Economic</Field>
</Row>
</Table>
<Field Name="PlaceInSalesFunnel" Destination="SalesFunnel" Type="string" />
<Field Name="Strengths" Destination="Strengths" Type="memo">s1%0D%0As2%0D%0Atest%0D%0A</Field>
</DataMapping>
</XML>
I want to Read the XML which is the UTF-8 format and also want to save the respective fields in the CRM .
But the problem i'm facing is to conver the such values of field "s1%0D%0As2%0D%0Atest%0D%0A" to normal string or character so that i can update.
Can you please help me to achive this.
Thanks
Nilesh
‎2010 Apr 28 10:39 PM
this format %20%0D%0A etc. is abnormal in an XML. Such characters comes from URIs (web browsers), so the problem is in the web application where data is entered (it should use "unescape" command when form fields are retrieved). Could you explain the whole context please?
‎2010 Apr 28 11:13 PM
I second with what Rossi said.
For eg the date should be coming in as "2006-12-31" and not as "2006%2E12%2E31".
Else, there should be relevant conversion exit/routine that kicks-up to do conversions to valid formats in CRM.
Thanks,
Phani R.Mullapudi
‎2010 Apr 29 6:46 AM
Hi Nilesh,
As pointed out already by the previous two posters your XML document looks a bit odd. The used [percent encoding|http://en.wikipedia.org/wiki/Percent-encoding] is also called URL encoding and that's basically where you find it (URL's and form content).
In XML documents you'd normally expect to see an XML declaration (though not mandatory) of the form <?xml version="1.0" encoding="UTF-8"?> (i.e. specifying version and encoding, the latter could of course be different). Since this is absent in your document it might actually be that you have an XML document that's supposed to be in ASCII. However, in that case on would expect instead of the percent encoding either usage of [entity definitions|http://www.w3.org/TR/2010/PR-xml-entity-names-20100211/] or character encodings starting with &# as described in [Character and Entity References|http://www.w3.org/TR/2008/REC-xml-20081126/#sec-references].
Anyhow, if for some strange reason you're actually facing the same dilemma as most of us (no control over some other crappy application delivering data), check out method UNESCAPE_URL in class CL_HTTP_UTILITY. Usage is straightforward, just plug in the escaped/url-encoded text and you'll get the corresponding result.
Cheers, harald
p.s.: Note that your date format seems off, e.g. your CloseDate of 2006%2E12%2E31 translates to 2006.12.31 (because %2E is a point and not a dash, which one would expect for a date, i.e. 2006-12-31).
‎2010 Apr 30 9:25 AM
Thanks Harald,
I was able to do that with the solution you provided.
Now i was trying tor read the XML file and want to update this in the Database with respective field.
I was using the method find_from_path ( ) of the interface IF_IXML_ELEMENT.
But not able to judge what shoud be the paramters to pass in the 'PATH' for the same XML to read the Value of Name = Associated Blue Sheet and Value = True.
Same for Name = Closedate and Vaue = 2006%2E12%2E31 ( 2006.12.31).
Please suggest.
Thanks again.
Nilesh
‎2010 Apr 30 10:35 AM
If you want to use the iXML library I'd suggest to check the online help, e.g. [iXML ABAP Objects Jumpstart|http://help.sap.com/saphelp_nw04/Helpdata/EN/86/8280ba12d511d5991b00508b6b8b11/frameset.htm]. You could also check out the Wiki, e.g. [XML to ABAP Internal Table Conversion|http://wiki.sdn.sap.com/wiki/display/Snippets/XMLTOABAPINTERNALTABL+CONVERSION].
As an alternative (or extension) to the iXML approach I also recommend to take a look at [CALL TRANSFORMATION|http://help.sap.com/abapdocu_70/en/ABAPCALL_TRANSFORMATION.htm].
If you don't like either way, check out . In general I recommend doing a search on SDN using a term like XML to ABAP transformation, which will give you lots of results. As you'd expect, lots of people had this problem before...