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

ABAP and XML

Former Member
0 Likes
811

Do you have any information about reading a XML File from ABAP?

5 REPLIES 5
Read only

GrahamRobbo
SAP Mentor
SAP Mentor
0 Likes
766

How about going to the online help and seaching for "XML".

Read only

Former Member
0 Likes
766

Hi ,

see this demo program TST_CL_FX_READER .

also do search in SE38 with TST_CL* you will get some more programs .

Tthank you .

Regards ,

Kumar.

Read only

Former Member
0 Likes
766

use these two functions,

but first you have to download xml to a string with another function. It matter with respect to the source. For example if you want to take it from net u use CALL FUNCTION 'HTTP_GET'

but i dont know how to read a local file. But you can find it with a search.

At the end you will have the xml in an internal table. Then you can again parse it for your own usage.

Hope it will help

&----


*& Form str_to_xstr

&----


  • text

----


  • -->PV_PAGE text

  • -->BUFFER text

----


FORM STR_TO_XSTR USING PV_PAGE TYPE STRING

CHANGING BUFFER.

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

TEXT = PV_PAGE

  • MIMETYPE = ' '

  • ENCODING =

IMPORTING

BUFFER = BUFFER

  • EXCEPTIONS

  • FAILED = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. "str_to_xstr

*

FORM PARSEXML TABLES XMLTABLE RETURN

USING BUFFER.

CALL FUNCTION 'SMUM_XML_PARSE'

EXPORTING

XML_INPUT = BUFFER

TABLES

XML_TABLE = XMLTABLE

RETURN = RETURN.

ENDFORM. "parsexml

Read only

Former Member
0 Likes
766

Read this, it might help you:

http://www.heidoc.net/joomla/en/technology-science/sap-and-xslt/5-tutorial-data-exchange-between-aba...

Best wishes,

Jan

Edited by: Jan Krohn on Jul 15, 2011 10:54 AM