<?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 Populating Dynamic Internal Table ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897360#M935425</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the fieldcatalog and from this I have creted a dynamic internal table like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Create Dynamic Table
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = lt_fcat[]
    IMPORTING
      ep_table        = dy_table.
  ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.

* Create Dynamic Work Area and Assign to FS
  CREATE DATA dy_line LIKE LINE OF &amp;lt;dyn_table&amp;gt;.
  ASSIGN dy_line-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have my data in one of the internal table (ITAB).&lt;/P&gt;&lt;P&gt;Now I want to populate the dynamic internal table &amp;lt;fs_tab&amp;gt; with that data in the other internal table (itab) .&lt;/P&gt;&lt;P&gt;For this I guess I need to use ASSIGN COMPONENT Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm not able to decide upon how to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg. :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Say my internal table &lt;STRONG&gt;(ITAB)&lt;/STRONG&gt; has 5 fields f1,f2,f3,f4,f5.&lt;/P&gt;&lt;P&gt;2. My Dynamic INternal table &lt;STRONG&gt;&amp;lt;fs_tab&amp;gt;&lt;/STRONG&gt; has 3 fields f1,f3,f5 (from the above code).&lt;/P&gt;&lt;P&gt;3. Now I want to populate this dynamic table with the data from the Internal table &lt;STRONG&gt;ITAB&lt;/STRONG&gt; for those particular  3 fields (f1,f3,f5).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to pass the data to the dyntab ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Request you all to clarify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PS: PLease don't send me any links as I already read them but cudn't get thru it!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 May 2008 14:20:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-29T14:20:13Z</dc:date>
    <item>
      <title>Populating Dynamic Internal Table ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897360#M935425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the fieldcatalog and from this I have creted a dynamic internal table like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
* Create Dynamic Table
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = lt_fcat[]
    IMPORTING
      ep_table        = dy_table.
  ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.

* Create Dynamic Work Area and Assign to FS
  CREATE DATA dy_line LIKE LINE OF &amp;lt;dyn_table&amp;gt;.
  ASSIGN dy_line-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have my data in one of the internal table (ITAB).&lt;/P&gt;&lt;P&gt;Now I want to populate the dynamic internal table &amp;lt;fs_tab&amp;gt; with that data in the other internal table (itab) .&lt;/P&gt;&lt;P&gt;For this I guess I need to use ASSIGN COMPONENT Statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm not able to decide upon how to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For eg. :-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Say my internal table &lt;STRONG&gt;(ITAB)&lt;/STRONG&gt; has 5 fields f1,f2,f3,f4,f5.&lt;/P&gt;&lt;P&gt;2. My Dynamic INternal table &lt;STRONG&gt;&amp;lt;fs_tab&amp;gt;&lt;/STRONG&gt; has 3 fields f1,f3,f5 (from the above code).&lt;/P&gt;&lt;P&gt;3. Now I want to populate this dynamic table with the data from the Internal table &lt;STRONG&gt;ITAB&lt;/STRONG&gt; for those particular  3 fields (f1,f3,f5).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to pass the data to the dyntab ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Request you all to clarify.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PS: PLease don't send me any links as I already read them but cudn't get thru it!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 14:20:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897360#M935425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T14:20:13Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Dynamic Internal Table ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897361#M935426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Simple way is to create a work area for the dynamic table and populate the work area using move-corresponding and append the dynamic internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  data: l_wa_ref type ref to data.
  field-symbols:
  &amp;lt;l_wa_f_data&amp;gt; type any.

  create data l_wa_ref like line of &amp;lt;f_data&amp;gt;.
*Assign the work area
  assign l_wa_ref-&amp;gt;* to &amp;lt;l_wa_f_data&amp;gt;.
  check sy-subrc = 0.

  loop at i_final2 into wa_final2.

    move-corresponding wa_final2 to &amp;lt;l_wa_f_data&amp;gt;.
* etc etc

  endloop.
 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 14:24:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897361#M935426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T14:24:54Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Dynamic Internal Table ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897362#M935427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Sourav,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did the same but it's going for a dump saying : &lt;/P&gt;&lt;P&gt;" Incorrect type of operand with the MOVE-CORRESPONDING statement." &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other clues ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 15:03:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897362#M935427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T15:03:26Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Dynamic Internal Table ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897363#M935428</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;PRE&gt;&lt;CODE&gt;* Create Dynamic Table
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = lt_fcat[]
    IMPORTING
      ep_table        = dy_table.
  ASSIGN dy_table-&amp;gt;* TO &amp;lt;dyn_table&amp;gt;.
 
* Create Dynamic Work Area and Assign to FS
  CREATE DATA dy_line LIKE LINE OF &amp;lt;dyn_table&amp;gt;.
  ASSIGN dy_line-&amp;gt;* TO &amp;lt;dyn_wa&amp;gt;.

DATA: FIELDNAME(3) TYPE C.

FIELD-SYMBOLS: &amp;lt;FS_FIELD_FROM&amp;gt;, 
                            &amp;lt;FS_FIELD_TO&amp;gt;.

LOOP AT ITAB.
    
   DO 3 TIMES.
     WHEN 1. FIELDNAME = 'F1'.
     WHEN 2. FIELDNAME = 'F3'.
     WHEN 3. FIELDNAME = 'F5'.
    ASSINGN COMPONENT FIELDNAME OF STRUCTURE ITAB TO &amp;lt;FS_FIELD_FROM&amp;gt;.
    ASSINGN COMPONENT FIELDNAME OF STRUCTURE &amp;lt;DYN_WA&amp;gt; TO &amp;lt;FS_FIELD_TO&amp;gt;.
    &amp;lt;FS_FIELD_TO&amp;gt; = &amp;lt;FS_FIELD_FROM&amp;gt;.
   ENDDO.
   APPEND  &amp;lt;DYN_WA&amp;gt; TO &amp;lt;dyn_table&amp;gt;.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 15:12:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897363#M935428</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T15:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: Populating Dynamic Internal Table ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897364#M935429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Max,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks for your Wonderful Reply !!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got it done now.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I've one more Problem.&lt;/P&gt;&lt;P&gt;I'll post it in another thread. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope u'll come to rescue !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 May 2008 16:25:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/populating-dynamic-internal-table/m-p/3897364#M935429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-29T16:25:11Z</dc:date>
    </item>
  </channel>
</rss>

