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 to xml

Former Member
0 Likes
603

Hallow I have a table itab with employee number name and more fields

And I wont to move this table to xml file how can I do that and how can I check that it happen?

If sap have function plz tell how to use it

regards

Hallow I have a table itab with employee number name and more fields

And I wont to move this table to xml file how can I do that and how can I check that it happen?

If sap have function plz tell how to use it

regards

3 REPLIES 3
Read only

ashok_kumar24116
Contributor
0 Likes
555

Hi antonio rodrigo ,

<b>Please check this sample program.

1. ABAP Internal Table -


> XML

XML ---> ABAP Internal Table

2. This program will show both.

3. It will do this for

T001 table.

4. Just copy paste in new program.

REPORT abc.

*----


DATA

DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.

DATA : BEGIN OF itab OCCURS 0,

a(100) TYPE c,

END OF itab.

DATA: xml_out TYPE string .

DATA : BEGIN OF upl OCCURS 0,

f(255) TYPE c,

END OF upl.

DATA: xmlupl TYPE string .

                                                              • FIRST PHASE

                                                              • FIRST PHASE

                                                              • FIRST PHASE

*----


Fetch Data

SELECT * FROM t001 INTO TABLE t001.

*----


XML

CALL TRANSFORMATION ('ID')

SOURCE tab = t001[]

RESULT XML xml_out.

*----


Convert to TABLE

CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'

EXPORTING

i_string = xml_out

i_tabline_length = 100

TABLES

et_table = itab.

*----


Download

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filetype = 'BIN'

filename = 'd:\xx.xml'

TABLES

data_tab = itab.

                                                              • SECOND PHASE

                                                              • SECOND PHASE

                                                              • SECOND PHASE

BREAK-POINT.

REFRESH t001.

CLEAR t001.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = 'D:\XX.XML'

filetype = 'BIN'

TABLES

data_tab = upl.

LOOP AT upl.

CONCATENATE xmlupl upl-f INTO xmlupl.

ENDLOOP.

*----


XML

CALL TRANSFORMATION ('ID')

SOURCE XML xmlupl

RESULT tab = t001[]

.

BREAK-POINT.

I have checked this Program, This is perfect fine.

We can use this logic to generate the XML source code.</b>

Good Luck and thanks

AK

Read only

uwe_schieferstein
Active Contributor
0 Likes
555

Hello Antonio

Simply use the <b>CALL TRANFORMATION</b> statement:

DATA:
  ld_xml    TYPE string.


  CALL TRANSFORMATION ident
    SOUCE itab = lt_itab   " your itab with employee number
    RESULT XML ld_xml.

Regards

Uwe

Read only

Former Member
0 Likes
555

Hello,

Check these links..

/people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach

If useful reward.

Vasanth