<?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/1578030#M260964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have to create an internal table dynamically. the scenario is like this: I will take the table type from a user in a variable "x". How should I now use this value to create a internal table .&lt;/P&gt;&lt;P&gt;For example: x = sflight&lt;/P&gt;&lt;P&gt;So i need to creare a internal table of type sflight&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Puru&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Oct 2006 10:57:07 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-17T10:57:07Z</dc:date>
    <item>
      <title>Dynamic Internal tables!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578030#M260964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have to create an internal table dynamically. the scenario is like this: I will take the table type from a user in a variable "x". How should I now use this value to create a internal table .&lt;/P&gt;&lt;P&gt;For example: x = sflight&lt;/P&gt;&lt;P&gt;So i need to creare a internal table of type sflight&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Puru&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 10:57:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578030#M260964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T10:57:07Z</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/1578031#M260965</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 these link&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="2527653"&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="2527662"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Alfred&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points for helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 10:59:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578031#M260965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T10:59:22Z</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/1578032#M260966</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;If you search the forum with dynamic tables you will get many options&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but this is a really good blog for the same&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 10:59:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578032#M260966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T10:59:42Z</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/1578033#M260967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;Hi,

chk this , u can get some idea

******DATA DECLARATION*****************************

FIELD-SYMBOLS : &amp;lt;it_final&amp;gt; TYPE STANDARD TABLE,
                &amp;lt;wa_final&amp;gt; TYPE ANY,
                &amp;lt;w_field&amp;gt; TYPE ANY.


***DYNAMIC CREATION OF FIELDCATALOG****************

*FIRST 2 FIELDS FIELDS FIELD1 AND FIELD2 ARE CONSTANT, FIELDS OBTAINED IN THE LOOP ENDLOOP ARE DYNAMIC,
*LIKEWISE DYNAMIC FIELDCATALOG IS CREATED

  wa_fieldcatalog-fieldname  = 'FIELD1'.
  wa_fieldcatalog-ref_table  = 'E070'.
  wa_fieldcatalog-outputlen  = '13'.
  wa_fieldcatalog-reptext    = 'Created On'.
  wa_fieldcatalog-seltext    = 'Created On'.
  APPEND wa_fieldcatalog TO it_fieldcatalog.
  CLEAR wa_fieldcatalog.
  
  wa_fieldcatalog-fieldname  = 'FIELD1'.
  wa_fieldcatalog-ref_table  = 'E070'.
  wa_fieldcatalog-outputlen  = '13'.
  wa_fieldcatalog-reptext    = 'Created On'.
  wa_fieldcatalog-seltext    = 'Created On'.
  APPEND wa_fieldcatalog TO it_fieldcatalog.
  CLEAR wa_fieldcatalog.


  LOOP AT it_mandt WHERE mandt IN s_mandt.
    CONCATENATE 'CLNT' it_mandt INTO wa_fieldcatalog-fieldname.
    wa_fieldcatalog-inttype    = 'NUMC'.
    wa_fieldcatalog-outputlen  = '14'.
    wa_fieldcatalog-reptext    = it_mandt.
    wa_fieldcatalog-seltext    = it_mandt.

    APPEND wa_fieldcatalog TO it_fieldcatalog.
    CLEAR :wa_fieldcatalog ,it_mandt.
  ENDLOOP.


********CREATE DYNAMIC TABLE************************

  CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
    EXPORTING
      it_fieldcatalog           = it_fieldcatalog
    IMPORTING
      ep_table                  = new_table
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.
  IF sy-subrc &amp;lt;&amp;gt; 0.
*  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

  ASSIGN new_table-&amp;gt;* TO &amp;lt;it_final&amp;gt;.

*********CREATE WORK AREA****************************

CREATE DATA new_line LIKE LINE OF &amp;lt;it_final&amp;gt;.
  ASSIGN new_line-&amp;gt;* TO &amp;lt;wa_final&amp;gt;.

*********INSERTTING WORK AREAR TO INTERNAL TABLE******

    INSERT &amp;lt;wa_final&amp;gt; INTO TABLE &amp;lt;it_final&amp;gt;.

*******POPULATING DATA*******************************  
  LOOP.
   
   ASSIGN COMPONENT 'FIELD1' OF STRUCTURE &amp;lt;wa_final&amp;gt; TO &amp;lt;w_field&amp;gt;.
   &amp;lt;w_field&amp;gt; = '12345'.

    ASSIGN COMPONENT 'FIELD2' OF STRUCTURE &amp;lt;wa_final&amp;gt; TO &amp;lt;w_field&amp;gt;.
   &amp;lt;w_field&amp;gt; = '21453DD'.

   FIELD1 AND FIELD2 ARE COMPONENTS OF FIELDCATALOG.
    
