<?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 Dynamic internal table declaration in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074340#M974233</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;Is it possible to declare same internal table with different type of?, let me explain, I need to show data depends on interface name which users select, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two interfaces, ZA and ZB ; if user select interface ZA I must declare one control and one detail internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF p_intf = 'ZA'.
    DATA: BEGIN OF it_output OCCURS 0.                          INCLUDE STRUCTURE zintf01.
    DATA:   sele(1),
          END OF it_output.

    DATA: BEGIN OF it_output_ctrl OCCURS 0.          
            INCLUDE STRUCTURE zintf01_ctrl.
    DATA:   name(1),
          END OF it_output_ctrl.

ELSEIF p_intf  = 'ZB'.
    DATA: BEGIN OF it_output OCCURS 0.                          INCLUDE STRUCTURE zintf02.
    DATA:   sele(1),
          END OF it_output.

    DATA: BEGIN OF it_output_ctrl OCCURS 0.          
            INCLUDE STRUCTURE zintf02_ctrl.
    DATA:   name(1),
          END OF it_output_ctrl.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 07 Jul 2008 21:23:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-07T21:23:39Z</dc:date>
    <item>
      <title>Dynamic internal table declaration</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074340#M974233</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;Is it possible to declare same internal table with different type of?, let me explain, I need to show data depends on interface name which users select, for example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two interfaces, ZA and ZB ; if user select interface ZA I must declare one control and one detail internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF p_intf = 'ZA'.
    DATA: BEGIN OF it_output OCCURS 0.                          INCLUDE STRUCTURE zintf01.
    DATA:   sele(1),
          END OF it_output.

    DATA: BEGIN OF it_output_ctrl OCCURS 0.          
            INCLUDE STRUCTURE zintf01_ctrl.
    DATA:   name(1),
          END OF it_output_ctrl.

ELSEIF p_intf  = 'ZB'.
    DATA: BEGIN OF it_output OCCURS 0.                          INCLUDE STRUCTURE zintf02.
    DATA:   sele(1),
          END OF it_output.

    DATA: BEGIN OF it_output_ctrl OCCURS 0.          
            INCLUDE STRUCTURE zintf02_ctrl.
    DATA:   name(1),
          END OF it_output_ctrl.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 21:23:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074340#M974233</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T21:23:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table declaration</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074341#M974234</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;defining internal table dynamically is possible but not in this way.. on of the ways in which it can be done is using field-symbol and method cl_alv_table_create=create_dynamic_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see a sample code below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

*** Tables
DATA: LT_DATA type ref to DATA.
DATA: LT_FIELDCATALOG type LVC_T_FCAT.

*** Structure
DATA: LS_FIELDCATALOG type LVC_S_FCAT.

*** Data References
DATA: NEW_LINE type ref to data.

*** Field Symbols
FIELD-SYMBOLS: &amp;lt;FS_DATA&amp;gt; type ref to DATA,
               &amp;lt;FS_1&amp;gt; type any table,
               &amp;lt;FS_2&amp;gt;,
               &amp;lt;FS_3&amp;gt;.



LS_FIELDCATALOG-FIELDNAME = 'MANDT'. 
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'CARRID'. "Fieldname
LS_FIELDCATALOG-INTTYPE = 'C'. "Internal Type C-&amp;gt; Character
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'CONNID'.
LS_FIELDCATALOG-INTTYPE = 'N'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'FLDATE'.
LS_FIELDCATALOG-INTTYPE = 'D'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'PRICE'.
LS_FIELDCATALOG-INTTYPE = 'P'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.

LS_FIELDCATALOG-FIELDNAME = 'CURRENCY'.
LS_FIELDCATALOG-INTTYPE = 'C'.
append LS_FIELDCATALOG to LT_FIELDCATALOG.


assign LT_DATA to &amp;lt;FS_DATA&amp;gt;.


call method cl_alv_table_create=create_dynamic_table
     exporting
       it_fieldcatalog = LT_FIELDCATALOG
     importing
       ep_table = FS_DATA
     exceptions
       generate_subpool_dir_full = 1
       others = 2
		.
if sy-subrc &amp;lt;&amp;gt; 0.
endif.



*** So &amp;lt;FS_1&amp;gt; now points to our dynamic internal table.

assign &amp;lt;FS_DATA&amp;gt;-&amp;gt;* to &amp;lt;FS_1&amp;gt;.

*** Next step is to create a work area for our dynamic internal table.

create data NEW_LINE like line of &amp;lt;FS_1&amp;gt;.

*** A field-symbol to access that work area
assign NEW_LINE-&amp;gt;*  to &amp;lt;FS_2&amp;gt;.

*** And to put the data in the internal table
select MANDT CARRID CONNID FLDATE PRICE CURRENCY
  from SFLIGHT
  into corresponding fields of table &amp;lt;FS_1&amp;gt;.

*** Access contents of internal table
loop at &amp;lt;FS_1&amp;gt; assigning &amp;lt;FS_2&amp;gt;.

assign component 1 of structure &amp;lt;FS_2&amp;gt; to &amp;lt;FS_3&amp;gt;.
write: / &amp;lt;FS_3&amp;gt;.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this might give you some idea about dynamic internal tables&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 21:33:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074341#M974234</guid>
      <dc:creator>Pawan_Kesari</dc:creator>
      <dc:date>2008-07-07T21:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal table declaration</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074342#M974235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Pawan, I will check it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Jul 2008 21:34:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-table-declaration/m-p/4074342#M974235</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-07T21:34:54Z</dc:date>
    </item>
  </channel>
</rss>

