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

code to transfer xml file to abap internal table using transformation

Former Member
0 Likes
496

Hi friends

Given the following xml file .the requirementis to display and transfer the xml file to internal table usin transformation and gui_upload.If any onehaving simple code on this please send .

Can any one sugest the steps to be followed to write source code using simple transformation.

<?xml version="1.0" encoding="utf-8" ?>

- <Negara>

- <item>

- <COUNTRY>

<MANDT>600</MANDT>

<ZCODE>500</ZCODE>

<ZDESC>Pening Lalat</ZDESC>

<ZSAPCD>T1</ZSAPCD>

</COUNTRY>

</item>

- <item>

- <COUNTRY>

<MANDT>600</MANDT>

<ZCODE>600</ZCODE>

<ZDESC>Pening Lalat2</ZDESC>

<ZSAPCD>T2</ZSAPCD>

</COUNTRY>

</item>

</Negara>

Thaking You

3 REPLIES 3
Read only

Former Member
0 Likes
456

hi..

1. itab --- > xml

xml ---> itab.

2. This program will do both.

(just copy paste in new program)

3.

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

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[].

<b>Reward points if useful</b>

Regards

Ashu

Read only

0 Likes
456

Hai Ashu

How to write code in transformation (simple transformation ) .

Than You

Read only

Former Member
0 Likes
456