ENDLOOP.      

  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 11:00:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578033#M260967</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T11:00:18Z</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/1578034#M260968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Type-pools : abap. &lt;/P&gt;&lt;P&gt;  field-symbols: &amp;lt;dyn_table&amp;gt; type standard table, &lt;/P&gt;&lt;P&gt;               &amp;lt;dyn_wa&amp;gt;, &lt;/P&gt;&lt;P&gt;               &amp;lt;dyn_field&amp;gt;. &lt;/P&gt;&lt;P&gt;  data: dy_table type ref to data, &lt;/P&gt;&lt;P&gt;      dy_line  type ref to data, &lt;/P&gt;&lt;P&gt;      xfc type lvc_s_fcat, &lt;/P&gt;&lt;P&gt;      ifc type lvc_t_fcat. &lt;/P&gt;&lt;P&gt;  selection-screen begin of block b1 with frame. &lt;/P&gt;&lt;P&gt;parameters: p_table(30) type c default 'T001'. &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 get_structure. &lt;/P&gt;&lt;P&gt;  perform create_dynamic_itab.      *********&lt;STRONG&gt;Creates a dyanamic internal table&lt;/STRONG&gt;********* &lt;/P&gt;&lt;P&gt;  perform get_data. &lt;/P&gt;&lt;P&gt;  perform write_out. &lt;/P&gt;&lt;P&gt;  form get_structure. &lt;/P&gt;&lt;P&gt;  data : idetails type abap_compdescr_tab, &lt;/P&gt;&lt;P&gt;       xdetails type abap_compdescr. &lt;/P&gt;&lt;P&gt;  data : ref_table_des type ref to cl_abap_structdescr. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Get the structure of the table. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ref_table_des ?=  &lt;/P&gt;&lt;P&gt;      cl_abap_typedescr=&amp;gt;describe_by_name( p_table ). &lt;/P&gt;&lt;P&gt;  idetails[] = ref_table_des-&amp;gt;components[]. &lt;/P&gt;&lt;P&gt;    loop at idetails into xdetails. &lt;/P&gt;&lt;P&gt;    clear xfc. &lt;/P&gt;&lt;P&gt;    xfc-fieldname = xdetails-name . &lt;/P&gt;&lt;P&gt;    xfc-datatype = xdetails-type_kind. &lt;/P&gt;&lt;P&gt;    xfc-inttype = xdetails-type_kind. &lt;/P&gt;&lt;P&gt;    xfc-intlen = xdetails-length. &lt;/P&gt;&lt;P&gt;    xfc-decimals = xdetails-decimals. &lt;/P&gt;&lt;P&gt;    append xfc to ifc. &lt;/P&gt;&lt;P&gt;  endloop. &lt;/P&gt;&lt;P&gt;  endform. &lt;/P&gt;&lt;P&gt;  form create_dynamic_itab. &lt;/P&gt;&lt;P&gt;  &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 = ifc &lt;/P&gt;&lt;P&gt;               importing &lt;/P&gt;&lt;P&gt;                  ep_table        = dy_table. &lt;/P&gt;&lt;P&gt;    assign dy_table-&amp;gt;* to &amp;lt;dyn_table&amp;gt;. &lt;/P&gt;&lt;P&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 dy_line like line of &amp;lt;dyn_table&amp;gt;. &lt;/P&gt;&lt;P&gt;  assign dy_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;P&gt;  form get_data. &lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Select Data from table. &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  select * into table &amp;lt;dyn_table&amp;gt; &lt;/P&gt;&lt;P&gt;             from (p_table). &lt;/P&gt;&lt;P&gt;  endform. &lt;/P&gt;&lt;P&gt;   Write out data from table. &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;    do. &lt;/P&gt;&lt;P&gt;      assign component  sy-index   &lt;/P&gt;&lt;P&gt;         of structure &amp;lt;dyn_wa&amp;gt; to &amp;lt;dyn_field&amp;gt;. &lt;/P&gt;&lt;P&gt;      if sy-subrc &amp;lt;&amp;gt; 0. &lt;/P&gt;&lt;P&gt;        exit. &lt;/P&gt;&lt;P&gt;      endif. &lt;/P&gt;&lt;P&gt;      if sy-index = 1. &lt;/P&gt;&lt;P&gt;        write:/ &amp;lt;dyn_field&amp;gt;. &lt;/P&gt;&lt;P&gt;      else. &lt;/P&gt;&lt;P&gt;        write: &amp;lt;dyn_field&amp;gt;. &lt;/P&gt;&lt;P&gt;      endif. &lt;/P&gt;&lt;P&gt;    enddo. &lt;/P&gt;&lt;P&gt;  endloop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 11:04:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578034#M260968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T11:04:55Z</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/1578035#M260969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt; How to clear the dynamic internal table.&lt;/P&gt;&lt;P&gt;Eg,&lt;/P&gt;&lt;P&gt;  This is my dynamic i tab &amp;lt;DYN_IT_TABLE&amp;gt;.&lt;/P&gt;&lt;P&gt;  run time initially &amp;lt;DYN_IT_TABLE&amp;gt; is initial like Table[initial]&lt;/P&gt;&lt;P&gt; first time &amp;lt;DYN_IT_TABLE&amp;gt; is Table[1222x110].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i clear,refresh,free the &amp;lt;DYN_IT_TABLE&amp;gt; is comming like this Table[0x110].&lt;/P&gt;&lt;P&gt;in next time i will create dynimic itab it will create dump.&lt;/P&gt;&lt;P&gt;is there any way to sort out this problem.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 11:17:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578035#M260969</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T11:17:49Z</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/1578036#M260970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;cv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 12:39:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-internal-tables/m-p/1578036#M260970</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T12:39:16Z</dc:date>
    </item>
  </channel>
</rss>

