<?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 tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261437#M147755</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;  I have problem in understanding the flow of how to &lt;/P&gt;&lt;P&gt;create a dynamic internal table.This is what i have understood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;gt; A dynamic internal table is created by creating a new &lt;/P&gt;&lt;P&gt;include file at run time and having it inserted in the current program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2&amp;gt; This include file will contain the structure of the internal table, which is to be created at run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3&amp;gt;But when and where do i populate this table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me out with this problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 06 Mar 2006 06:02:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-03-06T06:02:13Z</dc:date>
    <item>
      <title>Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261437#M147755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;  I have problem in understanding the flow of how to &lt;/P&gt;&lt;P&gt;create a dynamic internal table.This is what i have understood.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;gt; A dynamic internal table is created by creating a new &lt;/P&gt;&lt;P&gt;include file at run time and having it inserted in the current program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2&amp;gt; This include file will contain the structure of the internal table, which is to be created at run time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3&amp;gt;But when and where do i populate this table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you help me out with this problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2006 06:02:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261437#M147755</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-06T06:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261438#M147756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi abhijeet,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Your points 1,2 are incorrect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Dynanmic internal table has nothing&lt;/P&gt;&lt;P&gt;  to do with include file etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. It has to do with field-symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. If your requirement is &lt;/P&gt;&lt;P&gt;  creating a dynamic internal table,&lt;/P&gt;&lt;P&gt;   (provided u have the information&lt;/P&gt;&lt;P&gt;   about which-which fields should be in the table)&lt;/P&gt;&lt;P&gt;, then u can use the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  There is an INDEPENDENT FORM &lt;/P&gt;&lt;P&gt;  whose inputs are FIELD LIST&lt;/P&gt;&lt;P&gt;  and from those, it consructs dynamic table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Here is the program.&lt;/P&gt;&lt;P&gt;the dynamic table name will be &lt;/P&gt;&lt;P&gt;&amp;lt;DYNTABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. U can use this program (FORM in this program)&lt;/P&gt;&lt;P&gt;to generate any kind of internal table&lt;/P&gt;&lt;P&gt;by specifying some inputs (ie. field list)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT abc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; COMPULSORY&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;dyntable&amp;gt; TYPE ANY TABLE.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;dynline&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;DATA: lt TYPE lvc_t_fcat.&lt;/P&gt;&lt;P&gt;DATA: ls TYPE lvc_s_fcat.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fld&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;DATA : fldname(50) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------------" /&gt;&lt;P&gt;PARAMETERS : infty(4) TYPE c OBLIGATORY.&lt;/P&gt;&lt;P&gt;DATA : iname LIKE dd02l-tabname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------------" /&gt;&lt;P&gt; GET INFO&lt;/P&gt;&lt;P&gt;CONCATENATE 'P' infty INTO iname.&lt;/P&gt;&lt;P&gt;DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'DD_NAMETAB_TO_DDFIELDS'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;tabname = iname&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;ddfields = ddfields.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; CONSTRUCT FIELD LIST&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ddfields.&lt;/P&gt;&lt;P&gt;ls-fieldname = ddfields-fieldname.&lt;/P&gt;&lt;P&gt;APPEND ls TO lt.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; PERFORM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PERFORM mydyntable USING lt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BREAK-POINT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;INDEPENDENT FORM&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM mydyntable USING lt TYPE lvc_t_fcat .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt; Create Dyn Table From FC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_data&amp;gt; TYPE REF TO data.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_2&amp;gt; TYPE ANY TABLE.&lt;/P&gt;&lt;P&gt;DATA: lt_data TYPE REF TO data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN lt_data TO &amp;lt;fs_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;it_fieldcatalog = lt&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;ep_table = &amp;lt;fs_data&amp;gt;&lt;/P&gt;&lt;P&gt;EXCEPTIONS&lt;/P&gt;&lt;P&gt;generate_subpool_dir_full = 1&lt;/P&gt;&lt;P&gt;OTHERS = 2.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="--------" /&gt;&lt;P&gt; Assign Dyn Table To Field Sumbol&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN &amp;lt;fs_data&amp;gt;-&amp;gt;* TO &amp;lt;fs_1&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN &amp;lt;fs_1&amp;gt; TO &amp;lt;fs_2&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN &amp;lt;fs_1&amp;gt; TO &amp;lt;dyntable&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. "MYDYNTABLE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2006 06:06:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261438#M147756</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-06T06:06:52Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261439#M147757</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 sample code.It will answer your doubts and kindly reward points by clikcing the star on the left of reply,if it helps.This code I got from SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report zrich_0003       no standard page heading.&lt;/P&gt;&lt;P&gt;type-pools: slis.&lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;dyn_table&amp;gt; type standard table,    &lt;/P&gt;&lt;P&gt;data: alv_fldcat type slis_t_fieldcat_alv,    &lt;/P&gt;&lt;P&gt;  it_fldcat type lvc_t_fcat.         &lt;/P&gt;&lt;P&gt;  &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;selection-screen begin of block b1 with frame title text-001.&lt;/P&gt;&lt;P&gt;parameters: p_check type c.&lt;/P&gt;&lt;P&gt;selection-screen end of block b1.&lt;/P&gt;&lt;P&gt;start-of-selection. &lt;/P&gt;&lt;P&gt; perform build_dyn_itab. &lt;/P&gt;&lt;P&gt; perform build_report.&lt;/P&gt;&lt;P&gt;loop at &amp;lt;dyn_table&amp;gt; into &amp;lt;dyn_wa&amp;gt;.   &lt;/P&gt;&lt;P&gt; write:/ &amp;lt;dyn_wa&amp;gt;. &lt;/P&gt;&lt;P&gt; endloop.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="73" type="ul"&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt; Build_dyn_itab************************************************************************&lt;/P&gt;&lt;P&gt;form build_dyn_itab.  &lt;/P&gt;&lt;P&gt;data: index(3) type c.  &lt;/P&gt;&lt;P&gt;data: new_table type ref to data, &lt;/P&gt;&lt;P&gt;       new_line  type ref to data,   &lt;/P&gt;&lt;P&gt;     wa_it_fldcat type lvc_s_fcat.&lt;/P&gt;&lt;P&gt;  clear wa_it_fldcat.&lt;/P&gt;&lt;P&gt;wa_it_fldcat-fieldname  = 'AUFNR'.&lt;/P&gt;&lt;P&gt;  wa_it_fldcat-datatype = 'CHAR'. &lt;/P&gt;&lt;P&gt; wa_it_fldcat-intlen = 12.  &lt;/P&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .  &lt;/P&gt;&lt;P&gt;clear wa_it_fldcat. &lt;/P&gt;&lt;P&gt; wa_it_fldcat-fieldname  = 'POSNR'. &lt;/P&gt;&lt;P&gt; wa_it_fldcat-datatype = 'CHAR'.&lt;/P&gt;&lt;P&gt;  wa_it_fldcat-intlen = 6.  &lt;/P&gt;&lt;P&gt;append wa_it_fldcat to it_fldcat .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create fields &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; clear index.&lt;/P&gt;&lt;P&gt;do 2 times.    &lt;/P&gt;&lt;P&gt;index = sy-index.  &lt;/P&gt;&lt;P&gt;  clear wa_it_fldcat.  &lt;/P&gt;&lt;P&gt;  concatenate 'Field' index into       &lt;/P&gt;&lt;P&gt;      wa_it_fldcat-fieldname .  &lt;/P&gt;&lt;P&gt;  condense  wa_it_fldcat-fieldname no-gaps. &lt;/P&gt;&lt;P&gt;   wa_it_fldcat-datatype = 'CHAR'.  &lt;/P&gt;&lt;P&gt;  wa_it_fldcat-intlen = 5.  &lt;/P&gt;&lt;P&gt;  append wa_it_fldcat to it_fldcat . &lt;/P&gt;&lt;P&gt; enddo.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic internal table and assign to FS &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; call method cl_alv_table_create=&amp;gt;create_dynamic_table  &lt;/P&gt;&lt;P&gt;             exporting                 &lt;/P&gt;&lt;P&gt; it_fieldcatalog = it_fldcat             &lt;/P&gt;&lt;P&gt;  importing                 &lt;/P&gt;&lt;P&gt; ep_table        = new_table.  assign new_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create dynamic work area and assign to FS &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; create data new_line like line of &amp;lt;dyn_table&amp;gt;.  &lt;/P&gt;&lt;P&gt;assign new_line-&amp;gt;* to &amp;lt;dyn_wa&amp;gt;.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="70" type="ul"&gt;&lt;P&gt;  &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;   Form  build_report*********************************************************************&lt;/P&gt;&lt;P&gt;form build_report. &lt;/P&gt;&lt;P&gt; data: fieldname(20) type c. &lt;/P&gt;&lt;P&gt; data: fieldvalue(5) type c. &lt;/P&gt;&lt;P&gt; data: index(3) type c.  &lt;/P&gt;&lt;P&gt;field-symbols: &amp;lt;fs1&amp;gt;.  &lt;/P&gt;&lt;P&gt;assign component  'AUFNR'  of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;fs1&amp;gt;.  &lt;/P&gt;&lt;P&gt;&amp;lt;fs1&amp;gt; =  '123456789'. &lt;/P&gt;&lt;P&gt; assign component  'POSNR'  of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;fs1&amp;gt;.  &lt;/P&gt;&lt;P&gt;&amp;lt;fs1&amp;gt; =  '000001'.&lt;/P&gt;&lt;P&gt;do 2 times.   &lt;/P&gt;&lt;P&gt; index = sy-index.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set up fieldname   &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; concatenate 'FIELD' index into fieldname .  &lt;/P&gt;&lt;P&gt;  condense   fieldname  no-gaps.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Set up fieldvalue   &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; concatenate 'FLD' index into  fieldvalue. &lt;/P&gt;&lt;P&gt;   condense   fieldvalue no-gaps.    &lt;/P&gt;&lt;P&gt;assign component  fieldname  of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;fs1&amp;gt;.    &lt;/P&gt;&lt;P&gt;&amp;lt;fs1&amp;gt; =  fieldvalue. &lt;/P&gt;&lt;P&gt; enddo.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Append to the dynamic internal table &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; append &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_table&amp;gt;.&lt;/P&gt;&lt;P&gt;endform.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2006 06:07:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261439#M147757</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-03-06T06:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261440#M147758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at these threads from the forum:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1284371"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1209181"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sudha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2006 06:12:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261440#M147758</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-06T06:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261441#M147759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;Below two example resolve ur query. Just check it out.&lt;/P&gt;&lt;P&gt;REPORT ZCLUST1 . &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Example: how to create a dynamic internal table &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; &lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The dynamic internal table stucture &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: BEGIN OF STRUCT OCCURS 10, &lt;/P&gt;&lt;P&gt;    FILDNAME(8) TYPE C, &lt;/P&gt;&lt;P&gt;    ABPTYPE TYPE C, &lt;/P&gt;&lt;P&gt;    LENGTH TYPE I, &lt;/P&gt;&lt;P&gt;END OF STRUCT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;The dynamic program source table &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;DATA: BEGIN OF INCTABL OCCURS 10, &lt;/P&gt;&lt;P&gt;    LINE(72), &lt;/P&gt;&lt;P&gt;END OF INCTABL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: LNG TYPE I, TYPESRTING(6). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sample dynamic internal table stucture &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;STRUCT-FILDNAME = 'field1'. STRUCT-ABPTYPE = 'c'. STRUCT-LENGTH = '6'. &lt;/P&gt;&lt;P&gt;APPEND STRUCT. CLEAR STRUCT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRUCT-FILDNAME = 'field2'. STRUCT-ABPTYPE = 'd'. &lt;/P&gt;&lt;P&gt;APPEND STRUCT. CLEAR STRUCT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;STRUCT-FILDNAME = 'field3'. STRUCT-ABPTYPE = 'i'. &lt;/P&gt;&lt;P&gt;APPEND STRUCT. CLEAR STRUCT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create the dynamic internal table definition in the dyn. program &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCTABL-LINE = 'program zdynpro.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT STRUCT. &lt;/P&gt;&lt;P&gt;  INCTABL-LINE = STRUCT-FILDNAME. &lt;/P&gt;&lt;P&gt;  LNG = STRLEN( STRUCT-FILDNAME ). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT STRUCT-LENGTH IS INITIAL . &lt;/P&gt;&lt;P&gt;      TYPESRTING(1) = '('. &lt;/P&gt;&lt;P&gt;      TYPESRTING+1 = STRUCT-LENGTH. &lt;/P&gt;&lt;P&gt;      TYPESRTING+5 = ')'. &lt;/P&gt;&lt;P&gt;      CONDENSE TYPESRTING NO-GAPS. &lt;/P&gt;&lt;P&gt;      INCTABL-LINE+LNG = TYPESRTING. &lt;/P&gt;&lt;P&gt;  ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  INCTABL-LINE+15 = 'type '. &lt;/P&gt;&lt;P&gt;  INCTABL-LINE+21 = STRUCT-ABPTYPE. &lt;/P&gt;&lt;P&gt;  INCTABL-LINE+22 = ','. &lt;/P&gt;&lt;P&gt;  APPEND INCTABL. &lt;/P&gt;&lt;P&gt;ENDLOOP. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'end of dyntab. '. &lt;/P&gt;&lt;P&gt;APPEND INCTABL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create the code processes the dynamic internal table &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INCTABL-LINE = ' '. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'dyntab-field1 = ''aaaaaa''.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'dyntab-field1 = ''19970814''.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'dyntab-field1 = 1.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'append dyntab.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = ' '. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'loop at dyntab.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'write: / dyntab.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;INCTABL-LINE = 'endloop.'. APPEND INCTABL. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create and run the dynamic program &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;INSERT REPORT 'zdynpro'(001) FROM INCTABL. &lt;/P&gt;&lt;P&gt;SUBMIT ZDYNPRO. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="-------------------------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or Just try out this simpler dynamic internal tables &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: itab TYPE STANDARD TABLE OF spfli, &lt;/P&gt;&lt;P&gt;              wa LIKE LINE OF itab. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: line(72) TYPE c, &lt;/P&gt;&lt;P&gt;            list LIKE TABLE OF line(72). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION. &lt;/P&gt;&lt;P&gt;*line = ' CITYFROM CITYTO '. &lt;/P&gt;&lt;P&gt;  line = ' AIRPTO '. &lt;/P&gt;&lt;P&gt; APPEND line TO list. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT DISTINCT (list) &lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE itab &lt;/P&gt;&lt;P&gt;            FROM spfli. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc EQ 0. &lt;/P&gt;&lt;P&gt;  LOOP AT itab INTO wa. &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    WRITE: / wa-cityfrom, wa-cityto. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       WRITE &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; wa-airpto. &lt;/P&gt;&lt;P&gt;  ENDLOOP. &lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2006 06:12:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261441#M147759</guid>
      <dc:creator>vinod_gunaware2</dc:creator>
      <dc:date>2006-03-06T06:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261442#M147760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. y u r usig dynamic internal table?&lt;/P&gt;&lt;P&gt;suppose there is a requirement like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have an internal table, i donno how many values it populates.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;suppose , A, B, C are the fields of itab.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now my requirement is the &amp;lt;b&amp;gt;values of C&amp;lt;/b&amp;gt; should be stored &amp;lt;b&amp;gt;in another internal table&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how many values i will get in C?&lt;/P&gt;&lt;P&gt;not known prior.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;then how can i declare an internal table with fields as values of c?&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then we need an internal table which is not declared above statically with fields known before but a dynamic table which is &amp;lt;b&amp;gt;built automatically with fields that came at run time.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i hope now u understood the main concept of dynamic internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;suppose itab has fields A, B, C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SO ITAB-C HAS THE VALUES OF C. NOW WE WANT A TABLE WITH VALUES OF C RIGHT!!.&lt;/P&gt;&lt;P&gt;NOW BUILD A FIELDCATALOG LIKE BELOW.&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;LS_FIELDCAT-FIELDNAME = ITAB-C.&lt;/P&gt;&lt;P&gt;LS_FIELDCAT-COL_TEXT = ITAB_C.&lt;/P&gt;&lt;P&gt;APPEND LS_FIELDCAT TO LT_FIELDCAT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: DREF TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;TEMP_TAB&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL METHOD CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      IT_FIELDCATALOG = LT_LVCFIELDCAT&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      EP_TABLE        = DREF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ASSIGN dref-&amp;gt;*  TO &amp;lt;TEMP_TAB&amp;gt;.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;TEMP_TAB&amp;gt; IS THE REQUIRED DYNAMIC INTERNAL TABLE.&lt;/P&gt;&lt;P&gt;NOW IF U WANT TO FILL THE DYNAMIC INTERNAL TABLE.&lt;/P&gt;&lt;P&gt;DO AS BELOW..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;DATA: WA_DREF TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;WA_TAB&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA WA_DREF LIKE LINE OF &amp;lt;TEMP_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;ASSIGN WA_DREF-&amp;gt;* TO &amp;lt;WA_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;FS1&amp;gt;, &amp;lt;FS2&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT ITAB-C OF STRUCTURE &amp;lt;WA_TAB&amp;gt; TO &amp;lt;FS1&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;FS1&amp;gt; = {SOME VALUE}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND &amp;lt;WA_TAB&amp;gt; TO &amp;lt;TEMP_TAB&amp;gt;.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt; &amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Hymavathi Oruganti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Mar 2006 06:22:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261442#M147760</guid>
      <dc:creator>hymavathi_oruganti</dc:creator>
      <dc:date>2006-03-06T06:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261443#M147761</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;Refer this sample code for creating an dynamic Internal Table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 
