<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: converting XML to ABAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254091#M1631395</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;"crashes" within the TRY-CATCH phrase?&lt;/P&gt;&lt;P&gt;Yes your expectation was correct..&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does the exception object text(method &lt;EM&gt;get_text&lt;/EM&gt; ) say? IMO you need not remove the TRY-CATCH block, rather check the corresponding exception obect generated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a suggestion try to use specific exception classes. In your code snippet you've used the generic "CX_ROOT", you must use CX_XSLT* exception classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 28 Sep 2011 09:54:52 GMT</pubDate>
    <dc:creator>SuhaSaha</dc:creator>
    <dc:date>2011-09-28T09:54:52Z</dc:date>
    <item>
      <title>converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254086#M1631390</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem while converting XML data into an abap internal table ......in fact its executing without any errors but i am not getting any data as output..  my code is as below....&lt;/P&gt;&lt;P&gt;can you suggest where do i go wrong...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;XML DATA:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;sldinfo supplier_name="ComputerSystem" supplier_version="1.0" model_version="1.3.21"&amp;gt;
  &amp;lt;group name="system1" group_type="SPECIFIC"&amp;gt;
    &amp;lt;class name="SAP_ComputerSystem"&amp;gt;
      &amp;lt;instance&amp;gt;
        &amp;lt;property name="Status"&amp;gt;
          &amp;lt;value&amp;gt;OK&amp;lt;/value&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property name="VirtualRAMInMB"&amp;gt;
          &amp;lt;value&amp;gt;173013&amp;lt;/value&amp;gt;
        &amp;lt;/property&amp;gt;
      &amp;lt;/instance&amp;gt;
    &amp;lt;/class&amp;gt;
  &amp;lt;/group&amp;gt;
&amp;lt;/sldinfo&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ABAP MAIN PROG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPE-POOLS abap.
CONSTANTS gs_file TYPE string VALUE 'C:	empsldinfo.xml'.
* This is the structure for the data from the XML file
TYPES: BEGIN OF ts_group,
         supplier_name(20)    TYPE c,
         supplier_version(4)  TYPE n,
         model_version(20)    TYPE n,
         name(10)             TYPE C,
         group_type(10)       TYPE C,
         name2(10)            TYPE C,
         name3(10)            TYPE C,
         value(30)            TYPE C,
       END OF ts_group.
DATA: gt_itab       TYPE STANDARD TABLE OF char2048.
* Table and work ares for the data from the XML file
DATA: gt_group     TYPE STANDARD TABLE OF ts_group,
      gs_group     TYPE ts_group.

DATA: gt_result_xml TYPE abap_trans_resbind_tab,
      gs_result_xml TYPE abap_trans_resbind.

DATA: gs_rif_ex     TYPE REF TO cx_root,
      gs_var_text   TYPE string.

CALL METHOD cl_gui_frontend_services=&amp;gt;gui_upload
  EXPORTING
    filename                = gs_file
  CHANGING
    data_tab                = gt_itab
****************************************************************
GET REFERENCE OF gt_group INTO gs_result_xml-value.
gs_result_xml-name = 'IGROUP'.
APPEND gs_result_xml TO gt_result_xml.

* Perform the XSLT stylesheet
TRY.
    CALL TRANSFORMATION z_xml_to_abap1
    SOURCE XML gt_itab
    RESULT (gt_result_xml).
CATCH cx_root INTO gs_rif_ex.
    gs_var_text = gs_rif_ex-&amp;gt;get_text( ).
    MESSAGE gs_var_text TYPE 'E'.
ENDTRY.

* Now let´s see what we got from the file
LOOP AT gt_group INTO gs_group.
  WRITE: / 'supplier_name:   ' , gs_group-supplier_name.
  WRITE: / 'supplier_version :', gs_group-supplier_version.
  WRITE: / 'model_version :',    gs_group-model_version.
  WRITE : / 'name :',            gs_group-name  .
  WRITE: / 'group_type :',       gs_group-group_type.
  WRITE: / 'name2 : ',           gs_group-name2.
  WRITE: / ' name3 :',           gs_group-name3.
  WRITE: / '  value :' ,         gs_group-value.
