<?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: Total fields in a structure in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288760#M1023077</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  YTEST_READ.

TYPE-POOLS : abap.
DATA : table_des TYPE REF TO cl_abap_structdescr..

DATA : ifields TYPE abap_compdescr_tab,
       wa_field LIKE LINE OF ifields.

data: v_line type i.


PARAMETERS: p_table(30) type c default 'MARA'.


"Table definiton using the table name
 table_des ?= cl_abap_typedescr=&amp;gt;describe_by_name( p_table ).
"Now Read all the fields to a table.
ifields = table_des-&amp;gt;components.


describe table ifields lines v_line.
write v_line.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jul 2008 16:38:13 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-29T16:38:13Z</dc:date>
    <item>
      <title>Total fields in a structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288755#M1023072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way to find out the number of fields in  a structure or an internal table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2008 11:12:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288755#M1023072</guid>
      <dc:creator>former_member654348</dc:creator>
      <dc:date>2008-07-29T11:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Total fields in a structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288756#M1023073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check out the below related thread&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="1563264"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2008 11:15:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288756#M1023073</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-29T11:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Total fields in a structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288757#M1023074</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;try using the FM  'GET_COMPONENT_LIST'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TABLES zpcust.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;no_fields TYPE i,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BEGIN OF field OCCURS 0,&lt;/P&gt;&lt;P&gt;no LIKE rstrucinfo,&lt;/P&gt;&lt;P&gt;END OF field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION 'GET_COMPONENT_LIST'&lt;/P&gt;&lt;P&gt;  EXPORTING&lt;/P&gt;&lt;P&gt;    program    = sy-repid&lt;/P&gt;&lt;P&gt;    fieldname  = 'ZPCUST'&lt;/P&gt;&lt;P&gt;  TABLES&lt;/P&gt;&lt;P&gt;    components = field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DESCRIBE TABLE field LINES fields.&lt;/P&gt;&lt;P&gt;WRITE:/ fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for internal table pass the internal table name insted of structure name in above&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also get the fields info from table DD03L. you can use it also for DDIC structures.&lt;/P&gt;&lt;P&gt;take a itab with a field of type FIELDNAME and in the where condition give the tabname.&lt;/P&gt;&lt;P&gt;and use describe statemnt on this table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;prasanth&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Prasanth Kasturi on Jul 29, 2008 1:49 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2008 11:42:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288757#M1023074</guid>
      <dc:creator>prasanth_kasturi</dc:creator>
      <dc:date>2008-07-29T11:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Total fields in a structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288758#M1023075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using the RTTI classes CL_ABAP_STRUCTDESCR, CL_ABAP_TABLEDESCR.&lt;/P&gt;&lt;P&gt;Sample code is as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA LT_SFLIGHT TYPE TABLE OF SFLIGHT.&lt;/P&gt;&lt;P&gt;DATA LO_TABLEDESCR TYPE REF TO CL_ABAP_TABLEDESCR.&lt;/P&gt;&lt;P&gt;data lo_structdescr type ref to cl_abap_structdescr.&lt;/P&gt;&lt;P&gt;data lt_components type CL_ABAP_STRUCTDESCR=&amp;gt;component_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LO_TABLEDESCR ?= CL_ABAP_TABLEDESCR=&amp;gt;DESCRIBE_BY_DATA( P_DATA = LT_SFLIGHT ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lo_structdescr ?= lo_tabledescr-&amp;gt;GET_TABLE_LINE_TYPE( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lt_components = lo_structdescr-&amp;gt;get_components( ).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2008 11:59:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288758#M1023075</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-29T11:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Total fields in a structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288759#M1023076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pallavi, the FM 'GET_COMPONENT_LIST' will give you a list of fields of your internal table. No of lines in the COMPONENTS table returned to you will be = no of fields in your internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Harsha Lakshminarayanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2008 16:16:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288759#M1023076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-29T16:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: Total fields in a structure</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288760#M1023077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  YTEST_READ.

TYPE-POOLS : abap.
DATA : table_des TYPE REF TO cl_abap_structdescr..

DATA : ifields TYPE abap_compdescr_tab,
       wa_field LIKE LINE OF ifields.

data: v_line type i.


PARAMETERS: p_table(30) type c default 'MARA'.


"Table definiton using the table name
 table_des ?= cl_abap_typedescr=&amp;gt;describe_by_name( p_table ).
"Now Read all the fields to a table.
ifields = table_des-&amp;gt;components.


describe table ifields lines v_line.
write v_line.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jul 2008 16:38:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/total-fields-in-a-structure/m-p/4288760#M1023077</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-29T16:38:13Z</dc:date>
    </item>
  </channel>
</rss>

