cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module to read xml

Former Member
0 Kudos

Hi All,

How SAP reads a xml file ?

Any function module , or code that can read xml file .

Please let me know .

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
Paul_Babier
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello,

I came across this blog that talks about ABAP to XML and visa versa.

It is really about parsing xml files into ABAP tables and visa versa, so I thought that since

you are trying to read xml and were looking for a functional module, sounds like this offers a solutuion for you.

Perhaps it could be useful to your requirements? Please have a look.

/people/alok.deep/blog/2009/12/21/xml-to-abap-conversion-and-vice-versa

Hope it helps

Regards,

Paul

pappu_kumar2
Participant
0 Kudos

HI abijit,

See the below code.

PARAMETERS: p_filnam TYPE localfile OBLIGATORY

*DEFAULT 'C:\Documents and Settings\test.xml'.
DEFAULT 'D:\xx.xml'.

parameters : r1 radiobutton group r1,
              r2 radiobutton group r1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_filnam.

DATA: l_v_fieldname TYPE dynfnam.

l_v_fieldname = p_filnam.


START-OF-SELECTION.

TYPES : BEGIN OF ys_xml_line,
             data(256) TYPE x,
         END OF ys_xml_line.
TYPES: yt_xml_table TYPE TABLE OF ys_xml_line.
DATA: tab_raw_data TYPE yt_xml_table.

TYPES: t_xml_line(1024) TYPE x.
DATA: l_xml_table       TYPE TABLE OF t_xml_line.

CALL FUNCTION 'TEXT_CONVERT_XML_TO_SAP'
   EXPORTING
*   I_FIELD_SEPERATOR          = ';'
*   I_LINE_HEADER              =
     i_tab_raw_data             = tab_raw_data
*   I_FILENAME                 =
     i_totalsize                = 10000
   tables
     i_tab_converted_data       = l_xml_table
* EXCEPTIONS
*   CONVERSION_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.

TomCenens
Active Contributor
0 Kudos

Hello

I would advise you to check the following blog to help you further with your questions:

[http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/17662] [original link is broken] [original link is broken] [original link is broken];

Your question is so short and doesn't give any context to what you want to perform or what you are looking for it's almost impossible to give a proper answer to it.

Why do you need SAP to read a XML file, in which context, to achieve what end result etc, please post more details to what you are asking.

Kind regards

Tom