<?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: How to create a generic TYPES? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850940#M1134450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;Please Follow this link where you have full details about creation of generic types:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Hope This helps,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rahul Sinha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 28 Nov 2008 08:11:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-28T08:11:51Z</dc:date>
    <item>
      <title>How to create a generic TYPES?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850939#M1134449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i try to do is following&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;when i call my function the user has the possibility to check the flag "show_button = 'X', and exports a table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when this flag is checked i want to display an icon in the first row of this table, so i need to extend the table structure which i import and add another attribute.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what i actually tried to achieve is this (but this is not working of course)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function&lt;/P&gt;&lt;P&gt; import:&lt;/P&gt;&lt;P&gt;      i_outtab type standard table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;field-symbols:
      &amp;lt;itab&amp;gt; type standard table.

assign i_outtab to &amp;lt;itab&amp;gt;.

TYPES: begin of mytyp.
   types: i_bt type iconname.
  INCLUDE STRUCTURE &amp;lt;itab&amp;gt;
TYPES: end of mytyp.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then i create a table with the type mytyp (which is not working, but i shows what i try to do)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so is there a way to do this genericly?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 07:43:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850939#M1134449</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T07:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a generic TYPES?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850940#M1134450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thomas,&lt;/P&gt;&lt;P&gt;Please Follow this link where you have full details about creation of generic types:&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Hope This helps,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rahul Sinha.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 08:11:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850940#M1134450</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T08:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a generic TYPES?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850941#M1134451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use &lt;STRONG&gt;field-symbols:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;&amp;lt;itab&amp;gt; type any table&lt;/STRONG&gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 08:24:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850941#M1134451</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T08:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a generic TYPES?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850942#M1134452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Since your import parameter is a generic type, you can pass back another table of any type with the icon field included. You can take look at the example BCALV_TABLE_CREATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a method called &lt;STRONG&gt;create_dynamic_table&lt;/STRONG&gt; of the class &lt;STRONG&gt;cl_alv_table_create&lt;/STRONG&gt; to which you can pass the fieldcatalog. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now this field catalog you can prepare by first getting the components of the table that is passed to the function module using the cl_abap_structdescr &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Something like this :&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA : BEGIN OF t_comp OCCURS 0,
        comp(5) TYPE c,
       END OF t_comp.
DATA : l_struc TYPE REF TO cl_abap_structdescr.
DATA : l_typedesc TYPE REF TO cl_abap_typedescr.
DATA : lt_comp TYPE abap_compdescr_tab,
       w_comp LIKE LINE OF lt_comp.

*Call the static method of the structure descriptor describe_by_data
CALL METHOD cl_abap_structdescr=&amp;gt;describe_by_data
  EXPORTING
    p_data      = &amp;lt;itab&amp;gt;  " In your case.
  RECEIVING
    p_descr_ref = l_typedesc.

*The method returns a reference of  a type descriptor class therefore we
*need to Cast the type descriptor to a more specific class i.e
*Structure Descriptor.
l_struc ?= l_typedesc.

*Use the Attribute COMPONENTS of the structure Descriptor class to get
*the field names of the structure
lt_comp = l_struc-&amp;gt;components.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you can build the fieldcatalog based on the components of the input table and adding the icon field as follows : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. First add the icon field to the fieldcatalog. &lt;/P&gt;&lt;P&gt;2. Then looping at the components populate other fields of the table.&lt;/P&gt;&lt;P&gt;LOOP AT lt_comp INTO w_comp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then call the cl_alv_table_create method by passing the fieldcatalog. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Advait&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 08:34:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850942#M1134452</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T08:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a generic TYPES?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850943#M1134453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i know this way to create types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but i want to create a type out of the structure i_outtab (which is the type standard table of)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then i want to extend this type individually.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;...like merging to table structures into one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 08:39:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850943#M1134453</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T08:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a generic TYPES?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850944#M1134454</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can do that using the ABAP Run Time Type Services.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a function module Y_TEST with one Importing Parameter:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*"----------------------------------------------------------------------
*"  IMPORTING
*"     REFERENCE(IP_IT_DATA) TYPE  ANY TABLE
*"----------------------------------------------------------------------
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no idea about the table-structure and I want to add a field X_SELECTED of type XFELD to the end of the table to display it using CL_SALV_TABLE or something - this is how I do it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION y_test.
*"----------------------------------------------------------------------
*"  IMPORTING
*"     REFERENCE(IP_IT_DATA) TYPE  ANY TABLE
*"----------------------------------------------------------------------

  DATA:
    gr_tabtype TYPE REF TO cl_abap_tabledescr,
    gr_struc   TYPE REF TO cl_abap_structdescr,
    lr_itab    TYPE REF TO data,

    it_component TYPE cl_abap_structdescr=&amp;gt;component_table,
    wa_component LIKE LINE OF it_component.

  FIELD-SYMBOLS:
    &amp;lt;wa&amp;gt; TYPE ANY.

* Reading 1st line of itab and getting structure -&amp;gt;
  LOOP AT ip_it_data ASSIGNING &amp;lt;wa&amp;gt;.
    gr_struc ?= cl_abap_typedescr=&amp;gt;describe_by_data( &amp;lt;wa&amp;gt; ).
    EXIT.
  ENDLOOP. "ip_it_data

* Getting all components -&amp;gt;
  CHECK gr_struc IS BOUND.
  it_component = gr_struc-&amp;gt;get_components( ).

* Adding new field (X_SELECTED) to Component-Table -&amp;gt;
  wa_component-name = 'X_SELECTED'.
  wa_component-type ?= cl_abap_typedescr=&amp;gt;describe_by_name( 'XFELD ').
  INSERT wa_component INTO TABLE it_component.

* Creating new structure-ref -&amp;gt;
  CLEAR gr_struc.
      CALL METHOD cl_abap_structdescr=&amp;gt;create
        EXPORTING
          p_components = it_component
        RECEIVING
          p_result     = gr_struc.

* Creating new table-ref -&amp;gt;
      CALL METHOD cl_abap_tabledescr=&amp;gt;create
        EXPORTING
          p_line_type  = gr_struc
        RECEIVING
          p_result     = gr_tabtype.

* Creating itab with our table-ref -&amp;gt;
  CREATE DATA lr_itab TYPE HANDLE gr_tabtype.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helped ...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Nov 2008 11:21:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-create-a-generic-types/m-p/4850944#M1134454</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-28T11:21:38Z</dc:date>
    </item>
  </channel>
</rss>

