<?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 Create Dynamic Internal table with fields from another internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070462#M1178024</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me put it straight, if I am having a list of tables from table T682I, field KOTABNR prefixed with 'A',&lt;/P&gt;&lt;P&gt;and the I am able to get the fields for these tables starting with A from DD03L table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I generate an dynamic internal table with all the fields that are selected in internal table same as DD03L, wherein I am selecting multiple tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you get it.&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;Select * from T682I where into internal_table_X where kozgf eq 'PR00'.&lt;/P&gt;&lt;P&gt;then, get KOTABNR from internal_table_X and prefix it with A, &lt;/P&gt;&lt;P&gt;so now I have say, 20 tables with A as prefix, &lt;/P&gt;&lt;P&gt;now for these 20 tables I may get 25 unique fields from DD03L, &lt;/P&gt;&lt;P&gt;Then how do I create a internal table dynamically with all these 25 fields with are decided at runtime.&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Awaiting reply and help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dantham Conpolwedson&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Dantham Conpolwedson on Feb 4, 2009 1:39 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Feb 2009 12:37:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-04T12:37:58Z</dc:date>
    <item>
      <title>Create Dynamic Internal table with fields from another internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070462#M1178024</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me put it straight, if I am having a list of tables from table T682I, field KOTABNR prefixed with 'A',&lt;/P&gt;&lt;P&gt;and the I am able to get the fields for these tables starting with A from DD03L table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I generate an dynamic internal table with all the fields that are selected in internal table same as DD03L, wherein I am selecting multiple tables?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you get it.&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;Select * from T682I where into internal_table_X where kozgf eq 'PR00'.&lt;/P&gt;&lt;P&gt;then, get KOTABNR from internal_table_X and prefix it with A, &lt;/P&gt;&lt;P&gt;so now I have say, 20 tables with A as prefix, &lt;/P&gt;&lt;P&gt;now for these 20 tables I may get 25 unique fields from DD03L, &lt;/P&gt;&lt;P&gt;Then how do I create a internal table dynamically with all these 25 fields with are decided at runtime.&lt;/P&gt;&lt;P&gt; -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Awaiting reply and help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dantham Conpolwedson&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Dantham Conpolwedson on Feb 4, 2009 1:39 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2009 12:37:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070462#M1178024</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-04T12:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create Dynamic Internal table with fields from another internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070463#M1178025</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check this example code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sap-img.com/ab030.htm" target="test_blank"&gt;http://www.sap-img.com/ab030.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2009 12:39:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070463#M1178025</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-04T12:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Create Dynamic Internal table with fields from another internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070464#M1178026</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example code&lt;/P&gt;&lt;P&gt;PARAMETERS : p_table(10) TYPE C. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: w_tabname TYPE w_tabname,             &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        w_dref TYPE REF TO data,              &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        w_grid TYPE REF TO cl_gui_alv_grid.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  FIELD-SYMBOLS: &amp;lt;t_itab&amp;gt; TYPE ANY TABLE.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  w_tabname = p_table.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CREATE DATA w_dref TYPE TABLE OF (w_tabname). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN w_dref-&amp;gt;* TO &amp;lt;t_itab&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2009 13:25:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070464#M1178026</guid>
      <dc:creator>viquar_iqbal</dc:creator>
      <dc:date>2009-02-04T13:25:47Z</dc:date>
    </item>
    <item>
      <title>Re: Create Dynamic Internal table with fields from another internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070465#M1178027</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Say you have all the fields in a int tab named it_fields, then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;"Declare field cat
DATA: it_fieldcat TYPE lvc_t_fcat.
DATA: wa_fieldcat TYPE lvc_s_fcat.

FIELD-SYMBOLS: &amp;lt;outtab&amp;gt; TYPE ANY TABLE,
                            &amp;lt;l_line&amp;gt;  TYPE ANY.


LOOP AT it_fields INTO wa_fields.
 "fill it_fieldcat from the field name in it_fields.
ENDLOOP.


CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
        EXPORTING
          it_fieldcatalog = it_fieldcat
        IMPORTING
          ep_table        = new_table.

ASSIGN new_table-&amp;gt;* TO &amp;lt;outtab&amp;gt;.
CREATE DATA new_line LIKE LINE OF &amp;lt;outtab&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;&lt;/P&gt;&lt;P&gt;Now &amp;lt;out_tab&amp;gt; is the req int tab with all fields and &amp;lt;l_line&amp;gt; is the work area for it&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Feb 2009 14:48:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-dynamic-internal-table-with-fields-from-another-internal-table/m-p/5070465#M1178027</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-04T14:48:59Z</dc:date>
    </item>
  </channel>
</rss>

