<?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 Create a fieldcatalog dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328908#M1537884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to realize a method which creates dynamically a fieldcatalog. The call of the method looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL METHOD me-&amp;gt;describe_struct_for_fcat
    EXPORTING
      im_tab = it_data. "type: data
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a vague idea how to do this:&lt;/P&gt;&lt;P&gt;1. get the type of the im_tab&lt;/P&gt;&lt;P&gt;2. Some kind of loop at the type of the im_tab where filling the row for the fcat and appending it to the fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be pleased if you can post a code snippet or something, which I can copy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking forward to your answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR Fabian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Oct 2010 16:04:26 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-10-07T16:04:26Z</dc:date>
    <item>
      <title>Create a fieldcatalog dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328908#M1537884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to realize a method which creates dynamically a fieldcatalog. The call of the method looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CALL METHOD me-&amp;gt;describe_struct_for_fcat
    EXPORTING
      im_tab = it_data. "type: data
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a vague idea how to do this:&lt;/P&gt;&lt;P&gt;1. get the type of the im_tab&lt;/P&gt;&lt;P&gt;2. Some kind of loop at the type of the im_tab where filling the row for the fcat and appending it to the fcat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would be pleased if you can post a code snippet or something, which I can copy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking forward to your answers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR Fabian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 16:04:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328908#M1537884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T16:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: Create a fieldcatalog dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328909#M1537885</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 the code written in method &lt;STRONG&gt;factory&lt;/STRONG&gt; of class CL_SALV_TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or wait for our friend Marcin till he gives a clear &amp;amp; detailed explanation &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 16:13:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328909#M1537885</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-10-07T16:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create a fieldcatalog dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328910#M1537886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As Keshav T suggested, use the SALV model to generate the ALV for your dynamic table. You can look the program SALV_DEMO_TABLE_SIMPLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 16:52:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328910#M1537886</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2010-10-07T16:52:05Z</dc:date>
    </item>
    <item>
      <title>Re: Create a fieldcatalog dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328911#M1537887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;try this, but note, you will have do figure out how to get the correct length and decimals for field types P or I&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZCA_BOB_CL_ABAP_STRUCTDESCR_X.


Data: r_descr type REF TO cl_abap_structdescr,
      wa_comp TYPE abap_compdescr.


types: begin of wa_int_tab,
        mandt type mandt,
        matnr type matnr,
        werks type WERKS_D,
        lgort type LGORT_D,
        min_qty type MINLF,
       end of wa_int_tab.
data: it_int_tab TYPE STANDARD TABLE OF wa_int_tab.
data: wk_int_tab like LINE OF  it_int_tab.


Data: wk_length(6) type n,
      wk_decimals(6) type n.

START-OF-SELECTION.


 r_descr ?= cl_abap_typedescr=&amp;gt;describe_by_data( wk_int_tab ).

 Loop at r_descr-&amp;gt;components into wa_comp.
   If wa_comp-type_kind = 'C'
   or wa_comp-type_kind = 'D'
   or wa_comp-type_kind = 'N'.
    Divide wa_comp-length by 2.
  Else.
** go out to tables DD03L and  DD04L to get LENG and DECIMALS
  Endif.
   write:/ wa_comp-name,
           wa_comp-type_kind,
           wa_comp-length,
           wa_comp-decimals.

 EndLoop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 19:01:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328911#M1537887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T19:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create a fieldcatalog dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328912#M1537888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thank you so much for your post! That is exactly what i was looking for!! Perfect!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 19:22:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/create-a-fieldcatalog-dynamically/m-p/7328912#M1537888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T19:22:25Z</dc:date>
    </item>
  </channel>
</rss>

