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

How to read XML file format

Former Member
0 Likes
945

Presently calling a webservice to search for customer which generates a XML file. Requirement is to check the XML file format in case of success move to next step and in case of error exit from the application.

The file generated can have multiple formats as per input supplied.

Please advise how the file format can be checked.

Thanks

anya

Presently calling a webservice to search for customer which generates a XML file. Requirement is to check the XML file format in case of success move to next step and in case of error exit from the application.

The file generated can have multiple formats as per input supplied.

Please advise how the file format can be checked.

Thanks

anya

3 REPLIES 3
Read only

Former Member
0 Likes
874

hi anya,

Try to use FM IDOC_XML_FROM_FILE.

or check the below code

data: temp_str type string.

concatenate '>' cl_abap_char_utilities=>cr_lf '<'><' in XML_STRING with temp_str.

xml_string is the straing variable to hold the xml .

now use xml_string to show it in texteditor.

-Thanks

Saurabh Goel

Read only

Former Member
0 Likes
874

Hi,

Function module to read the XML file in SAP is TEXT_CONVERT_XML_TO_SAP.

or

Load XML file using open dataset and read it into string variable.

Refer to SAP help on DATASET.

with regards,

Mamta Kumari

Edited by: Mamta Kumari on Aug 18, 2009 2:22 PM

Read only

brad_bohn
Active Contributor
0 Likes
874

If you're using a web service, then you know that the web service itself returns the response as an XML string. You should use a transformation template to convert to the corresponding tables, structures etc. in your program. The transformation will also check for the proper formation of the XML. You can use XSLT or SAP's version in the template. See transaction XSLT_TOOL and ABAP statement CALL TRANSFORMATION.

Don't use the outdated methods as the others suggested - it doesn't sound like they've worked with web services or later XML technologies...