<?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: casting sorted table to standard table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577239#M1565995</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey man..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do this::&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    data gt_sorted type sorted table of mara with unique key matnr.
    data gt_standard type standard table of mara.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    gt_standard[] = gt_sorted[].

    CALL METHOD go_alv_grid-&amp;gt;set_table_for_first_display
    EXPORTING
       is_layout = layout
   CHANGING
      it_outtab = gt_standard[]
      it_fieldcatalog = LT_FIELDCATALOG.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if doesnt work try with gt_standard without [] in the set_table_for_first_display method..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Jan 2011 18:09:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-01-14T18:09:39Z</dc:date>
    <item>
      <title>casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577236#M1565992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i use the method go_alv_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the table going to be passed to that function needs to be type of standard table.&lt;/P&gt;&lt;P&gt;Now, i have a table of type sorted table, and that leads to a type conflict.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there a way to cast my sorted table to a standard table ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for help,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 15:53:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577236#M1565992</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-14T15:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577237#M1565993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Create a standard table with same type and pass the sorted table to standard internal table.e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data : itab_sort type SORTED TABLE OF mara WITH UNIQUE KEY matnr,
          itab_std type TABLE OF mara .

........................................

itab_std = itab_sort. 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 16:00:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577237#M1565993</guid>
      <dc:creator>tushar_shukla</dc:creator>
      <dc:date>2011-01-14T16:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577238#M1565994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;oh i forgot to say, i'm using field symbols, and my table is dynamic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i tried:&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &lt;/P&gt;&lt;P&gt;               &amp;lt;FS_1&amp;gt; TYPE SORTED TABLE,&lt;/P&gt;&lt;P&gt;               &amp;lt;FS_1a&amp;gt; type STANDARD TABLE,...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   &amp;lt;FS_1&amp;gt; =  &amp;lt;FS_1a&amp;gt;. &lt;/P&gt;&lt;P&gt;   CALL METHOD go_alv_grid-&amp;gt;set_table_for_first_display&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        is_layout       = layout&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        it_outtab       = &amp;lt;FS_1a&amp;gt;&lt;/P&gt;&lt;P&gt;        it_fieldcatalog = LT_FIELDCATALOG.&lt;/P&gt;&lt;P&gt;+&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it does not work &lt;SPAN __jive_emoticon_name="sad"&gt;&lt;/SPAN&gt;, i still get a exception&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 16:14:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577238#M1565994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-14T16:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577239#M1565995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hey man..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do this::&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    data gt_sorted type sorted table of mara with unique key matnr.
    data gt_standard type standard table of mara.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    gt_standard[] = gt_sorted[].

    CALL METHOD go_alv_grid-&amp;gt;set_table_for_first_display
    EXPORTING
       is_layout = layout
   CHANGING
      it_outtab = gt_standard[]
      it_fieldcatalog = LT_FIELDCATALOG.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if doesnt work try with gt_standard without [] in the set_table_for_first_display method..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it works!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 18:09:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577239#M1565995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-14T18:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577240#M1565996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your brackets are redundant in that statement based on the definition and it doesn't solve the requirement to be dynamic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To the OP, you didn't mention the exception type but you haven't shown very much code or how your field symbols get assigned.  At some point, order to get the code to compile or execute dynamically without exception, you need to provide a named external or internal type in order to use a data reference or the RTTS classes to make that move.  Without some link back to the line type and sort key (whether it's 'default' or not), it's not going to work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 18:42:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577240#M1565996</guid>
      <dc:creator>brad_bohn</dc:creator>
      <dc:date>2011-01-14T18:42:38Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577241#M1565997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sven,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say your sorted table is assigned to &amp;lt;TSORT&amp;gt;, then I would do&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;field-symbols:
  &amp;lt;rec&amp;gt;     type any.
  &amp;lt;TSTD&amp;gt; type table.
data:
  lr_data type ref to data.
* read any record of sorted table
read table &amp;lt;tsort&amp;gt; assigning &amp;lt;rec&amp;gt; index 1.
* make surte table isn't empty
check sy-subrc = 0.
* create standard table of this structure
create data lr_data like table of &amp;lt;rec&amp;gt;.
* assign to field-symbol
assign lr_data-&amp;gt;* to &amp;lt;TSTD&amp;gt;.
* move sorted to standard table
&amp;lt;TSTD&amp;gt; = &amp;lt;TSORT&amp;gt;.
* free unuesed memory (optional)
free &amp;lt;TSORT&amp;gt;.
* grid display &amp;lt;TSTD&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Jan 2011 23:44:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577241#M1565997</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2011-01-14T23:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577242#M1565998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need the standard table to be defined even if the sorted table is empty, use:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: lr_data TYPE REF TO DATA.

FIELD-SYMBOLS: &amp;lt;ls_record&amp;gt; TYPE ANY,
             &amp;lt;lt_standard&amp;gt; TYPE STANDARD TABLE.

CREATE DATA lr_data LIKE LINE OF &amp;lt;sorted_table&amp;gt;.
ASSIGN lr_data-&amp;gt;* TO &amp;lt;ls_record&amp;gt;:

CREATE DATA lr_data LIKE STANDARD TABLE OF &amp;lt;ls_record&amp;gt;.
ASSIGN lr_data-&amp;gt;* TO &amp;lt;lt_standard&amp;gt;.

&amp;lt;lt_standard&amp;gt; = &amp;lt;lt_sorted&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you ever go the other way - from a standard table to a sorted or hashed, or a hashed to a sorted, or sorted to a hashed, or a sorted/hashed table with a different key, use&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT LINES OF &amp;lt;source_table&amp;gt; INTO TABLE &amp;lt;destination_table&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;matt&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 15 Jan 2011 08:02:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577242#M1565998</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2011-01-15T08:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: casting sorted table to standard table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577243#M1565999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jan 2011 02:53:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/casting-sorted-table-to-standard-table/m-p/7577243#M1565999</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-19T02:53:24Z</dc:date>
    </item>
  </channel>
</rss>

