<?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: define internal table depending on parameter in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047709#M421776</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Leider..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please have a look at&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you a clear Idea..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it helps reward with points...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rk..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 13 Mar 2007 13:37:12 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-13T13:37:12Z</dc:date>
    <item>
      <title>define internal table depending on parameter</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047705#M421772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;does anybody know how internal tables can be defined when tablename is passed as parameter ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have p_table and want to define an internal table depending on its value (e.g. KNA1, MARA, LFA1 ) dynamically, so for example if p_table= MARA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: 
 l_tab_table TYPE STANDARD TABLE OF MARA.
l_str_table TYPE MARA.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anybody done this before ?&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2007 13:22:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047705#M421772</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-03-13T13:22:34Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table depending on parameter</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047706#M421773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Clemens,&lt;/P&gt;&lt;P&gt;    Follow this example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
PARAMETERS: dbtab(10) TYPE c, 
            rows      TYPE i DEFAULT 100. 

DATA dref TYPE REF TO data. 

FIELD-SYMBOLS: TYPE ANY TABLE, 
               &amp;lt;wa&amp;gt;    TYPE ANY, 
                 TYPE ANY. 

TRY. 
    CREATE DATA dref TYPE STANDARD TABLE OF (dbtab) 
                          WITH NON-UNIQUE DEFAULT KEY. 
    ASSIGN dref-&amp;gt;* TO  . 
    SELECT * 
           FROM (dbtab) UP TO rows ROWS 
           INTO TABLE  . 
    LOOP AT  ASSIGNING &amp;lt;wa&amp;gt;. 
      DO. 
        ASSIGN COMPONENT sy-index 
               OF STRUCTURE &amp;lt;wa&amp;gt; TO . 
        IF sy-subrc = 0. 
          WRITE / . 
        ELSE. 
          EXIT. 
        ENDIF. 
      ENDDO. 
      ULINE. 
    ENDLOOP. 
  CATCH cx_sy_create_data_error. 
    WRITE 'Wrong Database!'. 
ENDTRY. 
 
Regards,
Ravi&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2007 13:25:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047706#M421773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-13T13:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table depending on parameter</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047707#M421774</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;U have to use field-symbols:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: P_TABLE(30).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: DYN_TAB TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;TAB&amp;gt; TYPE TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA DYN_TAB TYPE TABLE OF (P_TABLE).&lt;/P&gt;&lt;P&gt;ASSIGN DYN_TAB-&amp;gt;* TO &amp;lt;TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I believe the option CREATE DATA ... TYPE TABLE is available from release 4.7.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you use a lower release you have to use the method &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CREATE_DYNAMIC_TABLE of class CL_ALV_TABLE_CREATE:

CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
  EXPORTING
     I_STRUCTURE_NAME = P_TABLE
  CHANGING
     CT_FIELDCAT      = GT_FIELDCAT.

call method cl_alv_table_create=&amp;gt;create_dynamic_table
    exporting it_fieldcatalog = gt_fieldcat
    importing ep_table        = DYN_TAB.
ASSIGN DYN_TAB-&amp;gt;* TO &amp;lt;TAB&amp;gt;.&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>Tue, 13 Mar 2007 13:28:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047707#M421774</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-13T13:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table depending on parameter</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047708#M421775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   As of my knowledge , the first statements that are going to get executed are "DATA" statements only.&lt;/P&gt;&lt;P&gt;   So regarding your requirement the system has to execute the PARAMETER statement first and then the DATA statement which is not going to happen generally.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Balakrishna.N&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2007 13:35:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047708#M421775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-13T13:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table depending on parameter</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047709#M421776</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Leider..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please have a look at&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will give you a clear Idea..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rich.heilman2/blog/2005/07/27/dynamic-internal-tables-and-structures--abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it helps reward with points...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rk..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2007 13:37:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047709#M421776</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-13T13:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: define internal table depending on parameter</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047710#M421777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Follow up:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any sample or approach of how i can display the table columns ( that would be selectable ) after i selected the table via the parameter ? that way i would be able to just view certain columns of the specified table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 Mar 2007 15:06:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/define-internal-table-depending-on-parameter/m-p/2047710#M421777</guid>
      <dc:creator>former_member5350</dc:creator>
      <dc:date>2007-03-13T15:06:57Z</dc:date>
    </item>
  </channel>
</rss>

