<?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: sorted table... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289833#M154996</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;proper indexing&amp;lt;/b&amp;gt; and maitain &amp;lt;b&amp;gt;same sequence&amp;lt;/b&amp;gt;(like DATABASE). Use only field which are required instead of &amp;lt;b&amp;gt;*&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;Then use &amp;lt;b&amp;gt;sort on only those field which required&amp;lt;/b&amp;gt; coz it will degrade the perfomance. &lt;/P&gt;&lt;P&gt;Remove &amp;lt;b&amp;gt;Nested loop&amp;lt;/b&amp;gt; instead of it use &amp;lt;b&amp;gt;Read&amp;lt;/b&amp;gt; statement becuae u r using same interna table.&lt;/P&gt;&lt;P&gt;Use&amp;lt;b&amp;gt; binary seach&amp;lt;/b&amp;gt; in Read statament.&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;modify with transporting&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;delete statement&amp;lt;/b&amp;gt; before other and write &amp;lt;b&amp;gt;continue&amp;lt;/b&amp;gt; after delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will be useful.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 13 Mar 2006 06:49:45 GMT</pubDate>
    <dc:creator>vinod_gunaware2</dc:creator>
    <dc:date>2006-03-13T06:49:45Z</dc:date>
    <item>
      <title>sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289829#M154992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am recently having a problem in sorting an itab because it contains almost 3 million records and I'm thinking if I just make it a sorted table. Now, how can I make a table based on this sort: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT t_ztm0019_tmp BY sernr datum DESCENDING uzeit DESCENDING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the structure of my itab:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF t_ztm0019 OCCURS 0.&lt;/P&gt;&lt;P&gt;        INCLUDE STRUCTURE ztm0019.&lt;/P&gt;&lt;P&gt;DATA: END OF t_ztm0019.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And here is the complete code below. When I try to run it in prod server it produces a run time error. Any help would really be appreciated. Thanks a lot guys!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*get all records from table ztm0019 and append to itab.&lt;/P&gt;&lt;P&gt;  SELECT * FROM ztm0019&lt;/P&gt;&lt;P&gt;  APPENDING TABLE t_ztm0019.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*populate itab t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;  t_ztm0019_tmp[] = t_ztm0019[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR t_ztm0019[].&lt;/P&gt;&lt;P&gt;*sort itab according to latest date and time grouped by serial no.&lt;/P&gt;&lt;P&gt;  SORT t_ztm0019_tmp BY sernr datum DESCENDING uzeit DESCENDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM t_ztm0019_tmp COMPARING&lt;/P&gt;&lt;P&gt;                                                         sernr&lt;/P&gt;&lt;P&gt;                                                         bwart&lt;/P&gt;&lt;P&gt;                                                         mblnr.&lt;/P&gt;&lt;P&gt;  LOOP AT t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;*read first record from itab.&lt;/P&gt;&lt;P&gt;    READ TABLE t_ztm0019_tmp INDEX sy-index.&lt;/P&gt;&lt;P&gt;    IF t_ztm0019_tmp-bwart EQ '702'&lt;/P&gt;&lt;P&gt;      OR t_ztm0019_tmp-bwart EQ '708'&lt;/P&gt;&lt;P&gt;      OR t_ztm0019_tmp-bwart EQ '712'&lt;/P&gt;&lt;P&gt;      OR t_ztm0019_tmp-bwart EQ '718'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT t_ztm0019_tmp WHERE sernr = t_ztm0019_tmp-sernr.&lt;/P&gt;&lt;P&gt;        APPEND t_ztm0019_tmp TO t_ztm_acc_variance.&lt;/P&gt;&lt;P&gt;        CLEAR  t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;        DELETE t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      APPEND t_ztm0019_tmp TO t_ztm0019.&lt;/P&gt;&lt;P&gt;      CLEAR t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;      DELETE t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    CONTINUE.      " Go for next SERNR&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*inserts or updates records in db table ztm_acc_variance based on itab&lt;/P&gt;&lt;P&gt;  MODIFY ztm_acc_variance FROM TABLE t_ztm_acc_variance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*inserts or update unaccounted variances from itab&lt;/P&gt;&lt;P&gt;  MODIFY ztm0019 FROM TABLE t_ztm0019.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*deletes records from db table ztm0019 based on matching entries in itab&lt;/P&gt;&lt;P&gt;  DELETE ztm0019 FROM TABLE t_ztm_acc_variance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:17:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289829#M154992</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-03-13T06:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289830#M154993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Viraylab,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can sort the table while fetching data from database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just try this statement and remove sort statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ztm0019&lt;/P&gt;&lt;P&gt;APPENDING TABLE t_ztm0019&lt;/P&gt;&lt;P&gt;order by sernr ASCENDING datum DESCENDING uzeit DESCENDING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Abhijit Dey.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:38:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289830#M154993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T06:38:58Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289831#M154994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Abhiijit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wouldnt that be much slower?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:44:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289831#M154994</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-03-13T06:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289832#M154995</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If your internal table is going to contain huge data,&lt;/P&gt;&lt;P&gt;you can go for Hashed tables instead of standard or dorted table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hashed tables have theier own Hashed algorithm, which makes it possible to process the internal table irrespective of number of records.&lt;/P&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;Shashank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:44:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289832#M154995</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T06:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289833#M154996</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;proper indexing&amp;lt;/b&amp;gt; and maitain &amp;lt;b&amp;gt;same sequence&amp;lt;/b&amp;gt;(like DATABASE). Use only field which are required instead of &amp;lt;b&amp;gt;*&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;Then use &amp;lt;b&amp;gt;sort on only those field which required&amp;lt;/b&amp;gt; coz it will degrade the perfomance. &lt;/P&gt;&lt;P&gt;Remove &amp;lt;b&amp;gt;Nested loop&amp;lt;/b&amp;gt; instead of it use &amp;lt;b&amp;gt;Read&amp;lt;/b&amp;gt; statement becuae u r using same interna table.&lt;/P&gt;&lt;P&gt;Use&amp;lt;b&amp;gt; binary seach&amp;lt;/b&amp;gt; in Read statament.&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;modify with transporting&amp;lt;/b&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use &amp;lt;b&amp;gt;delete statement&amp;lt;/b&amp;gt; before other and write &amp;lt;b&amp;gt;continue&amp;lt;/b&amp;gt; after delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will be useful.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:49:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289833#M154996</guid>
      <dc:creator>vinod_gunaware2</dc:creator>
      <dc:date>2006-03-13T06:49:45Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289834#M154997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Abhiijit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wouldnt that be much slower?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:50:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289834#M154997</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-03-13T06:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289835#M154998</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;if the no. of records to process are too huge its better to go for FIELD-GROUPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:51:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289835#M154998</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-03-13T06:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289836#M154999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Viraylab,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have to test it this option. It completely depends upon the Memory of the Database Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise you have to split the query based on SERNR and sort the table and at last append all splitted table in a single one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Abhijit Dey&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 06:58:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289836#M154999</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T06:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289837#M155000</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; In ur select query &lt;/P&gt;&lt;P&gt;1.&lt;/P&gt;&lt;P&gt;  Try to differentiate the select process by &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select f1 f2 f3 f4 and so on &lt;/P&gt;&lt;P&gt;Where clause &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Order by sernr bwart mblnr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.this reduces the sort criteria means to say u need not again sort explicitly on some fields .&lt;/P&gt;&lt;P&gt;Instead of READ TABLE t_ztm0019_tmp INDEX sy-index &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use READ TABLE t_ztm0019_tmp with key f1  = t_ztm0019_tmp-f1 &lt;/P&gt;&lt;P&gt;                                                                      F2 = t_ztm0019_tmp-f2&lt;/P&gt;&lt;P&gt;                                                                      F3 = t_ztm0019_tmp-f3.&lt;/P&gt;&lt;P&gt;3.&lt;/P&gt;&lt;P&gt;IF t_ztm0019_tmp-bwart EQ '702'&lt;/P&gt;&lt;P&gt;OR t_ztm0019_tmp-bwart EQ '708'&lt;/P&gt;&lt;P&gt;OR t_ztm0019_tmp-bwart EQ '712'&lt;/P&gt;&lt;P&gt;OR t_ztm0019_tmp-bwart EQ '718'.&lt;/P&gt;&lt;P&gt;  &lt;/P&gt;&lt;P&gt; I think this can be eliminated if u can make proper use of read statement as the comparisions can be brought in itself here .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4 LOOP AT t_ztm0019_tmp WHERE sernr = t_ztm0019_tmp-sernr. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Loop in loop is not advisable when u r dealing with 3 million or more records as this will degrade the performance .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   Instead of this use the condition in read itself .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          READ TABLE t_ztm0019_tmp with key sernr  = t_ztm0019_tmp-sernr .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If sy-subrc &amp;#150; 0.&lt;/P&gt;&lt;P&gt;APPEND t_ztm0019_tmp TO t_ztm_acc_variance.&lt;/P&gt;&lt;P&gt;CLEAR t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else .&lt;/P&gt;&lt;P&gt;APPEND t_ztm0019_tmp TO t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;Clear t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. modify the changes and run the performance repeated ly and check the same .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. use code inspector to get the appropriate sequence .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps .&lt;/P&gt;&lt;P&gt;Vijay.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 07:25:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289837#M155000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T07:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289838#M155001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Viray,&lt;/P&gt;&lt;P&gt;  &amp;lt;b&amp;gt;You cannot sort a sorted table using the SORT statement&amp;lt;/b&amp;gt;. The system always maintains these&lt;/P&gt;&lt;P&gt;tables automatically by their sort order..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If an internal table is statically recognizable as a sorted table, the SORT statement causes a syntax error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; If the table is a generic sorted table, the&lt;/P&gt;&lt;P&gt;SORT statement causes a runtime error if the sort key is not the same as an extract of the&lt;/P&gt;&lt;P&gt;beginning of the table key, you sort in descending order, or use the AS TEXT addition.. with SORT&lt;/P&gt;&lt;P&gt; In other words, the SORT statement is only allowed for generic internal tables, if it does not violate the&lt;/P&gt;&lt;P&gt;internal sort order..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;satesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 08:02:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289838#M155001</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T08:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289839#M155002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello satesh, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The table is not sorted as you can see from my code.It is a standard table.I just modified my program that instead of doing:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort t_ztm0019_tmp by sernr datum descending uzeit descending&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ztm0019&lt;/P&gt;&lt;P&gt;  APPENDING TABLE t_ztm0019&lt;/P&gt;&lt;P&gt;  ORDER BY sernr&lt;/P&gt;&lt;P&gt;           datum DESCENDING&lt;/P&gt;&lt;P&gt;           uzeit DESCENDING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope this would work. Also, the structure of the internal table is like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF t_ztm0019_tmp OCCURS 0.&lt;/P&gt;&lt;P&gt;        INCLUDE STRUCTURE ztm0019.&lt;/P&gt;&lt;P&gt;DATA: END OF t_ztm0019_tmp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, how can I decalre this as an sorted table so I can remove my sort statement?Thanks a lot guys and take care!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 08:19:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289839#M155002</guid>
      <dc:creator>aris_hidalgo</dc:creator>
      <dc:date>2006-03-13T08:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: sorted table...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289840#M155003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA gt_list_2         LIKE SORTED TABLE OF list_2                WITH UNIQUE KEY &amp;lt;field1&amp;gt;.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Mar 2006 08:22:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sorted-table/m-p/1289840#M155003</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-13T08:22:51Z</dc:date>
    </item>
  </channel>
</rss>

