‎2010 Apr 23 1:38 PM
Hello Experts,
I need to read xml file through ABAP, I have done all steps but still the returned object is empty. here is what I did:
XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration>
<common>
<in_out_path>C:/SAP/CC1/IN-OUT</in_out_path>
<error_log_path>C:/SAP/CC1/ERROR-LOG</error_log_path>
<hr_mm_data_path>C:/SAP/CC1/mmdata</hr_mm_data_path>
</common>
</configuration>
ABAP Object:
TYPES: BEGIN OF tp_common,
in_out_folder(50) TYPE c,
error_log_folder(50) TYPE c,
hr_mm_data_folder(50) TYPE c,
END OF tp_common.
TYPES: BEGIN OF tp_config,
common TYPE tp_common,
END OF tp_config.
DATA: t_config TYPE STANDARD TABLE OF tp_config,
o_config TYPE tp_config.
DATA: gt_result_xml TYPE abap_trans_resbind_tab,
gs_result_xml TYPE abap_trans_resbind.
ABAP call
GET REFERENCE OF t_config INTO gs_result_xml-value.
gs_result_xml-name = 'OUT'.
APPEND gs_result_xml TO gt_result_xml.
TRY.
CALL TRANSFORMATION z_xml_to_abap
SOURCE XML xml_content
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
WRITE:/ 'Transformation error: ', gs_var_text.
EXIT.
ENDTRY.
Print Data:
LOOP AT t_config INTO o_config.
WRITE: / 'in_out_folder:', o_config-common-in_out_folder.
WRITE: / 'error_log_folder:', o_config-common-error_log_folder.
WRITE: / 'hr_mm_data_folder:', o_config-common-hr_mm_data_folder.
ENDLOOP.
XSTL:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:template match="/configuration">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<OUT>
<xsl:variable name="comm" select="common" />
<common>
<in_out_folder><xsl:value-of select="$comm/in_out_path"/></in_out_folder>
<error_log_folder><xsl:value-of select="$comm/error_log_path" /></error_log_folder>
<hr_mm_data_folder><xsl:value-of select="$comm/hr_mm_data_path" /></hr_mm_data_folder>
</common>
</OUT>
</asx:values>
</asx:abap>
</xsl:template>
</xsl:transform>
Result on screen:
in_out_folder:
error_log_folder:
hr_mm_data_folder:
can you please help me urgently????? what is missing, no error is display but no data is there!!!! help pleaseeeee
Thanks in advance
‎2010 Apr 23 2:20 PM
Hi Samir
Have you written ( CALL TRANSFORMATION z_xml_to_abap ) z_xml_to_abap program which one you used in CALL TRANSFORMATION.Kindly check the same.
Thanks
Gowrishanakr
‎2010 Apr 23 2:34 PM
Hello Experts,
I need to read xml file through ABAP, I have done all steps but still the returned object is empty. here is what I did:
XML:
<?xml version="1.0" encoding="ISO-8859-1"?>
<configuration>
<common>
<in_out_path>C:/SAP/CC1/IN-OUT</in_out_path>
<error_log_path>C:/SAP/CC1/ERROR-LOG</error_log_path>
<hr_mm_data_path>C:/SAP/CC1/mmdata</hr_mm_data_path>
</common>
</configuration>
ABAP Object:
TYPES: BEGIN OF tp_common,
in_out_folder(50) TYPE c,
error_log_folder(50) TYPE c,
hr_mm_data_folder(50) TYPE c,
END OF tp_common.
TYPES: BEGIN OF tp_config,
common TYPE tp_common,
END OF tp_config.
DATA: t_config TYPE STANDARD TABLE OF tp_config,
o_config TYPE tp_config.
DATA: gt_result_xml TYPE abap_trans_resbind_tab,
gs_result_xml TYPE abap_trans_resbind.
ABAP call
GET REFERENCE OF t_config INTO gs_result_xml-value.
gs_result_xml-name = 'OUT'.
APPEND gs_result_xml TO gt_result_xml.
TRY.
CALL TRANSFORMATION z_xml_to_abap
SOURCE XML xml_content
RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
gs_var_text = gs_rif_ex->get_text( ).
WRITE:/ 'Transformation error: ', gs_var_text.
EXIT.
ENDTRY.
Print Data:
LOOP AT t_config INTO o_config.
WRITE: / 'in_out_folder:', o_config-common-in_out_folder.
WRITE: / 'error_log_folder:', o_config-common-error_log_folder.
WRITE: / 'hr_mm_data_folder:', o_config-common-hr_mm_data_folder.
ENDLOOP.
XSLT:
<x sl:template match="/configuration">
<a sx: abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<a sx:values>
<OUT>
<x sl:variable name="comm" select="common" />
<common>
<in_out_folder><xsl:value-of select="$comm/in_out_path"/></in_out_folder>
<error_log_folder><xsl:value-of select="$comm/error_log_path" /></error_log_folder>
<hr_mm_data_folder><xsl:value-of select="$comm/hr_mm_data_path" /></hr_mm_data_folder>
</common>
</OUT>
</a sx:values>
</a sx:abap>
</x sl:template>
</x sl:transform>
Result on screen:
in_out_folder:
error_log_folder:
hr_mm_data_folder:
can you please help me urgently????? what is missing, no error is display but no data is there!!!! help pleaseeeee
Thanks in advance
‎2010 Apr 23 2:37 PM
Sorry, when I pasted the xslt part, the whole paragraph was messed up, so I pasted again the 1st message and gave all details. Thanks
‎2010 Apr 26 9:12 AM
‎2010 Apr 27 2:51 PM
‎2012 Aug 15 4:39 PM
I am stuck at a similar issue. Could you kindly let me know how did you resolve the issue? Please provide source code if possible...
Regards
Balaji