every experts, I want to use Tcode: STRANS to translate XML to ABAP, But it does not work well,
here is XML code,I want to translate this XML into an an Inter table gt_orders with deep structure of oeb, and colum oeb is also and intertable,how can I do this.
<?xml version="1.0" encoding="gb2312" ?><axmt410><ObjectID>setSalesOrder</ObjectID><azp01>000000</azp01><oea00>1</oea00><ta_oeaecn>SO-140227-3041</ta_oeaecn><oea03>25325017</oea03><oea02>2014-02-27 17:44:44.0</oea02><ta_oea002>2763.0</ta_oea002><ta_oea001>0.0</ta_oea001><oea14></oea14><oea15>25325017</oea15><oea23>RMB</oea23><oeaconf>S3</oeaconf><oea10></oea10><oeaud01>null</oeaud01><ta_oea007></ta_oea007><oea25>101</oea25><ta_oea008>0</ta_oea008><ta_oea009>null</ta_oea009><oeauser>Hanjingya</oeauser><ta_oeanday>2014-02-27 17:44:44.991</ta_oeanday><ta_oeamday>2014-02-28 08:30:14.866</ta_oeamday><ta_oeacday>2014-02-28 08:30:14.866</ta_oeacday><oeaud02>0</oeaud02><ta_oea030>null</ta_oea030><oeb><oeb03>1</oeb03><oeb04>7400208249</oeb04><oeb05>PCS</oeb05><oeb17>921.0</oeb17><oeb13>921.0</oeb13><oeb15></oeb15><oeb12>5</oeb12><oeb09>990001</oeb09><ta_oeb001></ta_oeb001><ta_oeb002>Yunnan</ta_oeb002><ta_oeb003>address1</ta_oeb003><ta_oeb004>zhangdagui、zhanglan</ta_oeb004><ta_oeb005>15974749998、15987782008</ta_oeb005><ta_oeb006>address and street</ta_oeb006><oebud01></oebud01></oeb><oeb><oeb03>2</oeb03><oeb04>7400208250</oeb04><oeb05>PCS</oeb05><oeb17>921.0</oeb17><oeb13>921.0</oeb13><oeb15></oeb15><oeb12>5</oeb12><oeb09>990001</oeb09><ta_oeb001></ta_oeb001><ta_oeb002>Yunnan</ta_oeb002><ta_oeb003>address2</ta_oeb003><ta_oeb004>zhangdagui、chenlan</ta_oeb004><ta_oeb005>15974749998、15987782008</ta_oeb005><ta_oeb006>address and street</ta_oeb006><oebud01></oebud01></oeb></axmt410>
I write these codes in SAP XSLT editor
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/> <xsl:strip-space elements="*"/> <xsl:strip-space elements="*"/> <xsl:template match="/"> <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> <asx:values> <ORDERS> <xsl:apply-templates select="//axmt410"/> </ORDERS> </asx:values> </asx:abap> </xsl:template> <xsl:template match="axmt410"> <OBJECTID> <xsl:value-of select="ObjectID"/> </OBJECTID> <AZP01> <xsl:value-of select="azp01"/> </AZP01> <OEA00> <xsl:value-of select="oea00"/> </OEA00> <TA_OEAECN> <xsl:value-of select="ta_oeaecn"/> </TA_OEAECN> <OEA03> <xsl:value-of select="oea03"/> </OEA03> <OEA05> <xsl:value-of select="oea05"/> </OEA05> <OEA02> <xsl:value-of select="oea02"/> </OEA02> <TA_OEA002> <xsl:value-of select="ta_oea002"/> </TA_OEA002> <TA_OEA001> <xsl:value-of select="ta_oea001"/> </TA_OEA001> <OEA14> <xsl:value-of select="ora14"/> </OEA14> <OEA15> <xsl:value-of select="ora15"/> </OEA15> <OEA23> <xsl:value-of select="ora23"/> </OEA23> <OEACONF> <xsl:value-of select="oeaconf"/> </OEACONF> <OEA10> <xsl:value-of select="ora10"/> </OEA10> <OEAUD01> <xsl:value-of select="oeaud01"/> </OEAUD01> <TA_OEA007> <xsl:value-of select="ta_oea007"/> </TA_OEA007> <OEA25> <xsl:value-of select="ora25"/> </OEA25> <TA_OEA008> <xsl:value-of select="ta_oea008"/> </TA_OEA008> <TA_OEA009> <xsl:value-of select="ta_oea009"/> </TA_OEA009> <TA_OEA013> <xsl:value-of select="ta_oea013"/> </TA_OEA013> <TA_OEA014> <xsl:value-of select="ta_oea014"/> </TA_OEA014> <TA_OEA015> <xsl:value-of select="ta_oea015"/> </TA_OEA015> <TA_OEA016> <xsl:value-of select="ta_oea016"/> </TA_OEA016> <TA_OEA017> <xsl:value-of select="ta_oea017"/> </TA_OEA017> <TA_OEA018> <xsl:value-of select="ta_oea018"/> </TA_OEA018> <TA_OEA019> <xsl:value-of select="ta_oea019"/> </TA_OEA019> <TA_OEA020> <xsl:value-of select="ta_oea020"/> </TA_OEA020> <TA_OEA021> <xsl:value-of select="ta_oea021"/> </TA_OEA021> <TA_OEA022> <xsl:value-of select="ta_oea022"/> </TA_OEA022> <TA_OEA028> <xsl:value-of select="ta_oea028"/> </TA_OEA028> <OEAUSER> <xsl:value-of select="oeauser"/> </OEAUSER> <TA_OEANDAY> <xsl:value-of select="ta_oeanday"/> </TA_OEANDAY> <TA_OEAMDAY> <xsl:value-of select="ta_oeamday"/> </TA_OEAMDAY> <TA_OEACDAY> <xsl:value-of select="ta_oeacday"/> </TA_OEACDAY> <OEAUD02> <xsl:value-of select="oeaud02"/> </OEAUD02> <TA_OEA030> <xsl:value-of select="ta_oea030"/> </TA_OEA030> <OEB> <xsl:for-each select="oeb"> <OEB03> <xsl:value-of select="oeb03"/> </OEB03> <OEB04> <xsl:value-of select="oeb04"/> </OEB04> <OEB05> <xsl:value-of select="oeb05"/> </OEB05> <OEB17> <xsl:value-of select="oeb17"/> </OEB17> <OEB13> <xsl:value-of select="oeb13"/> </OEB13> <OEB15> <xsl:value-of select="oeb15"/> </OEB15> <OEB12> <xsl:value-of select="oeb12"/> </OEB12> <OEB09> <xsl:value-of select="oeb09"/> </OEB09> <TA_OEB001> <xsl:value-of select="ta_oeb001"/> </TA_OEB001> <TA_OEB002> <xsl:value-of select="ta_oeb002"/> </TA_OEB002> <TA_OEB003> <xsl:value-of select="ta_oeb003"/> </TA_OEB003> <TA_OEB004> <xsl:value-of select="ta_oeb004"/> </TA_OEB004> <TA_OEB005> <xsl:value-of select="ta_oeb005"/> </TA_OEB005> <TA_OEB006> <xsl:value-of select="ta_oeb006"/> </TA_OEB006> <OEBUD01> <xsl:value-of select="oebud01"/> </OEBUD01> </xsl:for-each> </OEB> </xsl:template></xsl:transform>
and I use below ABAP program for a test, but the items from XML can not translate into Interner table gt_orders-oeb[]
TYPE-POOLS abap. CONSTANTS gs_file TYPE string VALUE 'C:\temp\order02.xml'. * This is the structure for the data from the XML file TYPES: BEGIN OF typ_s_oeb, oeb03 TYPE string, " oeb04 TYPE string, " oeb05 TYPE string, " oeb17 TYPE string, " oeb13 TYPE string, oeb15 TYPE string, oeb12 TYPE string, " oeb09 TYPE string, " ta_oeb001 TYPE string, " ta_oeb002 TYPE string, " ta_oeb003 TYPE string, " ta_oeb004 TYPE string, " ta_oeb005 TYPE string, " ta_oeb006 TYPE string, " ta_oeb013 TYPE string, " ta_oeb014 TYPE string, " ta_oeb015 TYPE string, " ta_oeb016 TYPE string, " ta_oeb017 TYPE string, " ta_oeb018 TYPE string, " ta_oeb019 TYPE string, " ta_oeb020 TYPE string, " ta_oeb021 TYPE string, " ta_oeb022 TYPE string, " oebud01 TYPE string, " END OF typ_s_oeb. TYPES: typ_t_oeb TYPE TABLE OF typ_s_oeb WITH KEY oeb03. TYPES: BEGIN OF typ_s_order, objectid TYPE string, " azp01 TYPE string, " oea00 TYPE string, " ta_oeaecn TYPE string, " oea03 TYPE string, " oea02 TYPE string, " ta_oea002 TYPE string, " ta_oea001 TYPE string, " oea14 TYPE string, " oea15 TYPE string, oea23 TYPE string, " oeaconf TYPE string, " oea10 TYPE string, " oeaud01 TYPE string, " ta_oea007 TYPE string, " oea25 TYPE string, " ta_oea008 TYPE string, " ta_oea009 TYPE string, " oeauser TYPE string, " ta_oeanday TYPE string, " ta_oeamday TYPE string, " ta_oeacday TYPE string, " oeaud02 TYPE string, " ta_oea030 TYPE string, " ta_oea013 TYPE string, ta_oea014 TYPE string, ta_oea015 TYPE string, ta_oea016 TYPE string, ta_oea017 TYPE string, ta_oea018 TYPE string, ta_oea019 TYPE string, ta_oea020 TYPE string, ta_oea021 TYPE string, ta_oea022 TYPE string, ta_oea025 TYPE string, oeb TYPE typ_t_oeb, END OF typ_s_order. * Table for the XML content DATA: gt_itab TYPE STANDARD TABLE OF char2048, gs_itab LIKE LINE OF gt_itab. * Table and work ares for the data from the XML file DATA: gt_orders TYPE STANDARD TABLE OF typ_s_order, gs_orders TYPE typ_s_order. * Result table that contains references * of the internal tables to be filled DATA: gt_result_xml TYPE abap_trans_resbind_tab, gs_result_xml TYPE abap_trans_resbind. * For error handling DATA: gs_rif_ex TYPE REF TO cx_root, gs_var_text TYPE string. * Get the XML file from your client CALL METHOD cl_gui_frontend_services=>gui_upload EXPORTING filename = gs_file CHANGING data_tab = gt_itab EXCEPTIONS file_open_error = 1 file_read_error = 2 no_batch = 3 gui_refuse_filetransfer = 4 invalid_type = 5 no_authority = 6 unknown_error = 7 bad_data_format = 8 header_not_allowed = 9 separator_not_allowed = 10 header_too_long = 11 unknown_dp_error = 12 access_denied = 13 dp_out_of_memory = 14 disk_full = 15 dp_timeout = 16 not_supported_by_gui = 17 error_no_gui = 18 OTHERS = 19. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. * Fill the result table with a reference to the data table. * Within the XSLT stylesheet, the data table can be accessed with * "IPERSON". GET REFERENCE OF gt_orders INTO gs_result_xml-value. gs_result_xml-name = 'ORDERS'. APPEND gs_result_xml TO gt_result_xml. * Perform the XSLT styleshee TRY. CALL TRANSFORMATION zfx_so_xml_to_abap SOURCE XML gt_itab RESULT (gt_result_xml). CATCH cx_root INTO gs_rif_ex. gs_var_text = gs_rif_ex->get_text( ). MESSAGE gs_var_text TYPE 'S'. ENDTRY. LOOP AT gt_orders INTO gs_orders. ENDLOOP.