<?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 HELP! Dynamic Tables.. Loop and Header issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637399#M1442867</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I have this code for dynamic table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------" /&gt;&lt;P&gt;types: begin of y_tablenames,&lt;/P&gt;&lt;P&gt;               tabnames(10) type c,&lt;/P&gt;&lt;P&gt;           end   of  y_tabnames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: i_tablenames TYPE STANDARD TABLE OF y_tablenames,&lt;/P&gt;&lt;P&gt;         w_tabname type i_tablenames-tabnames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;fs_tabnames&amp;gt; type y_tablenames,&lt;/P&gt;&lt;P&gt;                       &amp;lt;fs_stag_tab&amp;gt;  type standard table,&lt;/P&gt;&lt;P&gt;                       &amp;lt;fs_stag_header&amp;gt;  type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select tablename&lt;/P&gt;&lt;P&gt;from  tables&lt;/P&gt;&lt;P&gt;into i_tablenames.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_tablenames ASSIGNING &amp;lt;fs_tabnames&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  move:  &amp;lt;fs_tabnames&amp;gt;-tabnames TO w_tabname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA w_stag_ref TYPE STANDARD TABLE OF (w_tabname).&lt;/P&gt;&lt;P&gt;  ASSIGN w_stag_ref-&amp;gt;* TO &amp;lt;fs_stag_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;  CREATE DATA w_sref LIKE LINE OF &amp;lt;fs_stag_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;  ASSIGN w_sref-&amp;gt;* TO &amp;lt;fs_stag_header&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT  &amp;lt;fs_stag_tab&amp;gt; ASSIGNING &amp;lt;fs_stag_header&amp;gt;.&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;write: / &amp;lt;fs_stag_header&amp;gt;-tabnames.&lt;/STRONG&gt;                            " SYNTAX ERROR OCCURS HERE&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is  &lt;STRONG&gt;The data object &amp;lt;fs_stag_header&amp;gt; has no structure and therefore nocomponent called "tabnames"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if I run the code and check the values of the &amp;lt;fs_stag_tab&amp;gt; and &amp;lt;fs_stag_tab&amp;gt; at runtime, I get the data I need.&lt;/P&gt;&lt;P&gt;I really need to LOOP the table and get the fields because I need to do a SELECT statement using the values of the fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 06 Feb 2010 10:15:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-06T10:15:50Z</dc:date>
    <item>
      <title>HELP! Dynamic Tables.. Loop and Header issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637399#M1442867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I have this code for dynamic table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------------" /&gt;&lt;P&gt;types: begin of y_tablenames,&lt;/P&gt;&lt;P&gt;               tabnames(10) type c,&lt;/P&gt;&lt;P&gt;           end   of  y_tabnames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: i_tablenames TYPE STANDARD TABLE OF y_tablenames,&lt;/P&gt;&lt;P&gt;         w_tabname type i_tablenames-tabnames.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;fs_tabnames&amp;gt; type y_tablenames,&lt;/P&gt;&lt;P&gt;                       &amp;lt;fs_stag_tab&amp;gt;  type standard table,&lt;/P&gt;&lt;P&gt;                       &amp;lt;fs_stag_header&amp;gt;  type any.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select tablename&lt;/P&gt;&lt;P&gt;from  tables&lt;/P&gt;&lt;P&gt;into i_tablenames.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_tablenames ASSIGNING &amp;lt;fs_tabnames&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  move:  &amp;lt;fs_tabnames&amp;gt;-tabnames TO w_tabname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA w_stag_ref TYPE STANDARD TABLE OF (w_tabname).&lt;/P&gt;&lt;P&gt;  ASSIGN w_stag_ref-&amp;gt;* TO &amp;lt;fs_stag_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;  CREATE DATA w_sref LIKE LINE OF &amp;lt;fs_stag_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;  ASSIGN w_sref-&amp;gt;* TO &amp;lt;fs_stag_header&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT  &amp;lt;fs_stag_tab&amp;gt; ASSIGNING &amp;lt;fs_stag_header&amp;gt;.&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;write: / &amp;lt;fs_stag_header&amp;gt;-tabnames.&lt;/STRONG&gt;                            " SYNTAX ERROR OCCURS HERE&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error is  &lt;STRONG&gt;The data object &amp;lt;fs_stag_header&amp;gt; has no structure and therefore nocomponent called "tabnames"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if I run the code and check the values of the &amp;lt;fs_stag_tab&amp;gt; and &amp;lt;fs_stag_tab&amp;gt; at runtime, I get the data I need.&lt;/P&gt;&lt;P&gt;I really need to LOOP the table and get the fields because I need to do a SELECT statement using the values of the fields. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help me!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 10:15:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637399#M1442867</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-06T10:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! Dynamic Tables.. Loop and Header issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637400#M1442868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Read F1 help on ASSIGN COMPONENT&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also notice that at no point does &amp;lt;fs_stag_tab&amp;gt; have any values. also, with LOOP AT ... ASSIGNING &amp;lt;fs_stag_header&amp;gt;, you don't need the earlier assign for &amp;lt;fs_stag_header&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 11:28:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637400#M1442868</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2010-02-06T11:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! Dynamic Tables.. Loop and Header issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637401#M1442869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have lots of tables and  the fields are also dynamic so I can't use ASSIGN COMPONENT. I need to access the fields separately.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 11:33:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637401#M1442869</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-06T11:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! Dynamic Tables.. Loop and Header issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637402#M1442870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Frn ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read the below link it will help you ...&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;becaue filed symbol take memory at run time ...so you can not acess field symbols statically .&lt;/P&gt;&lt;P&gt;for your requirment you should code like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;FIELD-SYMBOLS: &amp;lt;f1&amp;gt; type any.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT i_tablenames ASSIGNING &amp;lt;fs_tabnames&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;move: &amp;lt;fs_tabnames&amp;gt;-tabnames TO w_tabname&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA w_stag_ref TYPE STANDARD TABLE OF (w_tabname).&lt;/P&gt;&lt;P&gt;ASSIGN w_stag_ref-&amp;gt;* TO &amp;lt;fs_stag_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;CREATE DATA w_sref LIKE LINE OF &amp;lt;fs_stag_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN w_sref-&amp;gt;* TO &amp;lt;fs_stag_header&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;fs_stag_tab&amp;gt; ASSIGNING &amp;lt;fs_stag_header&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO N TIMES.        " N is the no of coloum in you internal table structure&lt;/P&gt;&lt;P&gt;  ASSIGN COMPONENT SY-INDEX OF STRUCTURE &amp;lt;fs_stag_header&amp;gt; to &amp;lt;f1&amp;gt;.&lt;/P&gt;&lt;P&gt;  WRITE &amp;lt;f1&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;Thanks and Regards..&lt;/P&gt;&lt;P&gt; Priyank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 12:04:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637402#M1442870</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-06T12:04:16Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! Dynamic Tables.. Loop and Header issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637403#M1442871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh i see that the link above has the same problem as mine. I guess I have to find another way of extracting the fields for the dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the replies.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 12:23:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637403#M1442871</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-06T12:23:47Z</dc:date>
    </item>
    <item>
      <title>Re: HELP! Dynamic Tables.. Loop and Header issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637404#M1442872</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;you can extract the fields of &lt;STRONG&gt;any&lt;/STRONG&gt; structure or internal table using this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA:
    lt_comp                               TYPE abap_compdescr_tab,
    lr_dat                                TYPE REF TO data,
    lr_typedescr                          TYPE REF TO cl_abap_typedescr,
    lr_structdescr                        TYPE REF TO cl_abap_structdescr.
  FIELD-SYMBOLS:
    &amp;lt;fs&amp;gt;                                  TYPE ANY,
    &amp;lt;ft&amp;gt;                                  TYPE ANY TABLE,
    &amp;lt;comp&amp;gt;                                TYPE LINE OF abap_compdescr_tab.
  lr_typedescr                            = cl_abap_typedescr=&amp;gt;describe_by_data( px_data ).
  CASE lr_typedescr-&amp;gt;kind.
    WHEN 'S'.
      lr_structdescr ?= lr_typedescr.
      lt_comp                             = lr_structdescr-&amp;gt;components.
    WHEN 'T'.
      ASSIGN px_data TO &amp;lt;ft&amp;gt;.
      CREATE DATA lr_dat                  LIKE LINE OF &amp;lt;ft&amp;gt;.
      ASSIGN lr_dat-&amp;gt;* TO &amp;lt;fs&amp;gt;.
      lr_structdescr ?= cl_abap_structdescr=&amp;gt;describe_by_data( &amp;lt;fs&amp;gt; ).
      lt_comp                             = lr_structdescr-&amp;gt;components.
    WHEN OTHERS.
      MESSAGE e241(00).
*   Function is invalid                   in this environment
  ENDCASE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;px_data is a parameter where you pass your header line or internal table. Internal table lt_comp has the components with &amp;lt;comp&amp;gt;-name as the fieldname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Feb 2010 16:36:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-dynamic-tables-loop-and-header-issue/m-p/6637404#M1442872</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-02-06T16:36:03Z</dc:date>
    </item>
  </channel>
</rss>

