<?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 table type in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449846#M1552746</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any generic data type for table declaration, beside :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; data: lt_generic type table of data  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that field-symbols can have the generic table type any&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; field-symbols: &amp;lt;lft_generic&amp;gt; type any table.  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I basically want to be able to read from generic tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; READ TABLE lt_generic ....  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Dec 2010 23:59:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-12-07T23:59:25Z</dc:date>
    <item>
      <title>Dynamic table type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449846#M1552746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any generic data type for table declaration, beside :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; data: lt_generic type table of data  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that field-symbols can have the generic table type any&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; field-symbols: &amp;lt;lft_generic&amp;gt; type any table.  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I basically want to be able to read from generic tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; READ TABLE lt_generic ....  &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Dec 2010 23:59:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449846#M1552746</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-07T23:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449847#M1552747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Andreas,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you are going to have to throw a bit more info into the ring so a better assessment of your requirement can be made. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Neil.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Dec 2010 00:21:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449847#M1552747</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-08T00:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449848#M1552748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Neil, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;actually i want to execute a read on the dynamic created tabel. &lt;/P&gt;&lt;P&gt;Maybe this repot explains my purpose. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; REPORT  ztc_dqm_dynamic.

************************************************************************
* Step 1: &amp;lt;&amp;lt; local definitions &amp;gt;&amp;gt;
************************************************************************

" &amp;lt;&amp;lt; variables &amp;gt;&amp;gt;

" &amp;lt;&amp;lt; error string &amp;gt;&amp;gt;
DATA: lv_error TYPE string.

" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; struc &amp;gt;&amp;gt;

" &amp;lt;&amp;lt; holds one component &amp;gt;&amp;gt;
DATA: ls_component TYPE
      cl_abap_structdescr=&amp;gt;component.

" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; table &amp;gt;&amp;gt;

DATA: lt_component TYPE cl_abap_structdescr=&amp;gt;component_table.

DATA: lt_db_indexfields TYPE TABLE OF ztcc_dqm_indices.

" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; dynamic &amp;gt;&amp;gt;

" &amp;lt;&amp;lt; generated struc &amp;gt;&amp;gt;
DATA: ls_dystruc TYPE REF TO data.

" &amp;lt;&amp;lt; generated table &amp;gt;&amp;gt;
DATA: lt_dytable TYPE REF TO data.

" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; field symbols &amp;gt;&amp;gt;

FIELD-SYMBOLS: &amp;lt;lfs_indexfields&amp;gt; TYPE ANY TABLE.

FIELD-SYMBOLS: &amp;lt;lfs_indexfield&amp;gt; TYPE ANY.

FIELD-SYMBOLS: &amp;lt;lfs_db_indexfields&amp;gt; TYPE ztcc_dqm_indices.

" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; objects &amp;gt;&amp;gt;

DATA: lr_struc_type TYPE REF TO cl_abap_structdescr.

DATA: lr_table_type TYPE REF TO cl_abap_tabledescr.


" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; exception &amp;gt;&amp;gt;

DATA: lr_ex TYPE REF TO cx_sy_type_creation.


************************************************************************
* Step 2: &amp;lt;&amp;lt; dynamic struc &amp;gt;&amp;gt;
************************************************************************

" &amp;lt;&amp;lt; set struc fields &amp;gt;&amp;gt;

SELECT *
  FROM ztcc_dqm_indices
    INTO TABLE lt_db_indexfields
      WHERE addr_type EQ 1
        ORDER BY index_order.

" &amp;lt;&amp;lt; get types &amp;gt;&amp;gt;

LOOP AT lt_db_indexfields ASSIGNING &amp;lt;lfs_db_indexfields&amp;gt;.


  ls_component-name =
    &amp;lt;lfs_db_indexfields&amp;gt;-fieldname.
  ls_component-type ?=
     cl_abap_datadescr=&amp;gt;describe_by_name( &amp;lt;lfs_db_indexfields&amp;gt;-fieldtype ).

  APPEND ls_component TO lt_component.

