<?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: Dynamic Internal Table Columns in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238519#M1210589</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to assign that field to another Field-symbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT &amp;lt;fs_it&amp;gt; INTO &amp;lt;fs_wa&amp;gt;.
    ASSIGN COMPONENT: fieldname OF STRUCTURE &amp;lt;fs_wa&amp;gt;  TO &amp;lt;fs_field&amp;gt;.
    WRITE : / &amp;lt;fs_field&amp;gt;.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Feb 2009 20:44:17 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2009-02-12T20:44:17Z</dc:date>
    <item>
      <title>Dynamic Internal Table Columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238518#M1210588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: it_dy       TYPE REF TO data,
      wa_dy       TYPE REF TO data,
      i_fieldlist LIKE  lvc_t_fcat.

FIELD-SYMBOLS: &amp;lt;fs_it&amp;gt; TYPE table.
FIELD-SYMBOLS: &amp;lt;fs_wa&amp;gt; TYPE ANY.

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = i_fieldlist
    IMPORTING
      ep_table                  = it_dy
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.
  IF sy-subrc  0.
    STOP.
  ENDIF.

ASSIGN it_dy-&amp;gt;* TO &amp;lt;fs_it&amp;gt;.

CREATE DATA wa_dy LIKE LINE OF &amp;lt;fs_it&amp;gt;.
ASSIGN wa_dy-&amp;gt;* TO &amp;lt;fs_wa&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets suppose that i_fieldlist is correctly filled.&lt;/P&gt;&lt;P&gt;I want to access a certain column of my dynamic internal table (&amp;lt;fs_it&amp;gt;).&lt;/P&gt;&lt;P&gt;I can get the fieldname from the table i_fieldlist, and put it in a auxiliar variable (fieldname) and i wanna do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT &amp;lt;fs_it&amp;gt; INTO &amp;lt;fs_wa&amp;gt;.
	WRITE : / &amp;lt;fs_it&amp;gt;-(fieldname). "ERROR
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in this way its not possible. How can I do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pedro Bessa.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2009 20:40:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238518#M1210588</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-12T20:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Table Columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238519#M1210589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to assign that field to another Field-symbol.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT &amp;lt;fs_it&amp;gt; INTO &amp;lt;fs_wa&amp;gt;.
    ASSIGN COMPONENT: fieldname OF STRUCTURE &amp;lt;fs_wa&amp;gt;  TO &amp;lt;fs_field&amp;gt;.
    WRITE : / &amp;lt;fs_field&amp;gt;.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2009 20:44:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238519#M1210589</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2009-02-12T20:44:17Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Table Columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238520#M1210590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You will have to use assign component statement here, because with field symbols, the fields are not deteremined until runtime and therefore you are getting that error.. Change your code as follows :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
field-symbols :&amp;lt;fs_field&amp;gt; type any.

LOOP AT &amp;lt;fs_it&amp;gt; INTO &amp;lt;fs_wa&amp;gt;.
	assign component (fieldname) of structure &amp;lt;fs_wa&amp;gt; to &amp;lt;fs_field&amp;gt;.
        if &amp;lt;fs_field&amp;gt; is assigned.
        WRITE : / &amp;lt;fs_field&amp;gt;.
        endif. 
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best way would be to use an inner loop at the i_fieldlist and use the field name from that table instead of hard coding the field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT &amp;lt;fs_it&amp;gt; INTO &amp;lt;fs_wa&amp;gt;.
        loop at it_fieldlist.
	 assign component it_fieldlist-fieldname of structure &amp;lt;fs_wa&amp;gt; to &amp;lt;fs_field&amp;gt;.
         if &amp;lt;fs_field&amp;gt; is assigned.
         WRITE : &amp;lt;fs_field&amp;gt;.
        endif. 
        endloop.
        skip 1.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Advait Gode on Feb 12, 2009 9:47 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2009 20:46:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238520#M1210590</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-12T20:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal Table Columns</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238521#M1210591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Naimesh.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can only test tomorrow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll give news.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pedro Bessa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Feb 2009 21:08:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-columns/m-p/5238521#M1210591</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-12T21:08:49Z</dc:date>
    </item>
  </channel>
</rss>

