<?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: type any in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293443#M788104</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anuj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Use FIELD SYMBLes for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;gf_table&amp;gt; TYPE ANY TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jan 2008 09:02:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-21T09:02:01Z</dc:date>
    <item>
      <title>type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293441#M788102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi colleagues,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can you please let me know how can i build a line type from a dynamic table of type any..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i mean i have a dynamic table at runtime which is of type any.. can i build a line type because i need to loop thru this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anuj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 08:54:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293441#M788102</guid>
      <dc:creator>former_member196517</dc:creator>
      <dc:date>2008-01-21T08:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293442#M788103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Given that you already have a field-symbol pointing at your original type named: &amp;lt;orgTable&amp;gt; and it also assumes that your table's row type is a structure, it wouldn't be too hard to modify it to support other types of line types. The following should work (although haven't tried it in the ABAP ide):&lt;/P&gt;&lt;P&gt;code&lt;/P&gt;&lt;P&gt;data lineType type ref to cl_abap_structdescr.&lt;/P&gt;&lt;P&gt;data tableType type ref to cl_abap_tabledescr.&lt;/P&gt;&lt;P&gt;data componentTable type component_table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tableType ?= cl_abap_tabledescr=&amp;gt;describe_by_data( &amp;lt;orgType&amp;gt; ).&lt;/P&gt;&lt;P&gt;lineType ?= tableType-&amp;gt;get_table_line_type( ).&lt;/P&gt;&lt;P&gt;componentTable = lineType-&amp;gt;get_components( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append your additional type here. &lt;/P&gt;&lt;P&gt;append fooType to componentTable. &lt;/P&gt;&lt;P&gt;lineType ?= cl_abap_structDescr=&amp;gt;create( componentTable ).&lt;/P&gt;&lt;P&gt;tableType = cl_abap_tabledescr=&amp;gt;create( lineType ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now create your new data area. &lt;/P&gt;&lt;P&gt;data newTable type ref to data.&lt;/P&gt;&lt;P&gt;field-symbol &amp;lt;newTable&amp;gt; type standard table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data newTable handle tableType.&lt;/P&gt;&lt;P&gt;assign newTable-&amp;gt;* to &amp;lt;newTable&amp;gt;.&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Parminder Singh Saluja on Jan 21, 2008 10:47 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 08:57:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293442#M788103</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-21T08:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293443#M788104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Anuj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Use FIELD SYMBLes for this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS : &amp;lt;gf_table&amp;gt; TYPE ANY TABLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't forget to reward if useful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 09:02:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293443#M788104</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-21T09:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293444#M788105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;good&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check the below code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i understand you correctly you are looking to take a table generated dynamically and add another column to it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Given that you already have a field-symbol pointing at your original type named: &amp;lt;orgTable&amp;gt; and it also assumes that your table's row type is a structure, it wouldn't be too hard to modify it to support other types of line types. The following should work (although haven't tried it in the ABAP ide):&lt;/P&gt;&lt;P&gt;code&lt;/P&gt;&lt;P&gt;data lineType type ref to cl_abap_structdescr.&lt;/P&gt;&lt;P&gt;data tableType type ref to cl_abap_tabledescr.&lt;/P&gt;&lt;P&gt;data componentTable type component_table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tableType ?= cl_abap_tabledescr=&amp;gt;describe_by_data( &amp;lt;orgType&amp;gt; ).&lt;/P&gt;&lt;P&gt;lineType ?= tableType-&amp;gt;get_table_line_type( ).&lt;/P&gt;&lt;P&gt;componentTable = lineType-&amp;gt;get_components( ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append your additional type here. &lt;/P&gt;&lt;P&gt;append fooType to componentTable. &lt;/P&gt;&lt;P&gt;lineType ?= cl_abap_structDescr=&amp;gt;create( componentTable ).&lt;/P&gt;&lt;P&gt;tableType = cl_abap_tabledescr=&amp;gt;create( lineType ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now create your new data area. &lt;/P&gt;&lt;P&gt;data newTable type ref to data.&lt;/P&gt;&lt;P&gt;field-symbol &amp;lt;newTable&amp;gt; type standard table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data newTable handle tableType.&lt;/P&gt;&lt;P&gt;assign newTable-&amp;gt;* to &amp;lt;newTable&amp;gt;.&lt;/P&gt;&lt;P&gt;[/code]&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;mrutyun^&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 09:19:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293444#M788105</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-21T09:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293445#M788106</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;thanks for reply,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;however my problem is that i am in function module which imports a table of type any.. i want to loop thru this now.. how is it possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anuj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 09:33:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293445#M788106</guid>
      <dc:creator>former_member196517</dc:creator>
      <dc:date>2008-01-21T09:33:10Z</dc:date>
    </item>
    <item>
      <title>Re: type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293446#M788107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't know the names or number of components then do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;wa&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;fld&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;DATA fld_count TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT fm_table ASSIGNING &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i = 1.&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  ASSIGN COMPONENT i OF STRUCTURE &amp;lt;wa&amp;gt; TO &amp;lt;fld&amp;gt;.&lt;/P&gt;&lt;P&gt;  IF sy-subrc IS NOT INITIAL:&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;...&amp;lt;fld&amp;gt; contains the value of the ith component of the current record of fm_table.&lt;/P&gt;&lt;P&gt;ENDDO.&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;If you do know the names of the components&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;wa&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS &amp;lt;fld&amp;gt; TYPE ANY.&lt;/P&gt;&lt;P&gt;DATA: lp_data TYPE REF TO DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE DATA lp_data LIKE LINE OF fm_table.&lt;/P&gt;&lt;P&gt;ASSIGN lp_data-&amp;gt;* TO &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ASSIGN COMPONENT (name or number) OF STRUCTURE &amp;lt;wa&amp;gt; TO &amp;lt;fld&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT fm_table INTO &amp;lt;wa&amp;gt;.&lt;/P&gt;&lt;P&gt;... &amp;lt;fld&amp;gt; contains the value of the component assigned above, in the current record of fm_table.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jan 2008 09:46:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293446#M788107</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2008-01-21T09:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: type any</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293447#M788108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Anuj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got exactly the same problem. I solved it (partially based on Parminder's code, thanks for that!) this way:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION ZANYTAB.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_ANYTAB) TYPE  ANY TABLE
*"----------------------------------------------------------------------

* Declarations
  DATA: descr_ref   TYPE ref to cl_abap_typedescr,
        descr_table TYPE ref to cl_abap_tabledescr,
        descr_struc TYPE ref to cl_abap_structdescr.

  FIELD-SYMBOLS: &amp;lt;comp_wa&amp;gt; TYPE abap_compdescr.

  descr_ref = cl_abap_typedescr=&amp;gt;describe_by_data( I_ANYTAB ).
  descr_table ?= ls_descr_ref.
  descr_struc ?= descr_table-&amp;gt;get_table_line_type( ).

  LOOP AT descr_struc-&amp;gt;components ASSIGNING &amp;lt;comp_wa&amp;gt;.
    WRITE: / &amp;lt;comp_wa&amp;gt;-name, &amp;lt;comp_wa&amp;gt;-type_kind,
             &amp;lt;comp_wa&amp;gt;-length, &amp;lt;comp_wa&amp;gt;-decimals.
  ENDLOOP.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bernd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Feb 2008 07:35:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/type-any/m-p/3293447#M788108</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-05T07:35:52Z</dc:date>
    </item>
  </channel>
</rss>

