<?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 Based on records in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914481#M938372</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 use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Class Method:&lt;/P&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Look at CLASS CL_ABAP_TABLEDESCR (If you have SAP version higher then 4.7 ) in this class you can crate internal table dynamically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Jun 2008 12:17:58 GMT</pubDate>
    <dc:creator>pavel_parshenkov2</dc:creator>
    <dc:date>2008-06-03T12:17:58Z</dc:date>
    <item>
      <title>Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914480#M938371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,I need to create an internal table depending on no.of records I found in a standard table.In my dynamic internal table I have first 4 columns fixed and next columns should be genreted dynamically at run time.I searched the forum,every example I found was with using classes,as I dont have any Idea of classes I couldnot understand those programs.PLZ If anyone can provide an example exactly on my requirement without any classes used or with CLEAR explanation.Thanks in advance.&lt;/P&gt;&lt;P&gt;Points will be rewarded for every helpful answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 12:14:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914480#M938371</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T12:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914481#M938372</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 use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Class Method:&lt;/P&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Look at CLASS CL_ABAP_TABLEDESCR (If you have SAP version higher then 4.7 ) in this class you can crate internal table dynamically. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 12:17:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914481#M938372</guid>
      <dc:creator>pavel_parshenkov2</dc:creator>
      <dc:date>2008-06-03T12:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914482#M938373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,thanks for u r feedback,but as I said I dont have any Idea of using classes,I need an example without classes and give me example similar to my requirement like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fixed1  Fixed2  Fixed3  Fixed4  Dynamic1 Dynamic2..........&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 12:23:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914482#M938373</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T12:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914483#M938374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this example: This is the smallest program to create dynamic internal table. You have no way to escape from learning Class concepts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: struct_type TYPE REF TO cl_abap_structdescr, &lt;/P&gt;&lt;P&gt;      comp_tab    TYPE cl_abap_structdescr=&amp;gt;component_table, &lt;/P&gt;&lt;P&gt;      comp        LIKE LINE OF comp_tab, &lt;/P&gt;&lt;P&gt;      dref        TYPE REF TO data. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;struc&amp;gt; TYPE ANY, &lt;/P&gt;&lt;P&gt;               &amp;lt;comp&amp;gt;  TYPE ANY. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;comp-name = 'column1'. &lt;/P&gt;&lt;P&gt;comp-type = cl_abap_elemdescr=&amp;gt;get_c( 40 ). &lt;/P&gt;&lt;P&gt;APPEND comp TO comp_tab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;comp-name = 'column2'. &lt;/P&gt;&lt;P&gt;comp-type = cl_abap_elemdescr=&amp;gt;get_i( ). &lt;/P&gt;&lt;P&gt;APPEND comp TO comp_tab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;struct_type = cl_abap_structdescr=&amp;gt;create( comp_tab ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA dref TYPE HANDLE struct_type. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN dref-&amp;gt;* TO &amp;lt;struc&amp;gt;. &lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'COLUMN1' OF STRUCTURE &amp;lt;struc&amp;gt; TO &amp;lt;comp&amp;gt;. &lt;/P&gt;&lt;P&gt;&amp;lt;comp&amp;gt; = 'Amount'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN dref-&amp;gt;* TO &amp;lt;struc&amp;gt;. &lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT 'COLUMN2' OF STRUCTURE &amp;lt;struc&amp;gt; TO &amp;lt;comp&amp;gt;. &lt;/P&gt;&lt;P&gt;&amp;lt;comp&amp;gt; = 11.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 12:25:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914483#M938374</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T12:25:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914484#M938375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use Function Module:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; call function 'LVC_TABLE_CREATE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fill  it_fieldcatalog like for usual ALV report. and all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 12:27:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914484#M938375</guid>
      <dc:creator>pavel_parshenkov2</dc:creator>
      <dc:date>2008-06-03T12:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914485#M938376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On what basis the example program is creating Dynamic IT? or if u can create one program as my requirement is,I will change it as I want.Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Jun 2008 12:32:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914485#M938376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-03T12:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Internal table Based on records</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914486#M938377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have just made a program like you're requirements&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: ta_output TYPE REF TO data.
DATA: new_table TYPE REF TO data,
      new_line  TYPE REF TO data,
      is_lvc_cat TYPE lvc_s_fcat,
      it_lvc_cat TYPE lvc_t_fcat.


FIELD-SYMBOLS: &amp;lt;ta_output&amp;gt; TYPE table,
              &amp;lt;ta_color&amp;gt; TYPE table,
              &amp;lt;l_line&amp;gt;  TYPE ANY,
               &amp;lt;l_field&amp;gt; TYPE ANY,
               &amp;lt;fs&amp;gt; TYPE ty_pernrs.
.

  SELECT pernr ename FROM pa0001
    INTO CORRESPONDING FIELDS OF TABLE ta_pernrs
    WHERE pernr IN so_pernr
      AND werks IN so_werks
      AND begda &amp;lt;= '99991231'
      AND endda &amp;gt;  h_begin.


*build fields for dynamic table

* static fields

  is_lvc_cat-fieldname = 'VALIDITYDATE'.
  is_lvc_cat-ref_field = 'VALIDITYDATE'.
  is_lvc_cat-ref_table = 'BAPI7013_1'.
  is_lvc_cat-scrtext_s  = is_lvc_cat-scrtext_m =
  is_lvc_cat-scrtext_l  = 'Datum'.
  APPEND is_lvc_cat TO it_lvc_cat.

  is_lvc_cat-fieldname = 'DAY_STRING'.
  is_lvc_cat-ref_field = 'DAY_STRING'.
  is_lvc_cat-ref_table = 'CASDAYATTR'.
  is_lvc_cat-scrtext_s  = is_lvc_cat-scrtext_m =
  is_lvc_cat-scrtext_l  = 'Datum'.
  APPEND is_lvc_cat TO it_lvc_cat.

* dynamic fields

  LOOP AT ta_pernrs INTO wa_pernrs.

    FREE it_0002.
    WRITE wa_pernrs-pernr TO h_ri_pernr.
    is_lvc_cat-fieldname = wa_pernrs-pernr.
    is_lvc_cat-ref_field = 'massn'.
    is_lvc_cat-ref_table = 'PERNR'.
    is_lvc_cat-just = 'C'.
    is_lvc_cat-scrtext_s  =    is_lvc_cat-scrtext_m  =   is_lvc_cat-scrtext_l  =  wa_persnrs-pernr.

    APPEND is_lvc_cat TO it_lvc_cat.

endloop.


* create table
* Create a new Table
  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog = it_lvc_cat
    IMPORTING
      ep_table        = ta_output.

* Create a new Line with the same structure of the table.
  ASSIGN ta_output-&amp;gt;* TO &amp;lt;ta_output&amp;gt;.
  CREATE DATA new_line LIKE LINE OF &amp;lt;ta_output&amp;gt;.
  ASSIGN new_line-&amp;gt;* TO &amp;lt;l_line&amp;gt;.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;kind regards&lt;/P&gt;&lt;P&gt;arthur&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: A. de Smidt on Jun 4, 2008 10:08 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: A. de Smidt on Jun 4, 2008 10:09 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Jun 2008 08:06:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-based-on-records/m-p/3914486#M938377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-04T08:06:13Z</dc:date>
    </item>
  </channel>
</rss>

