Application Development 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: 

Problem using SAP_CONVERT_TO_XML_FORMAT

Former Member
0 Kudos

Hi Experts,

I am not able to use SAP_CONVERT_TO_XML_FORMAT fm.

Its documentation is also not available in our system.

What are the parameters that we need to pass in it.

The scenario with my report is :

I have my data in an internal table and that is to be converted to XML format.

I have searched for programs also using the same function.

In that program it was passing a field symbol of type table to "tables" parameter of FM.

Is it necessary to use field-symbols.

What exactly are the parameters that are required to be passed ?

P.S. I have searched in other threads also and got some information but through that information I am not able to implement it practically. That's why I am raising a new question despite of many answers to already asked question.

5 REPLIES 5

Former Member
0 Kudos

Hello Shreya,

Try if this works for you...

It contains a successful implementation of FM, SAP_CONVERT_TO_XML_FORMAT

[http://sap.ittoolbox.com/groups/technical-functional/sap-dev/using-sap_convert_to_xml_format-555753|http://sap.ittoolbox.com/groups/technical-functional/sap-dev/using-sap_convert_to_xml_format-555753]

Hope it helps you

Regards

Indu.

Former Member
0 Kudos

Hi,

Example:

PARAMETERS: p_file LIKE rlgrap-filename DEFAULT 'H:\TESTSAP.xls'.

CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'

EXPORTING

i_filename = p_file

TABLES

i_tab_sap_data = tab_etab.

Here the Tab_etab contains the data to be displayed in excel.

Hope it helps u.

Thanks,

Ruthra

Former Member
0 Kudos

Hi

Go through the link given below :

https://www.sdn.sap.com/irj/sdn/wiki?path=/pages/viewpage.action?pageId=39728

With Regards

Nikunj Shah

Former Member
0 Kudos

hi shreya,

http://korparepa.freeblog.hu/

check this link

It helps you

Regards

Mohammed

Former Member
0 Kudos

Hi shreya,

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.



CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
  EXPORTING
    TEXT            = xml_out
* IMPORTING
*   LENGTH          =
  TABLES
    FTEXT_TAB       = 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,

amit m.