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

XML

Former Member
0 Likes
565

Hi ,

I need to move soem fields from an ITAB to Custom code of XML.

How do I do this

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
537

Hi,

Please check this sample program from other thread.


1. internal table -------> Xml
xml -----------------> 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.

Regards,

Ferry Lianto

3 REPLIES 3
Read only

Former Member
0 Likes
537

You have to use the CALL transformations syntax.

REgards,

Ravi

Read only

ferry_lianto
Active Contributor
0 Likes
538

Hi,

Please check this sample program from other thread.


1. internal table -------> Xml
xml -----------------> 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.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
537

View interfaces IF_IXML_DOCUMENT , IF_IXML_ELEMENT from package SIXML