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

Open XML file and modify

Former Member
0 Likes
5,077

Hello All,

anybody have a procedure to open a XML file and modify some os that tags and after save it at a local file or a server?

Best Regards,

Ricardo

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,359

Take a look at the ABAP-XML Transformation programs TCODE STRANS (lot of good blogs in SDN and SAP help)... You could transform the XML to internal table and then massage the data and transform it back to XML and save it to local file or server...

Or you can use PI to do the same;

4 REPLIES 4
Read only

Former Member
0 Likes
2,360

Take a look at the ABAP-XML Transformation programs TCODE STRANS (lot of good blogs in SDN and SAP help)... You could transform the XML to internal table and then massage the data and transform it back to XML and save it to local file or server...

Or you can use PI to do the same;

Read only

0 Likes
2,359

Hello Kris,

this is the idea (to transform into internal table and modify data and after export to XML) but i didn't find anything that fits on this sittuation.

Anybody gives me another suggettion?

thanks,

Ricardo

Read only

0 Likes
2,359

Ricardo,

Take a look at this simple transformation example,

http://help.sap.com/abapdocu_70/en/ABENABAP_ST_EXAMPLE.htm

http://wiki.sdn.sap.com/wiki/display/Snippets/XMLXLStransformation

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a89312f8-0b01-0010-86b3-fdd7178e0...

Last, but not least take a look at the blog series here in SDN.. He has a five part series for XML processing in ABAP...

/people/tobias.trapp/blog/2005/05/04/xml-processing-in-abap-part-1

Read only

Former Member
0 Likes
2,359

You can either try parsing the XML, or use the Document Object Model. I think using the DOM would be the better approach.

The first thing you'll want to do is get XML document into a reference of type if_ixml_document.

Then you can use the document object model, which will allow you to get references of the XML document in object model represenation. For example, you can use references to types of if_ixml_node_collection, if_ixml_node_iterator, if_ixml_node, to update the model.

You can use the method if_ixml_document~render_2_string to write it back out to XML when you're done.