<?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 Dynamic Type creation: structure in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142625#M746996</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made a dynamic table and now I want to loop this table.&lt;/P&gt;&lt;P&gt;But I can't seem to make a structure to use in the loop.&lt;/P&gt;&lt;P&gt;I get the error 'data object has no structure'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I already have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: linetype   type ref to cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;        tabletype  type ref to cl_abap_tabledescr,&lt;/P&gt;&lt;P&gt;        lt_comp    type cl_abap_structdescr=&amp;gt;component_table,&lt;/P&gt;&lt;P&gt;        lr_table type ref to data,&lt;/P&gt;&lt;P&gt;        lr_line type ref to data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;lt_data&amp;gt; type table,&lt;/P&gt;&lt;P&gt;                     &amp;lt;ls_data&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...first I fill lt_comp ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;linetype = cl_abap_structdescr=&amp;gt;create( lt_comp ).&lt;/P&gt;&lt;P&gt;tabletype = cl_abap_tabledescr=&amp;gt;create( p_line_type = linetype p_table_kind = 'S' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data lr_table type handle tabletype.&lt;/P&gt;&lt;P&gt;assign lr_table-&amp;gt;* to &amp;lt;lt_data&amp;gt; casting type handle tabletype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data lr_line like line of &amp;lt;lt_data&amp;gt;.&lt;/P&gt;&lt;P&gt;assign lr_line-&amp;gt;* to &amp;lt;ls_data&amp;gt; casting type handle linetype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... filling the table &amp;lt;lt_data&amp;gt; ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at lt_data assigning &amp;lt;ls_data&amp;gt;.&lt;/P&gt;&lt;P&gt;  ... when I try to access a field of &amp;lt;ls_data&amp;gt;, I get the error '&amp;lt;ls_data&amp;gt; is no structure'.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Dec 2007 11:12:13 GMT</pubDate>
    <dc:creator>steven_dierick</dc:creator>
    <dc:date>2007-12-06T11:12:13Z</dc:date>
    <item>
      <title>Dynamic Type creation: structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142625#M746996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I made a dynamic table and now I want to loop this table.&lt;/P&gt;&lt;P&gt;But I can't seem to make a structure to use in the loop.&lt;/P&gt;&lt;P&gt;I get the error 'data object has no structure'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what I already have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: linetype   type ref to cl_abap_structdescr,&lt;/P&gt;&lt;P&gt;        tabletype  type ref to cl_abap_tabledescr,&lt;/P&gt;&lt;P&gt;        lt_comp    type cl_abap_structdescr=&amp;gt;component_table,&lt;/P&gt;&lt;P&gt;        lr_table type ref to data,&lt;/P&gt;&lt;P&gt;        lr_line type ref to data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;lt_data&amp;gt; type table,&lt;/P&gt;&lt;P&gt;                     &amp;lt;ls_data&amp;gt; type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...first I fill lt_comp ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;linetype = cl_abap_structdescr=&amp;gt;create( lt_comp ).&lt;/P&gt;&lt;P&gt;tabletype = cl_abap_tabledescr=&amp;gt;create( p_line_type = linetype p_table_kind = 'S' ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data lr_table type handle tabletype.&lt;/P&gt;&lt;P&gt;assign lr_table-&amp;gt;* to &amp;lt;lt_data&amp;gt; casting type handle tabletype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data lr_line like line of &amp;lt;lt_data&amp;gt;.&lt;/P&gt;&lt;P&gt;assign lr_line-&amp;gt;* to &amp;lt;ls_data&amp;gt; casting type handle linetype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... filling the table &amp;lt;lt_data&amp;gt; ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at lt_data assigning &amp;lt;ls_data&amp;gt;.&lt;/P&gt;&lt;P&gt;  ... when I try to access a field of &amp;lt;ls_data&amp;gt;, I get the error '&amp;lt;ls_data&amp;gt; is no structure'.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2007 11:12:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142625#M746996</guid>
      <dc:creator>steven_dierick</dc:creator>
      <dc:date>2007-12-06T11:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Type creation: structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142626#M746997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Steven&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are going for dynamic programming then you have to use "the full monty" meaning field-symbols for:&lt;/P&gt;&lt;P&gt;- itab &lt;/P&gt;&lt;P&gt;- structure    AND&lt;/P&gt;&lt;P&gt;- fields&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FIELD-SYMBOLS:
  &amp;lt;ld_fld&amp;gt;    TYPE any.

  LOOP AT &amp;lt;lt_data&amp;gt; ASSIGNING &amp;lt;ls_data&amp;gt;.
    UNASSIGN &amp;lt;ld_fld&amp;gt;.

    ASSIGN COMPONENT '&amp;lt;name of field  OR sy-index&amp;gt;' OF STRUCTURE &amp;lt;ls_data&amp;gt;
                                                                                TO &amp;lt;ld_fld&amp;gt;.
   IF ( &amp;lt;ld_fld&amp;gt; IS ASSIGNED ).
"   do something...
   ENDIF.
  ENDLOOP.
...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;    Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Dec 2007 19:53:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142626#M746997</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-12-06T19:53:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Type creation: structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142627#M746998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Uwe,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answer. This works for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Steven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Dec 2007 09:08:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-type-creation-structure/m-p/3142627#M746998</guid>
      <dc:creator>steven_dierick</dc:creator>
      <dc:date>2007-12-07T09:08:55Z</dc:date>
    </item>
  </channel>
</rss>