ENDLOOP.


" --------------------------------------------------------------------- "

" &amp;lt;&amp;lt; create struc &amp;gt;&amp;gt;

TRY.

    CALL METHOD cl_abap_structdescr=&amp;gt;create
      EXPORTING
        p_components = lt_component
        p_strict     = abap_true
      RECEIVING
        p_result     = lr_struc_type.

  CATCH cx_sy_struct_creation INTO lr_ex.

    CALL METHOD lr_ex-&amp;gt;if_message~get_text
      RECEIVING
        result = lv_error.

    WRITE: / lv_error.

ENDTRY.

" --------------------------------------------------------------------- "
" &amp;lt;&amp;lt; create table &amp;gt;&amp;gt;

TRY.
    CALL METHOD cl_abap_tabledescr=&amp;gt;create
      EXPORTING
        p_line_type        = lr_struc_type
*        p_table_kind       = tablekind_std
*        p_unique           = abap_false
*        p_key              = p_key_kind
*        keydefkind_default =
      RECEIVING
        p_result           = lr_table_type.
  CATCH cx_sy_table_creation INTO lr_ex.

    CALL METHOD lr_ex-&amp;gt;if_message~get_text
      RECEIVING
        result = lv_error.

    WRITE: / lv_error.
ENDTRY.

" ------------------------------------------------------------------- "

" &amp;lt;&amp;lt; create attributs &amp;gt;&amp;gt;

CREATE DATA: ls_dystruc TYPE HANDLE lr_struc_type.

CREATE DATA: lt_dytable TYPE HANDLE lr_table_type.


************************************************************************
* Step 3: &amp;lt;&amp;lt; dynamic assignment &amp;gt;&amp;gt;
************************************************************************

ASSIGN lt_dytable-&amp;gt;* TO &amp;lt;lfs_indexfields&amp;gt;.

ASSIGN ls_dystruc-&amp;gt;* TO &amp;lt;lfs_indexfield&amp;gt;.


" &amp;lt;&amp;lt; this works &amp;gt;&amp;gt; 
LOOP AT &amp;lt;lfs_indexfields&amp;gt; ASSIGNING &amp;lt;lfs_indexfield&amp;gt;.

ENDLOOP.

" &amp;lt;&amp;lt; i want &amp;gt;&amp;gt; 
READ TABLE lt_dytable 
  INTO ls_dystruc
    WITH KEY .....

. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 10:25:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449848#M1552748</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-09T10:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449849#M1552749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;why don(t you just do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT &amp;lt;lfs_indexfields&amp;gt; ASSIGNING &amp;lt;lfs_indexfield&amp;gt; where field1 eq .....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 10:49:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449849#M1552749</guid>
      <dc:creator>Dasig</dc:creator>
      <dc:date>2010-12-09T10:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449850#M1552750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi saad, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What about performance? &lt;/P&gt;&lt;P&gt;And to refer to my main question. &lt;/P&gt;&lt;P&gt;Is there a generic table type for data declaration? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 11:23:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449850#M1552750</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-09T11:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic table type</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449851#M1552751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Andreas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You may have a look at the Wiki:&lt;/P&gt;&lt;P&gt;[Creating Flat and Complex Internal Tables Dynamically using RTTI|http://wiki.sdn.sap.com/wiki/display/Snippets/Creating&lt;EM&gt;Flat&lt;/EM&gt;and&lt;EM&gt;Complex&lt;/EM&gt;Internal&lt;EM&gt;Tables&lt;/EM&gt;Dynamically&lt;EM&gt;using&lt;/EM&gt;RTTI]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;   Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Dec 2010 11:32:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table-type/m-p/7449851#M1552751</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2010-12-09T11:32:33Z</dc:date>
    </item>
  </channel>
</rss>