ENDLOOP. "gt_group.  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TRANSFORMATION&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&amp;gt;
  &amp;lt;xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"&amp;gt;&amp;lt;/xsl:output&amp;gt;
  &amp;lt;xsl:strip-space elements="*"&amp;gt;&amp;lt;/xsl:strip-space&amp;gt;

  &amp;lt;xsl:template match="/"&amp;gt;
    &amp;lt;asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"&amp;gt;
      &amp;lt;asx:values&amp;gt;
        &amp;lt;IGROUP&amp;gt;
          &amp;lt;xsl:apply-templates select="//GROUP"&amp;gt;&amp;lt;/xsl:apply-templates&amp;gt;
        &amp;lt;/IGROUP&amp;gt;
      &amp;lt;/asx:values&amp;gt;
    &amp;lt;/asx:abap&amp;gt;
  &amp;lt;/xsl:template&amp;gt;

  &amp;lt;xsl:template match="GROUP"&amp;gt;
    &amp;lt;item&amp;gt;
      &amp;lt;SUPPLIER_NAME&amp;gt;
        &amp;lt;xsl:value-of select="supplier_name"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/SUPPLIER_NAME&amp;gt;
      &amp;lt;SUPPLIER_VERSION&amp;gt;
        &amp;lt;xsl:value-of select="supplier_version"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/SUPPLIER_VERSION&amp;gt;
      &amp;lt;MODEL_VERSION&amp;gt;
        &amp;lt;xsl:value-of select="model_version"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/MODEL_VERSION&amp;gt;
      &amp;lt;NAME&amp;gt;
        &amp;lt;xsl:value-of select="name"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/NAME&amp;gt;
      &amp;lt;GROUP_TYPE&amp;gt;
        &amp;lt;xsl:value-of select="group_type"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/GROUP_TYPE&amp;gt;
      &amp;lt;NAME2&amp;gt;
        &amp;lt;xsl:value-of select="name2"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/NAME2&amp;gt;
      &amp;lt;NAME3&amp;gt;
        &amp;lt;xsl:value-of select="name3"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/NAME3&amp;gt;
      &amp;lt;VALUE&amp;gt;
        &amp;lt;xsl:value-of select="value"&amp;gt;&amp;lt;/xsl:value-of&amp;gt;
      &amp;lt;/VALUE&amp;gt;
    &amp;lt;/item&amp;gt;
  &amp;lt;/xsl:template&amp;gt;
&amp;lt;/xsl:transform&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Albert&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 07:06:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254086#M1631390</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T07:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254087#M1631391</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the below lin, it might be helpful.&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;EM&gt;&amp;lt;SAPTechnical Link removed&amp;gt;&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Sep 28, 2011 1:55 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 08:24:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254087#M1631391</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T08:24:44Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254088#M1631392</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well it can't throw any error since you catch errors into root error class &lt;SPAN __jive_emoticon_name="confused"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Have you traced, whether it actually "crashes" within the TRY-CATCH phrase?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, usually XML Files should be called in a transformation in type XSTRING, not some data table &lt;SPAN __jive_emoticon_name="confused"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you required to upload the XML per hand with GUI_UPLOAD or is this just for testing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, Lukas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 08:49:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254088#M1631392</guid>
      <dc:creator>Lukas_Weigelt</dc:creator>
      <dc:date>2011-09-28T08:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254089#M1631393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Lukas&lt;/P&gt;&lt;P&gt;thank you for your kind reply&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"crashes" within the TRY-CATCH phrase?&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes your expectation was correct..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Are you required to upload the XML per hand with GUI_UPLOAD&lt;/EM&gt;&lt;/P&gt;&lt;P&gt; it is to  Get the XML file from my client....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what would you suggest to rectify my question...........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Albert&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 09:16:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254089#M1631393</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T09:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254090#M1631394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suggest you take a look &lt;STRONG&gt;why&lt;/STRONG&gt; it crashes. If you can't determine while debugging, remove the try-catch phrase and let it dump so you can look in st22.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you explain what your application is supposed to do eventually in a use case? I could suggest other approaches rather than the one you took, but I wouldn't know if they would meet your requirements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what you posted so far, I guess some end user has got a transaction and is uploading XML Files manually so its data is stored somewhere in SAP or processed otherwise.... ? .. Please clarify what the business function, the actual cause of this application is, then I can help you better&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, Lukas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 09:38:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254090#M1631394</guid>
      <dc:creator>Lukas_Weigelt</dc:creator>
      <dc:date>2011-09-28T09:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254091#M1631395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;"crashes" within the TRY-CATCH phrase?&lt;/P&gt;&lt;P&gt;Yes your expectation was correct..&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does the exception object text(method &lt;EM&gt;get_text&lt;/EM&gt; ) say? IMO you need not remove the TRY-CATCH block, rather check the corresponding exception obect generated. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a suggestion try to use specific exception classes. In your code snippet you've used the generic "CX_ROOT", you must use CX_XSLT* exception classes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 09:54:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254091#M1631395</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-28T09:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254092#M1631396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to rule out any misunderstandings, I only meant to remove the TRY-CATCH phrase for a blink of an eye so you have a short dump and don't have to trace all the time. Of course you should keep this in your coding bottom line &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;))&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 10:18:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254092#M1631396</guid>
      <dc:creator>Lukas_Weigelt</dc:creator>
      <dc:date>2011-09-28T10:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254093#M1631397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Lukas&lt;/P&gt;&lt;P&gt;Thats fine.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am almost there ..........&lt;/P&gt;&lt;P&gt;let me admit myself... i am new to XML&lt;/P&gt;&lt;P&gt;if possible could you copy and paste the above code(to find out the error) and execute on the fly.....&lt;/P&gt;&lt;P&gt;hope it won't take much of your time....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;ALBERT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: albert_jack123 on Sep 28, 2011 3:02 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Sep 2011 12:01:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254093#M1631397</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-28T12:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: converting XML to ABAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254094#M1631398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hay, could you solve your problem and if yes could you please share the solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Vanessa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Oct 2011 14:20:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/converting-xml-to-abap/m-p/8254094#M1631398</guid>
      <dc:creator>former_member184588</dc:creator>
      <dc:date>2011-10-31T14:20:28Z</dc:date>
    </item>
  </channel>
</rss>

