‎2008 May 08 12:09 PM
Hi Experts,
I have a requirement to upload XML data from a web url into SAP.
Can anyone help me on this with sample code?
I need to upload data from an xml file that is in a web page into SAP internal table.
Kindly help at the earliest.
Regards
Naveen
‎2008 May 08 12:16 PM
Hello.
Are you using a SAP XI (Exchange Infrasctructure)? If so, it's easy, just create an inbound proxy, using a XSD file, containing the structure of the XML files you'll get.
If not, you must create a transformation (XSLT) and in your report, use comand CALL transformation, and that will convert the content to an internal table in SAP.
Best regards.
Valter Oliveira.
‎2008 May 08 12:16 PM
Hello.
Are you using a SAP XI (Exchange Infrasctructure)? If so, it's easy, just create an inbound proxy, using a XSD file, containing the structure of the XML files you'll get.
If not, you must create a transformation (XSLT) and in your report, use comand CALL transformation, and that will convert the content to an internal table in SAP.
Best regards.
Valter Oliveira.
‎2008 May 08 12:25 PM
can you send me a sample code for the second one you have said.
I need to upload an xml file using web url. I need a sample code for it.
Regards
Naveen
‎2008 May 08 2:33 PM
Hello again.
First of all you must create a transformation (transaction STRANS or SE80). There you'll get some examples. I must say that it's not easy the first time.
After that, the ABAP part it's simple, just use a statement like this:
CALL TRANSFORMATION (your transformation)
SOURCE XML (a structure with your xml)
RESULT result = (your internal table).
This works in the oposite way, i.e, transform internal table in a XML file.
Best regards.
Valter Oliveira.
‎2008 May 11 7:18 AM
data: http_client type ref to if_http_client .
data: xml_out type string .
call method cl_http_client=>create_by_url
exporting
url = 'http://www.abc.com/rss.xml'
importing
client = http_client.
http_client->send( ).
http_client->receive( ).
clear xml_out .
xml_out = http_client->response->get_cdata( ).
http_client->close( ).
now you have to use your custom XSLT program to convert the xml_out into internal table
or alternatively you can use FM SMUM_XML_PARSE to read the name value pairs from the xml
and then map them to your itab.
Regards
Raja