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

Upload XML file from server to itab

Former Member
0 Likes
686

After failed to get a answer about download data from xml file in server to my itab, and searching and searching in hundred of post and threads i try my own solution for this issue.

I read the file with:

OPEN DATASET FICHERO FOR INPUT IN TEXT MODE ENCODING DEFAULT. 

In this case the result is a table filled with register type string like this:

 #<label>22222</label> 

I need a table with this kind of value (example):

label | 22222

label2 | John

label3 | Smith

Therefore i have to parse the data of my table, i try with the FM:

TEXT_CONVERT_XML_TO_SAP 

But dont works for me,

I am too new in ABAP.

The code for my report is very simple:


REPORT ZPRUEBA_XML.

DATA: BEGIN OF TABLA OCCURS 1,
TEXTO(256) TYPE C,
END OF TABLA.

DATA: FICHERO LIKE RLGRAP-FILENAME.

OPEN DATASET FICHERO FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
  WRITE:/ 'ERROR'.
ENDIF.
FREE TABLA.
DO.
  READ DATASET FICHERO INTO TABLA.
  IF SY-SUBRC NE 0.
    EXIT.
  ELSE.
    APPEND TABLA.
    WRITE: TABLA-TEXTO.
  ENDIF.
ENDDO.

CLOSE DATASET FICHERO.

And my ".xml" in the server is very simple too.


<label>222222</label>
<name>John</name>
<street>Smith, 23, NY</street>

Anyone can help me?

Thanks

After failed to get a answer about download data from xml file in server to my itab, and searching and searching in hundred of post and threads i try my own solution for this issue.

I read the file with:

OPEN DATASET FICHERO FOR INPUT IN TEXT MODE ENCODING DEFAULT. 

In this case the result is a table filled with register type string like this:

 #<label>22222</label> 

I need a table with this kind of value (example):

label | 22222

label2 | John

label3 | Smith

Therefore i have to parse the data of my table, i try with the FM:

TEXT_CONVERT_XML_TO_SAP 

But dont works for me,

I am too new in ABAP.

The code for my report is very simple:


REPORT ZPRUEBA_XML.

DATA: BEGIN OF TABLA OCCURS 1,
TEXTO(256) TYPE C,
END OF TABLA.

DATA: FICHERO LIKE RLGRAP-FILENAME.

OPEN DATASET FICHERO FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF SY-SUBRC NE 0.
  WRITE:/ 'ERROR'.
ENDIF.
FREE TABLA.
DO.
  READ DATASET FICHERO INTO TABLA.
  IF SY-SUBRC NE 0.
    EXIT.
  ELSE.
    APPEND TABLA.
    WRITE: TABLA-TEXTO.
  ENDIF.
ENDDO.

CLOSE DATASET FICHERO.

And my ".xml" in the server is very simple too.


<label>222222</label>
<name>John</name>
<street>Smith, 23, NY</street>

Anyone can help me?

Thanks

3 REPLIES 3
Read only

Former Member
0 Likes
561

Hi,

You could use a transformation to do that, or call FM 'TEXT_CONVERT_XML_TO_SAP'... you also have the class IF_IXML that should help you and a lot of threads on the subject, such as:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e66701fc-0d01-0010-9c9a-f8a36c4e8...

Kr,

Manu.

Read only

0 Likes
561

Hi Manu, thanks for your answer.

My Abap knowledge are very limited.

Do you have time to write me a little source code with a practice example.

I am crazy about implementing that functions about the table types and how fill from server.

Regards.

Edited by: DIEGO_GT on Nov 22, 2011 12:09 PM

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
561

Hi,

You have posted the same question few days back . An efficient search will give you the answer. Search in google first then into SDN

[UPLOAD XML FILE FROM APPLICATION SERVER|http://abapreports.blogspot.com/2008/09/upload-xml-file-from-application-server.html]

Kesav