<?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 ITAB BY &amp;lt;VARIABLE_NAME&amp;gt; in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620025#M1280238</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;Char data type sort frist charectar wsie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u sort itab value  -- 20&lt;/P&gt;&lt;P&gt;                              1&lt;/P&gt;&lt;P&gt;                              2&lt;/P&gt;&lt;P&gt;                             11&lt;/P&gt;&lt;P&gt;                              3&lt;/P&gt;&lt;P&gt;                              29.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After Sort Output:- 1&lt;/P&gt;&lt;P&gt;                           11&lt;/P&gt;&lt;P&gt;                           2&lt;/P&gt;&lt;P&gt;                          20&lt;/P&gt;&lt;P&gt;                         29&lt;/P&gt;&lt;P&gt;                         3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I sugest define CRIT - NUMC type.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 16 May 2009 10:43:42 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-05-16T10:43:42Z</dc:date>
    <item>
      <title>SORT ITAB BY &lt;VARIABLE_NAME&gt;</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620022#M1280235</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 want to sort the int table with variable parameters, like VKBUR, BUDAT, VKORG, MATNR, etc.&lt;/P&gt;&lt;P&gt;for that ive created a char variable of 5 length (say CRIT) and assigned value based on selection criteria by the user.&lt;/P&gt;&lt;P&gt;Then, im using SORT ITAB BY CRIT. Its not getting sorted properly.&lt;/P&gt;&lt;P&gt;Any suggestions,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 May 2009 08:59:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620022#M1280235</guid>
      <dc:creator>naveenvishal</dc:creator>
      <dc:date>2009-05-16T08:59:09Z</dc:date>
    </item>
    <item>
      <title>Re: SORT ITAB BY &lt;VARIABLE_NAME&gt;</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620023#M1280236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;please send the code with internal table structure, so ican send th correct code what to write..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prabhudas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 May 2009 09:29:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620023#M1280236</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-16T09:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: SORT ITAB BY &lt;VARIABLE_NAME&gt;</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620024#M1280237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Probably your assignement to variable could be wrong CRIT.&lt;/P&gt;&lt;P&gt;Check in debugger if the selected field is getting passed correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Shital&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 May 2009 10:01:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620024#M1280237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-16T10:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: SORT ITAB BY &lt;VARIABLE_NAME&gt;</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620025#M1280238</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;Char data type sort frist charectar wsie.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if u sort itab value  -- 20&lt;/P&gt;&lt;P&gt;                              1&lt;/P&gt;&lt;P&gt;                              2&lt;/P&gt;&lt;P&gt;                             11&lt;/P&gt;&lt;P&gt;                              3&lt;/P&gt;&lt;P&gt;                              29.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After Sort Output:- 1&lt;/P&gt;&lt;P&gt;                           11&lt;/P&gt;&lt;P&gt;                           2&lt;/P&gt;&lt;P&gt;                          20&lt;/P&gt;&lt;P&gt;                         29&lt;/P&gt;&lt;P&gt;                         3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I sugest define CRIT - NUMC type.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 May 2009 10:43:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620025#M1280238</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-16T10:43:42Z</dc:date>
    </item>
    <item>
      <title>Re: SORT ITAB BY &lt;VARIABLE_NAME&gt;</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620026#M1280239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Field is provided dynamically so it must be enclosed in paranthesis.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
SORT ITAB BY (CRIT). "depending on CRIT content i.e 'VKBUR' , 'BUDAT' it will sort using this field
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Marcin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 May 2009 11:24:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620026#M1280239</guid>
      <dc:creator>MarcinPciak</dc:creator>
      <dc:date>2009-05-16T11:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: SORT ITAB BY &lt;VARIABLE_NAME&gt;</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620027#M1280240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can easily achieve it by using filed symbols.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Assign the field (upon which you require sorting) to field symbol&amp;lt;Fs&amp;gt; and then sort the table with (&amp;lt;Fs&amp;gt;)reference.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sample code is given below for your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF x1 OCCURS 0,
        t1 TYPE string,
        t2 TYPE string,
        t3 TYPE string,
       END OF x1.

FIELD-SYMBOLS: &amp;lt;fs&amp;gt; TYPE ANY.

x1-t1 = 'B'.
x1-t2 = 'D'.
x1-t3 = '9'.
APPEND x1.

x1-t1 = 'C'.
x1-t2 = 'X'.
x1-t3 = '4'.
APPEND x1.

x1-t1 = 'F'.
x1-t2 = 'Y'.
x1-t3 = '6'.
APPEND x1.

LOOP AT x1.
  WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
ENDLOOP.

SKIP 2.

* Sort by field T1
ASSIGN 't1' TO &amp;lt;fs&amp;gt;.
SORT x1 BY (&amp;lt;fs&amp;gt;).

LOOP AT x1.
  WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
ENDLOOP.

skip 2.

* Sort by field T3
ASSIGN 't3' TO &amp;lt;fs&amp;gt;.
SORT x1 BY (&amp;lt;fs&amp;gt;).

LOOP AT x1.
  WRITE: / x1-t1, '    ', x1-t2, '    ', x1-t3.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 May 2009 10:24:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sort-itab-by-lt-variable-name-gt/m-p/5620027#M1280240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-05-18T10:24:23Z</dc:date>
    </item>
  </channel>
</rss>