REPORT ZCLUST1 .
*
* Example: how to create a dynamic internal table
* 
* The dynamic internal table stucture
DATA: BEGIN OF STRUCT OCCURS 10,
    FILDNAME(8) TYPE C,
    ABPTYPE TYPE C,
    LENGTH TYPE I,
END OF STRUCT.

* The dynamic program source table
DATA: BEGIN OF INCTABL OCCURS 10,
    LINE(72),
END OF INCTABL.

DATA: LNG TYPE I, TYPESRTING(6).

* Sample dynamic internal table stucture
STRUCT-FILDNAME = 'field1'. STRUCT-ABPTYPE = 'c'. STRUCT-LENGTH = '6'.
APPEND STRUCT. CLEAR STRUCT.
STRUCT-FILDNAME = 'field2'. STRUCT-ABPTYPE = 'd'.
APPEND STRUCT. CLEAR STRUCT.
STRUCT-FILDNAME = 'field3'. STRUCT-ABPTYPE = 'i'.
APPEND STRUCT. CLEAR STRUCT.

* Create the dynamic internal table definition in the dyn. program
INCTABL-LINE = 'program zdynpro.'. APPEND INCTABL.
INCTABL-LINE = 'data: begin of dyntab occurs 10,'. APPEND INCTABL.
LOOP AT STRUCT.
  INCTABL-LINE = STRUCT-FILDNAME.
  LNG = STRLEN( STRUCT-FILDNAME ).
  IF NOT STRUCT-LENGTH IS INITIAL .
    TYPESRTING(1) = '('.
    TYPESRTING+1 = STRUCT-LENGTH.
    TYPESRTING+5 = ')'.
    CONDENSE TYPESRTING NO-GAPS.
    INCTABL-LINE+LNG = TYPESRTING.
  ENDIF.
  INCTABL-LINE+15 = 'type '.
  INCTABL-LINE+21 = STRUCT-ABPTYPE.
  INCTABL-LINE+22 = ','.
  APPEND INCTABL.
ENDLOOP.
INCTABL-LINE = 'end of dyntab. '.
APPEND INCTABL.

* Create the code processes the dynamic internal table
INCTABL-LINE = ' '. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = ''aaaaaa''.'. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = ''19970814''.'. APPEND INCTABL.
INCTABL-LINE = 'dyntab-field1 = 1.'. APPEND INCTABL.
INCTABL-LINE = 'append dyntab.'. APPEND INCTABL.
INCTABL-LINE = ' '. APPEND INCTABL.
INCTABL-LINE = 'loop at dyntab.'. APPEND INCTABL.
INCTABL-LINE = 'write: / dyntab.'. APPEND INCTABL.
INCTABL-LINE = 'endloop.'. APPEND INCTABL.

* Create and run the dynamic program
INSERT REPORT 'zdynpro'(001) FROM INCTABL.
SUBMIT ZDYNPRO.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gayathri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2006 04:01:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1261443#M147761</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-07T04:01:05Z</dc:date>
    </item>
  </channel>
</rss>

