Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Reg: Upload XML data from URL into SAP

Former Member
0 Likes
1,682

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

1 ACCEPTED SOLUTION
Read only

valter_oliveira
Active Contributor
0 Likes
1,003

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.

4 REPLIES 4
Read only

valter_oliveira
Active Contributor
0 Likes
1,004

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.

Read only

0 Likes
1,003

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

Read only

0 Likes
1,003

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.

Read only

0 Likes
1,003

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