Sorting array vs sorting paginated array

...pulling in a long list of photos in a gallery, and I have
a sort function working within the pages of data fine. I need to
bring it back out of the paging stuff so that it sorts the data,
THEN passes to the paging function.
My data comes from mysql > php > xml > Flex into an
ArrayCollection, referred to in MXML as {acSlides}.
Pass the array collection to the paging system like:
<utils:FXCPager id="fxcPager" pageIndex="{currentPage}"
pageSize="{pageSize}" dataProvider="{acSlides}" />
then assign in repeater:
<mx:Repeater id="slideRepeater"
dataProvider="{fxcPager.pageData}">...</>
There is a button for sorting that calls a function a la:
private function sortByRating():void {
var sort:Sort = new Sort();
sort.fields = [new SortField("rating",false,true)];
fxcPager.pageData.sort = sort;
toggleRating = false;
fxcPager.pageData.refresh();
What do I need to do to get this sort function to work on the
{acSlides} array collection instead of {fxcPager.pageData} ???
Thanks!

OK I have resolved the error by importing the class adGroup. However now I am back to the original problem which is how to sort the DisplayName alphabetically and keep the associated link in tact. I created the class to avoid sorting parellel arrays but I am afraid it solved nothing as I have no idea how to sort the class. I tried just sorting it like an array:
  Arrays.sort(bAD.getGroups()but receive the following error:
java.lang.ClassCastException: com.mylbean.adGroup incompatible with java.lang.Comparable
at java.util.Arrays.mergeSort(Arrays.java:1160)
at java.util.Arrays.sort(Arrays.java:1131)
>
I would assume this message is caused because I cannot sort a class array using this method. But being newer to Java I really have no idea how to get the class to sort by DisplayName before displaying to the user.
So at this point the code works fine but how do I display alphabetically? All suggestions are appreciated.

Similar Messages

  • What types of sort performed by sort method of Array class ?

    I use normal bubble sort and method Array.sort() to sort some given data of an Array and then count the time.But Array.sort() method takes more time then normal bubble sort.
    Can anybody tell me what types of sort performed by sort method of Array class?

    I'm pretty sure that in eariler versions (1.2, 1.3
    maybe?) List.sort's docs said it used quicksort. Or I
    might be on crack.You are actually both correct, and wrong :)
    From the documentation of the sort methods hasn't changed in 1.2 -> 1.4 (as far as I can notice), and the documentation for sort(Object[]) says (taken from JDK 1.2 docs):
    "This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.
    The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists."
    So, how could you be correct? The documentation for e.g. sort(int[]) (and all other primities) says:
    "Sorts the specified array of ints into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance."
    Your memory serves you well :)
    /Kaj

  • Sorting a two-dimensional integer array

    I have a 2-D array that looks simliar to this:
    1 0 0 0
    1 1 0 0
    2 0 0 0
    2 1 1 1
    1 2 1 0
    2 1 2 0
    3 1 1 1
    4 1 0 0
    2 1 1 2
    .I am trying to come up with an algorithm that will sort this array by the first column, then the second, then the third, then the fourth. But I'm stumped. The array above should look like this when sorted:
    1 0 0 0
    1 1 0 0
    1 2 1 0
    2 0 0 0
    2 1 1 1
    2 1 1 2
    2 1 2 0
    3 1 1 1
    4 1 0 0I've been able to sort 2-D arrays with only two columns, but this has been a new challenge for me. I've been able to come up with a brute force approach but it doesn't seem to work, nor is it very efficient. Any suggestions on how to approach this problem would be a great help.

    An 2-D array is simply an array of arrays, so you should be able to use a simple Comparator:
    class ArrayIntComparator implements Comparator
        public int compare(Object  o1, Object o2)
             int[] arr1 = (int[]) o1;
             int[] arr2 = (int[]) o2;
             for (int i=0; i<=arr1.length; ++i)
                if (arr1[i]  != arr2)
    return(arr2[i] - arr1[i]);
    return 0;
    int[][] arr2d = ...
    Arrays.sort(arr2d, new ArrayIntComparator());
    Didn't compile it, but it oughta give you a close start.

  • How to sort a Array to be new Array in descend?

    hello guys:
    I have a array String[] selected = {0,1,2,3,4,5,6,7,8,9};I want to sort it into a new Array like : {9,8,7,6,5,4,3,2,1,0} , how i can do
    thanks

    Hmmmm not sure if you meant
    int[] selected
    rather than
    String[] selected
    You can't sort int[] in descending order using the standard API, you could though do a normal sort of the array and then iterate through it swapping element indexes, the first one in ascending sort will become the last one and the 2nd becomes the 2nd last one and so on....
    for (int i=0;i<selected.length / 2;i++) {
    int temp = selected;
    selected[i] = selected[selected.length - i - 1];
    selected[selected.length - i - 1] = temp;

  • Array is sorted backwards, and contains unwanted fields?....

    Hi all
    I am creating an array from the flashVars passed from html.
    the string in the html flashVars params looks like this:
    var1=01.jpg|02.jpg|03.jpg&var2=01.jpg|02.jpg
    So basically each var is a list of images separated with the
    bar sign "|"
    I am succesfully retreiving the flashVars into an
    actionScript array, then I create a new array of
    the listed images, using the split function:
    for(var sVar in flashVars){
    var stringVal = flashVars[sVar];
    images = stringVal.split("|");
    Now, when I loop through the images array and output the
    result, I get these values, in this order:
    [type Function]
    03.jpg
    02.jpg
    01.jpg
    What is [type Function] and how did it get in my array?
    Then, why are the array values sorted in reverse order (last
    image is first, first image is last)?....
    I hope you can help.
    seb ( [email protected])
    http://webtrans1.com | high-end web
    design
    An Ingenious WebSite Builder:
    http://sitelander.com

    hi
    var sVar:String =
    "01.jpg|02.jpg|03.jpg&var2=01.jpg|02.jpg";
    var my_array:Array = sVar.split("|");
    for (var i:Number = 0; i<=3; i++) {
    trace(my_array
    i hope that it'll help you

  • How do I put and sort string data into an array?

    I have a txt file that has the following sample data:
    Sample.txt----
    Jones Bill 12,500 Salesperson
    Adams Frank 34,980 Manager
    Adams John 23,000 Salesperson
    Thompson Joe 59,500 Trainee
    I need to incorporate each line of data into an individual array element, while using a user-defined method
    (ex. setAllValues(String last, String first, String salary, String job)
    How do I loop the data into the array to be displayed and what is the best way to do sorts on this sample data. Any code or clues would be super helpful.
    Sanctos

    If you set up an array of Strings you can use the java.util.Arrays.sort() method to sort it. If you need to sort arbitrary Objects (i.e. your 3 strings as a whole entity) your 3-way object will have to either implement Comparable or you could write a Comparitor class to do the ordering. Not much to it, though.
    Dom.

  • Java.util.Arrays; (method sort( ) )

    1) How to change a direction of sorting (on increase / on decrease)?
    2) Whether exists in java 2 something similar for sorting Strings ?

    1) How to change a direction of sorting (on increase
    / on decrease)?[url http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#reverseOrder()]http://java.sun.com/j2se/1.5.0/docs/api/java/util/Collections.html#reverseOrder()
    2) Whether exists in java 2 something similar for
    sorting Strings ?Arrays.sort and Collections.sort will both sort the array or list as long as the type implements Comparable (or you supply a separate Comparator). Since String implements Comparable, those sort methods will sort the array or list of strings.
    Making Java Objects Comparable
    http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html
    http://www.javaworld.com/javaworld/jw-12-2002/jw-1227-sort.html

  • Copy array and sort the numbers in the new array

    Hi!
    I have an array containing some digits where some of the digits are zeros. I want to copy the digits to another array but the zeros (well, I actually want to copy the zeros as well but I want to have them in the end of the new array).
    I suppose I need an if-statement that checks if the old array contains any zeros and in that if-statement copy the content to the new array and put the zeros in the end.
    This is my code so far and I don�t know how to go on from here:
    int[] new_array = new int[array.length];
              for (int i = 0; i < array.length; i++)
                   if (array[i] > 0)
                        new_array[i] = array;
                        new_array = array;
                   System.out.print(new_array[i] + " ");

    Roxxor wrote:
    I think I know how to do it but only if I can catch the digits bigger than zero.
    My code below just checks if there are positive digits and if there are, the whole old array is copied to the new one.Yes. Don't do that, you can see it's wrong.
    So my problem is that I don�t know how to catch the digits bigger than zero and copy them. Is there any built in java keyword that catches signs, number etc?
    if (array>=0)
         new_array[i] = array[i];
         new_array = array;
    Yes, there is such a keyword. And you are already using it correctly in your code. You are already testing if the array entry is bigger than zero. Your only problem is, you don't know what to do when it is. But now you've been given two hints about what to do.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • PHP/HTML: Returning input from a text box in a sub-array of the $_POST array?

    I have a page for entering/editing the data for a table of
    contacts, and would like to be
    able to compare the data for two different entries.
    Conceptually the simplest way to do
    this would be to load two identical copies of the same page,
    and have each copy return its
    results in a separate sub array in the $_POST array.
    For example I have an input which returns a value
    $_POST['address']. Is there any simple
    way whereby I could instruct this input to return
    $_POST['entry_1']['address'] in the
    first copy, and $_POST['entry_2']['address'] in the second
    copy?
    A similar question relates to fields which have sub entries.
    At present I encode these
    into the name of the return value (for example 'al1' in the
    case below), and have to
    decode them before I can put the results into the right box,
    but it would make things much
    simpler -- and therefore easier to understand and less error
    prone -- if I could return
    $_POST['address']['line_1'] and so on directly.

    On Sat, 21 Feb 2009 12:57:27 +0000 (UTC), Joe Makowiec
    <[email protected]> wrote:
    >On 20 Feb 2009 in macromedia.dreamweaver, Clancy wrote:
    >
    >> I have a page for entering/editing the data for a
    table of contacts,
    >> and would like to be able to compare the data for
    two different
    >> entries. Conceptually the simplest way to do this
    would be to load
    >> two identical copies of the same page, and have each
    copy return its
    >> results in a separate sub array in the $_POST array.
    >>
    >> For example I have an input which returns a value
    $_POST['address'].
    >> Is there any simple way whereby I could instruct
    this input to
    >> return $_POST['entry_1']['address'] in the first
    copy, and
    >> $_POST['entry_2']['address'] in the second copy?
    >>
    >> A similar question relates to fields which have sub
    entries. At
    >> present I encode these into the name of the return
    value (for
    >> example 'al1' in the case below), and have to decode
    them before I
    >> can put the results into the right box, but it would
    make things
    >> much simpler -- and therefore easier to understand
    and less error
    >> prone -- if I could return
    $_POST['address']['line_1'] and so on
    >> directly.
    >
    >You can sort of do this by adding square brackets [] to
    the name
    >attribute of several identically-named input fields:
    >
    ><form name="form1" method="post" action="<?php echo
    $_SERVER['PHP_SELF']; ?>">
    > <p><label
    for="streetAddress">Street</label>
    > <input type="text" name="address[]"
    id="streetAddress"></p>
    > <p><label
    for="apartment">Apartment</label>
    > <input type="text" name="address[]"
    id="apartment"></p>
    > <p><input type="submit" name="button"
    id="button" value="Submit"></p>
    ></form>
    ><?php
    >if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    > echo "<p>Post array:</p>\n";
    > echo "<pre>\n";
    > print_r($_POST);
    > echo "</pre>\n";
    >}
    >?>
    >
    >What gets returned is $_POST['address'][], where the
    second index
    >ranges between 0 and the number of same-named input
    fields less 1.
    >In the code above, 'apartment' would be addressed as
    >$_POST['address'][1].
    Thanks, Joe,
    This is interesting, but not really what I was looking for.
    It might be helpful for
    entering the results from one page, but it doesn't really
    help in separating the outputs
    from two copies of the same page. I suppose, though, I could
    count the number of (say)
    'address' responses, and divide by the number of identical
    pages. Then I would know at
    terms 0 to 3 belong to the first page, and 4 to 7 to the
    second -- provided I always had
    the same number of items on each copy of the page, which
    ain't necessarily so!
    However I doubt whether this is any simpler than the
    alternative of encoding the page
    number into the name of the variable.

  • How do I open a text file to sort using bubble sort?

    Hi,
    I have a text file, which is a list of #'s.. ex)
    0.001121
    0.313313
    0.001334
    how do you open a text file and read a list? I have the bubble sort code which sorts.. thanks

    I wrote this, but am getting a couple errors:
    import java.util.*;
    import java.io.*;
    public class sort
         public static void main(String[] args)
              String fileName = "numsRandom1024.txt";
              Scanner fromFile = null;
              int index = 0;
              double[] a = new double[1024];Don't use double. You should use something that implements Comparable, like java.lang.Double.
              try
                   fromFile = new Scanner(new File(fileName));
              catch (FileNotFoundException e)
    System.out.println("Error opening the file " +
    " + fileName);
                   System.exit(0);
              while (fromFile.hasNextLine())
                   String line = fromFile.nextLine();
                   a[index] = Double.parseDouble(line);Don't parse to a double, create a java.lang.Double instead.
                   System.out.println(a[index]);
                   index++;
              fromFile.close();
              bubbleSort( a, 0, a.length-1 );No. Don't use a.length-1: from index to a.length-1 all values will be null (if you use Double's). Call it like this:bubbleSort(a, 0, index);
    public static <T extends Comparable<? super T>> void
    d bubbleSort( T[] a, int first, int last )
              for(int counter = 0 ; counter < 1024 ; counter++)
    for(int counter2 = 1 ; counter2 < (1024-counter) ;
    ) ; counter2++)Don't let those counter loop to 1024. The max should be last .
                        if(a[counter2-1] > a[counter2])No. Use the compareTo(...) method:if(a[counter2-1].compareTo(a[counter2]) > 0) {
                             double temp = a[counter2];No, your array contains Comparable's of type T, use that type then:T temp = a[counter2];
    // ...Good luck.

  • Replace build array with replace subset array

        Currently I am using a build array function, but would like to replace it with a replace array subset, but I am new to labview and having a lot of trouble.  I've attached a screen shot of the code I am struggling with.  Does anyone have any ideas?
    Attachments:
    Build array code.JPG ‏29 KB

    First, I'm assuming this is inside some sort of loop.  Second, I would recommend cleaning up the code a bit so the feedback node is not overhanging the edge of the case structure.  It's unclear as to what is wired to what.  Third,  I would recommend using shift registers instead of the feedback node.
    Fourth, and the main thing is that you are currently initializing a 64 element 1-D array and appending it to your array on every iteration with the build array.
    If you want to use the replace array subset.  Initialize the array to the size you want outside of the loop.   Feed it into the left hand shift register.  Replace each row (or column) with your new data.  You will need to track the iterations, and possibly add special code to shift the array, or enlarge the array in the event you have more data come in then the original size of your array.

  • Memory/Speed of Split 1D array vs Delete from array

    Just wondering how Split 1D array works - does it create two new arrays in a new section of memory or does it just split the existing array in two, reusing the memory in place. (assuming that the original array is not needed elsewhere). If the latter is the case then presumably it is more efficient to use split array than delete from array if I want to remove element(s) from the beginning or end of the array. Is there a speed advantage as well?
    If I use split array but don't then use one of the output arrays is that memory deallocated or does the array remain in memory?
    Thanks
    Dave

    Ok please ignore the results I posted earlier, they are rubbish - not least because I got the column headings mixed up but also because my code was full of bugs
    So, here is a revised table, and the code - which hopefully only contains a few bugs... I'm not clued into benchmarking yet so please feel free to rip the code apart.
    I still get different results depending on where in the array I split it, most noticeably with subset and reshape. There is no effect with split. I'm guessing this is to do with the memory allocation. (I have not preallocated memory in my code, but I did wire the output arrays to Index Array)
    Message Edited by DavidU on 08-12-2008 04:49 PM
    Attachments:
    Benchmarks 2.png ‏13 KB
    split array test.vi ‏25 KB

  • Sort Artist and Sort Album tags don't update

    Having spent a lot of time over the years getting the metadata in my iTunes library just right, I've noticed a frustrating problem when it comes to iTunes Match.
    I make use of 'Sort Artist' and 'Sort Album Artist' tags so that my library is sorted by artist surname (eg. Lennon, John).
    This always worked correctly when I syncronised my music via iTunes, but since switching over to iTunes Match this has become problematic.
    When I initially signed up for iTunes Match, my Library moved over correctly - honouring the sort order tags that I had added. However, When I add NEW music to the library and subsequently change the sort tag, the change does not propegate to iTunes Match (Though it does appear correct in iTunes on my Mac). So the result is now a mixed sort order on my iOS devices - some by first name and some by second.
    Under iOS 5.0 and iTunes 10 I used to be able to get around this with a little forethought - I would turn iTunes Match OFF on the Mac before adding any new songs, then I would edit the tags and then switch Match back on. This would rescan the library and add the new tracks to the cloud complete with correct metadata.
    This workaround no longer works under iOS 6 and iTunes 11.
    I have tried switching iTunes match off on my iPhone and restarting it. This does not work either.
    Does anyone else have this issue or know of a way to 'force' the metadata to be updated?
    Any help would be appreciated.

    I also am finding it impossible to convince my iPhone that the Album Sort field exists. This is especially odd considering when I view my Home Shared music from my iPhone, it works exactly correctly. I have verified that the tags are being uploaded to iTunes Match by viewing the songs from another computer that has iTunes Match. So, for some reason, iOS 6 will not sort by the Album Sort field when using iTunes Match music.
    Does anyone have any sort of fix or workaround for this problem? I've submitted Feedback to Apple.

  • A simple question about wrong sorting with multiple sort columns in Excel 2010

    Hi, everyone! I have encountered a problem that I don't know how to explain.
    So I post it here because I don't know if there is another more relevant forum...
    I have a data sheet with the students' scores for the course. 
    All the data were generated with the randbetween function,
    and pasted with the values.
    To rank the students by their performance,
    I did the sort with the column "total score" as the first sort-column
    and "final term" as the second.
    The weird thing to me is that the order of the data seems problematic.
    That is, all the rows are sorted correctly with the first sort-column.
    But for the rows with the same values of the first sort-column,
    there are some rows whose values of the second sort-column are out of order.
    (please look at the data file at
    www_dot_kuaipan_dot_cn/file/id_67204268108546068_dot_htm
    Please change the "_dot_" to the real literal dot.
    Especially the rows with 56.7 as the first sort-column value
    and some other values near the tail of the list.)
    I tried to manually input and sort the same values of both columns
    in a near-by region. The result was correct.
    When some friend copied all the data to paste in Notepad,
    and reload them in excel. The problem disappears.
    Some friend also tried to wrap a round function at the values of the 1st sort-column,
    the sorting order became correct!
    But they could not explain why either.
    How confusing! I even tried to swap the first and secod sort-column;
    the output was right.
    All the data were generated by randbetween function and pasted with values.
    Where could all the special characters, if any, come?
    Can anyone give me an explanation? I would be very grateful.
    Thanks in advance!

    Re:  Sort is not in proper order
    Sounds as if the data includes spaces or hidden characters that are affecting the sort.
    That is indicated by the fact that manually entering the data resolves the problem.
    Note:  You can use a public file storage website to hold your file and add the link to it in your post.
    Jim Cone
    Portland, Oregon USA
    Special Sort excel add-in (30+ ways to sort) - 3 week no obligation trial
    https://jumpshare.com/b/O5FC6LaBQ6U3UPXjOmX2

  • Array of cluster to array of element - or - Cluster of arrays?

    Hi all,
    I have a large cluster (lets call it C_data) containing measured data e.g. 10 Temperatures, Pressure, (Temp_1, ...).....
    All these data are measured once per second. I now collect all data
    measured over a certain time in an array of the aforementioned cluster,
    that is
    an array of C_data. In order to display time series of data in graphs I
    need to extract arrays of elements from this array of C_data.
    In a text based programming language this could look like the following:
    Struct C_data {Temp_1, Temp_2, P_1.....}
    ar_C_data is an array of C_data
    now I want to do something like:
    array_of_Temp_1 = ar_C_data[*].Temp_1
    In some programming languages this works but I cannot unbundle_by_name the array of Temp_1 from ar_data in Labview.
    Since my cluster is large and may change in structure (for this reason I use a typedef) a generic solution would be the best.
    I know that I could: loop over all elements of ar_C_data, unbundle by
    name, index elements into arrays, and use these but this seems very
    inefficient if it is done every second on a large cluster (30 elements) with several thousand array elements....
    Olaf

    You can minimize the overhead of scanning through all elements and extracting if you pre-define the array and use "replace array subset".  This avoide having to re-size the array which is costly.
    Or you can keep an array separately in memory.  When one cluster element is added, the corresponding element is added to the array too.  Causes some memory overhead, but you're going to have that anyway if you generate them "on the fly".
    I don't see a way to do this other than either search through the array and pick the elements you need -or-
    keep a copy of the data in a form you can use.
    It's a common question of how to structure data to best suit two sometimes conflicting needs - efficiency and useability.
    What might be of interest is to change the "Array" - "Cluster" order and have a single cluster C-Data with arrays of each element required.  Might be a bit more difficult to use, it depends on your application.
    This way you have all arrays ready at all times, but generating a single cluster requires bundling the individual units on the fly.
    Shane.
    Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)

  • Sort up and sort Down push buttons in module pool with table control wizard

    hi,
    i have created 2 buttons for Sort up and sort Down push buttons in module pool with table control wizard
    please any one can help me.
    regards

    Hi
    Following code is to enable and disable the tbl control using two buttons. Just alter the code and for each button write the sort code.
    REPORT  YJAN27_SCREEN                                               .
    TABLES: SFLIGHT, YFLIGHT_28.
    TYPES: BEGIN OF struct1,
          carrid like sflight-carrid,
          connid like sflight-connid,
          fldate like sflight-fldate,
           END OF struct1.
    CONTROLS TBL1 TYPE TABLEVIEW USING SCREEN 2700.
    DATA: OK_CODE LIKE SY-UCOMM,
          CARRID LIKE SFLIGHT-CARRID,                                    "cols in tbl ctrl
          CONNID LIKE SFLIGHT-CONNID,
          FLDATE LIKE SFLIGHT-FLDATE,
          itab TYPE TABLE OF STRUCT1 WITH HEADER LINE,
          cols like line of TBL1-COLS,
          FLAG TYPE I.
    FLAG = 1.
    CALL SCREEN 2700.
    *&      Module  STATUS_2700  OUTPUT
    *       text
    MODULE STATUS_2700 OUTPUT.
      SET PF-STATUS 'BACK'.
    *  SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_2700  OUTPUT
    *&      Module  USER_COMMAND_2700  INPUT
    *       text
    MODULE USER_COMMAND_2700 INPUT.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
      WHEN 'BACK'.
        LEAVE PROGRAM.
      WHEN 'DIS'.                                                         "write code for sort up
        loop AT TBL1-COLS INTO COLS.
           COLS-SCREEN-INPUT = 0.
            MODIFY TBL1-COLS FROM COLS.
        ENDLOOP.
        FLAG = 2.
      WHEN 'ENA'.                                                       "write code for sort down
        loop AT TBL1-COLS INTO COLS.
            COLS-SCREEN-INPUT = 1.
            MODIFY TBL1-COLS FROM COLS.
        ENDLOOP.
        FLAG = 1.
    ENDCASE.
    ENDMODULE.                 " USER_COMMAND_2700  INPUT
    *&      Module  GET_DATA  OUTPUT
    *       text
    MODULE GET_DATA OUTPUT.
      select carrid connid fldate from SFLIGHT into table itab.
    ENDMODULE.                 " GET_DATA  OUTPUT
    *&      Module  POPULATE_TBL  OUTPUT
    *       text
    MODULE POPULATE_TBL OUTPUT.
        MOVE-CORRESPONDING ITAB TO SFLIGHT.
    ENDMODULE.                 " POPULATE_TBL  OUTPUT
    *&      Module  CHANGE_SCREEN  OUTPUT
    *       text
    MODULE CHANGE_SCREEN OUTPUT.    " use this module if you want to hide the other button
    CASE FLAG.
      WHEN 1.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_ENA'.
            SCREEN-INVISIBLE = 1.
             MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_DIS'.
            SCREEN-INVISIBLE = 0.
             MODIFY SCREEN.
          ENDIF.
       ENDLOOP.
      WHEN 2.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_DIS'.
            SCREEN-INVISIBLE = 1.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
        LOOP AT SCREEN.
          IF SCREEN-NAME = 'B_ENA'.
            SCREEN-INVISIBLE = 0.
             MODIFY SCREEN.
          ENDIF.
       ENDLOOP.
    ENDCASE.
    ENDMODULE.                 " CHANGE_SCREEN  OUTPUT
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_2700.
    MODULE CHANGE_SCREEN.     " use this if you want to display one button at a time
    MODULE GET_DATA.
    loop at itab WITH control TBL1.
        MODULE POPULATE_TBL.       " populate tbl ctrl
    endloop.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_2700.    " do the sort operations
    loop at itab.
      endloop.
    Hope this helps
    Regards,
    Jayanthi.K

Maybe you are looking for