Read utf-8 xml file with abap
Λεπτομέρειες
- Λεπτομέρειες
- Κατηγορία: ABAP
- Δημιουργηθηκε στις Πέμπτη, 21 Ιουνίου 2012 07:04
- Τελευταία Ενημέρωση στις Τετάρτη, 27 Φεβρουαρίου 2013 07:28
- Δημοσιεύτηκε στις Πέμπτη, 21 Ιουνίου 2012 07:04
- Γράφτηκε από τον/την Administrator
- Εμφανίσεις: 15318
Read utf-8 xml file and store it in string variable :
*--------------------------------------------------------------
* www.developerpages.gr
*
* Read UTF-8 xml file
*
*--------------------------------------------------------------
report zread_xml.
data XML_STRING type STRING.
DATA line TYPE string.
clear xml_string.
PARAMETERS xml_file(255).
OPEN DATASET xml_file IN TEXT MODE for input ENCODING UTF-8 .
if sy-subrc = 0.
DO.
READ DATASET xml_file INTO line.
IF sy-subrc <> 0.
EXIT.
else.
CONCATENATE xml_string line INTO xml_string.
ENDIF.
ENDDO.
if not xml_string is initial.
write :/ 'ready to parse xml...'.
else.
write :/ 'file is empty ! ', xml_file.
endif.
else.
WRITE :/ 'cannot open file ', xml_file.
endif.
click here if you want to see how to Parse xml file with ABAP