Skip to Content
0
Apr 03, 2013 at 06:16 AM

Getting syntax error while converting internal table data to XML

30 Views

REPORT ZCREATEXML_FROMITAB.

DATA: BEGIN OF carrier_wa,
carrid TYPE sflight-carrid,
carrname TYPE sflight-connid,
planetype TYPE sflight-PLANETYPE,
END OF carrier_wa,
carrier_tab LIKE TABLE OF carrier_wa,
xml_xstring TYPE xstring,
g_xml_outputs TYPE string.
DATA: wa_erfiling TYPE string,
lt_erfiling LIKE STANDARD TABLE OF wa_erfiling.
PARAMETERS: p_file TYPE string MODIF ID xml.

SELECT * FROM sflight

INTO CORRESPONDING FIELDS OF TABLE carrier_tab.

CALL TRANSFORMATION Zdemo_st_table OPTIONS XML_HEADER = 'NO'
SOURCE CARRIERS = carrier_tab
RESULT XML xml_xstring.

CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = xml_xstring
IMPORTING
out_string = g_xml_outputs.
wa_erfiling = g_xml_outputs.

APPEND wa_erfiling to lt_erfiling.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'ASC'
TABLES
data_tab = lt_erfiling
.

IF sy-subrc <> 0.
MESSAGE 'XML Generation Failed' TYPE 'E'.
ELSE.
MESSAGE 'XML Generation Successful' TYPE 'S'.
ENDIF.

And my Transformation is

<?sap.transform simple?>

<tt:transform xmlns:tt="http://www.sap.com/transformation-templates" xmlns:ddic="http://www.sap.com/abapxml/types/dictionary" xmlns:def="http://www.sap.com/abapxml/types/defined">

<tt:root name="CARRIERS" type="ddic:SFLIGHT"/>

<tt:template>

<DUTY-PAYABLE-FOR-CLEARANCE>

<test2 tt:value-ref=".CARRIERS.CARRID"/>

<test tt:value-ref=".CARRIERS.CONNID"/>

<test1 tt:value-ref=".CARRIERS.PLANETYPE"/>

</DUTY-PAYABLE-FOR-CLEARANCE>

</tt:template>

</tt:transform>

Please let me know the reason for the error.

Attachments