<?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 population in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595255#M865754</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;see this example.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
type-pools : abap.
  field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,
               &amp;lt;dyn_wa&amp;gt;,
               &amp;lt;dyn_field&amp;gt;.
  data: dy_table type ref to data,
      dy_line  type ref to data,
      xfc type lvc_s_fcat,
      ifc type lvc_t_fcat.
  selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
  start-of-selection.
    perform get_structure.
  perform create_dynamic_itab.
**********Creates a dyanamic internal table**********
  perform get_data.
  perform write_out.
  form get_structure.
  data : idetails type abap_compdescr_tab,
       xdetails type abap_compdescr.
  data : ref_table_des type ref to cl_abap_structdescr.
* Get the structure of the table.
  ref_table_des ?=
      cl_abap_typedescr=&amp;gt;describe_by_name( p_table ).
  idetails[] = ref_table_des-&amp;gt;components[].
    loop at idetails into xdetails.
    clear xfc.
    xfc-fieldname = xdetails-name .
    xfc-datatype = xdetails-type_kind.
    xfc-inttype = xdetails-type_kind.
    xfc-intlen = xdetails-length.
    xfc-decimals = xdetails-decimals.
    append xfc to ifc.
  endloop.
  endform.
  form create_dynamic_itab.
* Create dynamic internal table and assign to FS
  call method cl_alv_table_create=&amp;gt;create_dynamic_table
               exporting
                  it_fieldcatalog = ifc
               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;.
  endform.

  form get_data.
* Select Data from table.
  select * into table &amp;lt;dyn_table&amp;gt;
             from (p_table).
  endform.


*   Write out data from table.
FORM write_out.
  loop at &amp;lt;dyn_table&amp;gt; into &amp;lt;dyn_wa&amp;gt;.
    do.
      assign component  sy-index
         of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_field&amp;gt;.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
      if sy-index = 1.
        write:/ &amp;lt;dyn_field&amp;gt;.
      else.
        write: &amp;lt;dyn_field&amp;gt;.
      endif.
    enddo.
  endloop.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Mar 2008 09:11:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-17T09:11:52Z</dc:date>
    <item>
      <title>Dynamic Internal table population</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595254#M865753</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 let me know how to populate the dynamic internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          I have created a dynamic internal table, but I don't know how to populate as the column names are not known exactly as the table is dynamically created.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:10:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595254#M865753</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table population</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595255#M865754</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;see this example.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
type-pools : abap.
  field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,
               &amp;lt;dyn_wa&amp;gt;,
               &amp;lt;dyn_field&amp;gt;.
  data: dy_table type ref to data,
      dy_line  type ref to data,
      xfc type lvc_s_fcat,
      ifc type lvc_t_fcat.
  selection-screen begin of block b1 with frame.
parameters: p_table(30) type c default 'T001'.
selection-screen end of block b1.
  start-of-selection.
    perform get_structure.
  perform create_dynamic_itab.
**********Creates a dyanamic internal table**********
  perform get_data.
  perform write_out.
  form get_structure.
  data : idetails type abap_compdescr_tab,
       xdetails type abap_compdescr.
  data : ref_table_des type ref to cl_abap_structdescr.
* Get the structure of the table.
  ref_table_des ?=
      cl_abap_typedescr=&amp;gt;describe_by_name( p_table ).
  idetails[] = ref_table_des-&amp;gt;components[].
    loop at idetails into xdetails.
    clear xfc.
    xfc-fieldname = xdetails-name .
    xfc-datatype = xdetails-type_kind.
    xfc-inttype = xdetails-type_kind.
    xfc-intlen = xdetails-length.
    xfc-decimals = xdetails-decimals.
    append xfc to ifc.
  endloop.
  endform.
  form create_dynamic_itab.
* Create dynamic internal table and assign to FS
  call method cl_alv_table_create=&amp;gt;create_dynamic_table
               exporting
                  it_fieldcatalog = ifc
               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;.
  endform.

  form get_data.
* Select Data from table.
  select * into table &amp;lt;dyn_table&amp;gt;
             from (p_table).
  endform.


*   Write out data from table.
FORM write_out.
  loop at &amp;lt;dyn_table&amp;gt; into &amp;lt;dyn_wa&amp;gt;.
    do.
      assign component  sy-index
         of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_field&amp;gt;.
      if sy-subrc &amp;lt;&amp;gt; 0.
        exit.
      endif.
      if sy-index = 1.
        write:/ &amp;lt;dyn_field&amp;gt;.
      else.
        write: &amp;lt;dyn_field&amp;gt;.
      endif.
    enddo.
  endloop.
ENDFORM.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds,&lt;/P&gt;&lt;P&gt;bharat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:11:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595255#M865754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table population</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595256#M865755</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;Check this Example..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code&lt;/P&gt;&lt;P&gt;DATA: itab TYPE STANDARD TABLE OF mara.&lt;/P&gt;&lt;P&gt;DATA: wa TYPE mara.&lt;/P&gt;&lt;P&gt;DATA: where(72).&lt;/P&gt;&lt;P&gt;DATA: where1(72).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Populate. &lt;/P&gt;&lt;P&gt;wa-matnr = 'TEST'.&lt;/P&gt;&lt;P&gt;wa-mtart = 'M1'.&lt;/P&gt;&lt;P&gt;APPEND wa TO itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where clause &lt;/P&gt;&lt;P&gt;where = 'MATNR'.&lt;/P&gt;&lt;P&gt;where1 = 'MTART'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab INTO wa WITH KEY (WHERE) = 'TEST'&lt;/P&gt;&lt;P&gt;(WHERE1) = 'M1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;WRITE: / 'found'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reagrds,&lt;/P&gt;&lt;P&gt;venkat.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 09:17:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595256#M865755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T09:17:05Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table population</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595257#M865756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi bharat,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   In the given example, it is just shown how to create dynamic internal table .But how to populate that dynamic table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2008 10:09:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-population/m-p/3595257#M865756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-17T10:09:34Z</dc:date>
    </item>
  </channel>
</rss>

