<?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: Sort on Internal Table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415251#M199803</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would need to transfer the data into another internal table and apply the SORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Jul 2006 13:05:01 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-07-19T13:05:01Z</dc:date>
    <item>
      <title>Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415245#M199797</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;I am new to ABAP. This is an Inbound ABAP Proxy written for XI implementation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Trying to do a SORT on 2 fields in the table on the resultset row based on a field in &amp;lt;b&amp;gt;wa_data_records-FTL_TimeStamp&amp;lt;/b&amp;gt; and &amp;lt;b&amp;gt;wa_data_records-FTL_ActionType&amp;lt;/b&amp;gt;. Trying to explore on the sort by on the above fields. If anyone has any quick suggestions i would really appreciate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have laid out the program below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the program i have:&lt;/P&gt;&lt;P&gt;DATA: i_zta TYPE TABLE OF zta_freight.&lt;/P&gt;&lt;P&gt;DATA: wa_zta LIKE LINE OF i_zta.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: wa_data_records TYPE LINE OF zresultset_row_tab1.&lt;/P&gt;&lt;P&gt;DATA: d_numberrange TYPE i.&lt;/P&gt;&lt;P&gt;DATA: wa_t005f TYPE t005f.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Loop at internal table into work area.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT input-resultset-row INTO wa_data_records.&lt;/P&gt;&lt;P&gt;     d_numberrange = d_numberrange + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                wa_ztamko-VSTEL = wa_data_records-WHSE.&lt;/P&gt;&lt;P&gt;                wa_ztamko-REGIO = wa_data_records-DEST_STATE.&lt;/P&gt;&lt;P&gt;                wa_ztamko-ORT01 = wa_data_records-DEST_CITY.&lt;/P&gt;&lt;P&gt;                wa_ztamko-ZZ_MILEAGE = wa_data_records-MILEAGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;                SELECT SINGLE * FROM t005f INTO wa_t005f WHERE spras = sy-langu&lt;/P&gt;&lt;P&gt;                                                         AND land1 = 'US'&lt;/P&gt;&lt;P&gt;                                                         AND regio = wa_data_records-DEST_STATE&lt;/P&gt;&lt;P&gt;                                                         AND bezei = wa_data_records-DEST_COUNTY.&lt;/P&gt;&lt;P&gt;                IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;                  wa_zta-COUNC = wa_t005f-counc.&lt;/P&gt;&lt;P&gt;                ELSE.&lt;/P&gt;&lt;P&gt;                  wa_zta-COUNC = '  '.&lt;/P&gt;&lt;P&gt;                ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          IF wa_data_records-FTL_ACTION_TYPE = 'D'.&lt;/P&gt;&lt;P&gt;                DELETE zta_freight FROM wa_zta.&lt;/P&gt;&lt;P&gt;          ELSE.&lt;/P&gt;&lt;P&gt;                APPEND wa_zta TO  i_zta.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     CLEAR wa_zta.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Modify the Z table with the internal table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MODIFY zta_freight FROM TABLE i_zta.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  COMMIT WORK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDMETHOD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;Tirumal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 21:13:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415245#M199797</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-18T21:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415246#M199798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SORT &amp;lt;itab&amp;gt; [ASCENDING|DESCENDING] [AS TEXT] [STABLE].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer this link for  help on SORTING internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3800358411d1829f0000e829fbfe/frameset.htm" target="test_blank"&gt;http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3800358411d1829f0000e829fbfe/frameset.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regds&lt;/P&gt;&lt;P&gt;Manohar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 21:26:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415246#M199798</guid>
      <dc:creator>Manohar2u</dc:creator>
      <dc:date>2006-07-18T21:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415247#M199799</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;Are you asking how to sort your internal table input-resultset-row by the two fields?  If so then you can try inserting the following statement before the loop (assuming the internal table is already filled with values and that the structure of your internal table contains the two fields mentioned):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT input-resultset-row BY ftl_timestamp ftl_actiontype.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;James g.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 21:27:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415247#M199799</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-18T21:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415248#M199800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;James -&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i try to issue the sort statement, and when doing the syntax-check it gives an error as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"You may only read from table "input-resultset-row". - reading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Tirumal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jul 2006 22:45:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415248#M199800</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-18T22:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415249#M199801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Its not allowing you to SORT as you directly changing the incoming parameters. Copy the internal table into another local internal table and do your SORT operation on that, that should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi&lt;/P&gt;&lt;P&gt;Note : Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2006 03:22:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415249#M199801</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-19T03:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415250#M199802</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;I guess I'd need to see more of the context of the code listed.  Here is an example based on your code that gives no syntax error (Note that I had to declare the internal table and the related types):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest.

TYPES: BEGIN OF zresultset_row,
         ftl_timestamp TYPE timestamp,
         ftl_actiontype TYPE c,
       END OF zresultset_row.

TYPES: zresultset_row_tab1 TYPE TABLE OF zresultset_row.

DATA: wa_data_records TYPE LINE OF zresultset_row_tab1,
      input-resultset-row TYPE zresultset_row_tab1,
      d_numberrange TYPE i.

SORT input-resultset-row BY ftl_timestamp ftl_actiontype.

* Loop at internal table into work area.
LOOP AT input-resultset-row INTO wa_data_records.
  d_numberrange = d_numberrange + 1.
* ...
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see now that your code ends with ENDMETHOD, so it would seem that the syntax error is probably related to where your code is located.  Someone else suggested in a different reply that you could copy your itab to another one and sort the copied version... I'd try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;James G.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2006 12:40:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415250#M199802</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-19T12:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: Sort on Internal Table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415251#M199803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You would need to transfer the data into another internal table and apply the SORT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Jul 2006 13:05:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-on-internal-table/m-p/1415251#M199803</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-07-19T13:05:01Z</dc:date>
    </item>
  </channel>
</rss>

