<?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: Dynamic Table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550122#M249627</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;HI

  Welcome to SDN.

  Hope the below code will help you.


data: gt_fieldcat type LVC_T_FCAT,
      gt_table type ref to data.
data: ls_fieldcat type lvc_s_fcat.

field-symbols: &amp;lt;gt_table&amp;gt; type table.

data: it_dfies like dfies occurs 0 with header line,
      lv_table type ddobjname.

select single kotab from t681 into lv_table
       where kvewe = 'A' and kotabnr = '005' and kappl = 'V'.

CALL FUNCTION 'DDIF_NAMETAB_GET'
  EXPORTING
    TABNAME           = lv_table
 TABLES
   DFIES_TAB         = it_dfies
 EXCEPTIONS
   NOT_FOUND         = 1
   OTHERS            = 2.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
ENDIF.

  loop at it_dfies.
       ls_fieldcat-fieldname = it_dfies-fieldname.
       ls_fieldcat-inttype = it_dfies-inttype.
       ls_fieldcat-outputlen = it_dfies-outputlen.
       append ls_fieldcat to gt_fieldcat.
  endloop.


CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
  EXPORTING
    it_fieldcatalog = gt_fieldcat
  IMPORTING
    ep_table        = gt_table.

ASSIGN gt_table-&amp;gt;* TO &amp;lt;gt_table&amp;gt;.

  SELECT *
  FROM (lv_table)
  into table &amp;lt;gt_table&amp;gt;.

loop at &amp;lt;gt_table&amp;gt; assigning &amp;lt;wa_table&amp;gt;.
  l_num = 1.
  do.
   assign component l_num of structure &amp;lt;wa_table&amp;gt; to &amp;lt;temp&amp;gt;.
   if sy-subrc eq 0.
   write: &amp;lt;temp&amp;gt;.
   l_num = l_num + 1.
   else.
   exit.
   endif.
 enddo.
endloop.

Kind Regards
Eswar&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Eswar Rao  Boddeti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Aug 2006 02:01:29 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-30T02:01:29Z</dc:date>
    <item>
      <title>Dynamic Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550121#M249626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created a dynamic table. I could like to read the component name of the dynamic table. How should i do this.&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;Regards,&lt;/P&gt;&lt;P&gt;Swarna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Aug 2006 01:56:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550121#M249626</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-30T01:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550122#M249627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;HI

  Welcome to SDN.

  Hope the below code will help you.


data: gt_fieldcat type LVC_T_FCAT,
      gt_table type ref to data.
data: ls_fieldcat type lvc_s_fcat.

field-symbols: &amp;lt;gt_table&amp;gt; type table.

data: it_dfies like dfies occurs 0 with header line,
      lv_table type ddobjname.

select single kotab from t681 into lv_table
       where kvewe = 'A' and kotabnr = '005' and kappl = 'V'.

CALL FUNCTION 'DDIF_NAMETAB_GET'
  EXPORTING
    TABNAME           = lv_table
 TABLES
   DFIES_TAB         = it_dfies
 EXCEPTIONS
   NOT_FOUND         = 1
   OTHERS            = 2.
IF SY-SUBRC &amp;lt;&amp;gt; 0.
ENDIF.

  loop at it_dfies.
       ls_fieldcat-fieldname = it_dfies-fieldname.
       ls_fieldcat-inttype = it_dfies-inttype.
       ls_fieldcat-outputlen = it_dfies-outputlen.
       append ls_fieldcat to gt_fieldcat.
  endloop.


CALL METHOD cl_alv_table_create=&amp;gt;create_dynamic_table
  EXPORTING
    it_fieldcatalog = gt_fieldcat
  IMPORTING
    ep_table        = gt_table.

ASSIGN gt_table-&amp;gt;* TO &amp;lt;gt_table&amp;gt;.

  SELECT *
  FROM (lv_table)
  into table &amp;lt;gt_table&amp;gt;.

loop at &amp;lt;gt_table&amp;gt; assigning &amp;lt;wa_table&amp;gt;.
  l_num = 1.
  do.
   assign component l_num of structure &amp;lt;wa_table&amp;gt; to &amp;lt;temp&amp;gt;.
   if sy-subrc eq 0.
   write: &amp;lt;temp&amp;gt;.
   l_num = l_num + 1.
   else.
   exit.
   endif.
 enddo.
endloop.

Kind Regards
Eswar&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Eswar Rao  Boddeti&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Aug 2006 02:01:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550122#M249627</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-30T02:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550123#M249628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you requirement is to be able to read back the components of the dynamic internal table that  you created, you can do something like this.  I have taken Eswar's example and expanded on it a little.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0001.

data: gt_fieldcat type lvc_t_fcat,
      gt_table type ref to data.
data: ls_fieldcat type lvc_s_fcat.

field-symbols: &amp;lt;gt_table&amp;gt; type table.

data: it_dfies like dfies occurs 0 with header line,
&amp;lt;b&amp;gt;      lv_table type ddobjname value 'T001'.&amp;lt;/b&amp;gt;




call function 'DDIF_NAMETAB_GET'
     exporting
          tabname   = lv_table
     tables
          dfies_tab = it_dfies
     exceptions
          not_found = 1
          others    = 2.
if sy-subrc &amp;lt;&amp;gt; 0.
endif.

loop at it_dfies.
  ls_fieldcat-fieldname = it_dfies-fieldname.
  ls_fieldcat-inttype = it_dfies-inttype.
  ls_fieldcat-outputlen = it_dfies-outputlen.
  append ls_fieldcat to gt_fieldcat.
endloop.


call method cl_alv_table_create=&amp;gt;create_dynamic_table
  exporting
    it_fieldcatalog = gt_fieldcat
  importing
    ep_table        = gt_table.

assign gt_table-&amp;gt;* to &amp;lt;gt_table&amp;gt;.

select *
from (lv_table)
into table &amp;lt;gt_table&amp;gt;.

&amp;lt;b&amp;gt;data:  descr_ref type ref to cl_abap_typedescr.
data:  descrt_ref type ref to cl_abap_tabledescr.
data:  descr_key type abap_keydescr.

descr_ref = cl_abap_typedescr=&amp;gt;describe_by_data( &amp;lt;gt_table&amp;gt; ).
descrt_ref ?= descr_ref.

loop at descrt_ref-&amp;gt;key into descr_key.
  write:/ descr_key-name.
endloop.&amp;lt;/b&amp;gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REgards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Aug 2006 02:25:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-table/m-p/1550123#M249628</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-08-30T02:25:55Z</dc:date>
    </item>
  </channel>
</rss>

