How to sort data in cl_gui_alv_tree class?

Hi,
I thought that since this object uses an alv grid that the standard sort functionality would exist.  Now that I've developed most of the code, I realize that there is no native sorting functionality.
Is there some way I can make use of the Superclass CL_ALV_TREE_BASE?
It has some methods that are "Private", "Instance"  - I'm still a rookie at OO programming in SAP so I'm not sure how best to approach the situation.
As I see it, I have a few options:
1)  Manually manage sorting by providing an ascending and descending button/icon on the toolbar and then delete and rebuild the nodes in the tree.
2)  Manually track the data along with the nodekeys and then use method MOVE_NODE to reposition the data in the tree
3)  Clone these objects and somehow find the code that is causing the sort options to be suppressed in the toolbar.
Has anyone built any applications using CL_ALV_TREE_BASE that permit sorting?
Please don't waste my time by pasting in the links to all the SAP online help for ALV and expect to get points.  Been there, done that.  If there is a particular section that is of specific value, I'll happily study it and report my findings.  Particularly something that explains how to invoke the methods of a superclass and the difference between protected, public, and private.
Mostly though, I really need a way to sort data in the CL_GUI_ALV_TREE class.
Thanks

Hi Ray,
As far as I know, this will not work. I've had the same problem. The only solution I have found was to re-build the tree each time. It is easier than moving nodes around.
You can take a look at the class cl_wa_notifications_wps - in case you have a PM or an A&D system.
Ferenc

Similar Messages

  • How to sort Data in XML template (rtf) file?

    Hi, I have an oracle 11i custom report (rdf) with an xml output to a PDF. There is a formula column in the report. Now I need the data to be sorted on this formula column. As we cannot sort on formula column, i have decided to find a way to sort it in the data in the XML template. But I don't really know how to sort and also where to specify the sort tag in the rtf file. I appreciate your response.
    Databse version : 9.2.0.8.0
    E-Biz Version : 11.5.10.2
    Oracle Reports Version : 6.0.8.27.0
    Oracle BI version : 10.1.3.2.1
    Note : I posted this question under : XML General forum also. But did not get any response. I assumed that may be thats not the right place to post it as my report is in e-Biz environment.

    Hi
    As long as you don't have your ^field commands grouped inside a ^group the order in the .dat file is not important. Your last command
    ^field BG_DOC_LN__LN_AM
    246624.12
    should populate field BG_DOC_LN_AM wherever you place it on your form. Obviously you need to name the fields according to your ^field commands and not just use tab (move to next field).
    Shout if this was not what you are asking.
    Stale Sodal

  • How to sort data on numbers on an iPad

    How do you sort data in Numbers on an iPad?

    Read this it will help http://support.apple.com/kb/PH3372

  • How to sort data in  results table(advanced table) based on some conditons

    I have a requirement like below I have 3 search columns and 3 sort columns in the page. when user enter values in the search columns I will get results into advanced table. After I got results into results table. User will enter values in sort columns and hit sort submit button, Now the final results data should first display the selected sort values first and remaining data in alphabetical order.
    ex: select a,b,c form table1 where a = nvl(:1,a) and b = nvl(:2,b)
    results from main query
    a , b,c,d,e,f
    now user selects a value a1 in column a then results from main query data should display the a1 records first and remaining all records in alphabetical order.
    Please let me know how can we approach to solve this problem.
    Thanks,
    KC.

    Hi
    Use the following method :
    Set the OrderByClause in your voImpl():
    the following is the description of OrderByClause method :
    setOrderByClause
    public void setOrderByClause(java.lang.String expr)
    Sets the ORDER BY clause of the View Object's query statement. Bind variables can be specified using '?' as a place-holder for the value. The new ORDER BY clause does not take effect until ViewObjectImpl.executeQuery() is called.
    regards
    sridhar

  • How t sort data in chart view (bar chart)

    Hello,
    I have a table view and a chart view in my visual composer model.
    the data in table view are sort A,B, C ---Z
    but in my chart views (bar charts) the listing begins with Z,Y,X,.....A
    (same data service/ BI-Query)
    How can I sort my listing in bar chart so, that the listing begins with A,B,C
    Thanks,
    best regards
    thomas

    Connect the OUT port of dataservice to IN port of SORT operator. This SORT operator is available in Compose > Operators.Configure the SORT operator , select the column on which you want to sort. Then the output of SORT operator should be connected to the IN port of CHART.
    This should give you the desired result.

  • How to Sort Date in RTF template

    Hi
    in my report i have name, date_arrival, Time_arrival, Hotel. I created a report grouped by hotel. On the screen it's working OK. when I print yusing RTF created template, the date is not sorted as expected.
    Thanks,
    Ribhi

    I have read much about date formating. I think some of the functionality in to_chat and to_date is changing between versions. I don't know that this is the simplest way, but it is the only way that worked for me:
    <?sort: xdoxslt:format_date (ssPrimaryRevenueCloseDate,’ yyyyMMDD’, ’MM/DD/yyyy’,’Europe/London’,’GMT’)?>
    I do not understand why this function is not in the documentation.
    Edited by: user10189185 on 17-Mar-2009 05:01

  • How to sort data in PL/SQL table and print them in Order?

    Hi Guys
    I wan to create a csv file layout as below, maximum we got 12 weeks sales figure for each item. Week is week of the year, it will different every time based on sales_date.
    Item Number     Description     Sales Week      27 26 25 24 23 22 21 20..
    1234          Sample                10     6     2     8     10          
    1230          Test                50     60     2      10          
    I got item number, description, week_no and sales in a temp table which is populated by a procedure. Now I need to write these records from table to a file.
    I not sure how to store multiple records for each item in PL/SQL table, sort them and print them in above format.
    My select statement is as below
    select item_number,
    description,
    week_no,
    year,
    opening_stock_qty,
    production_qty,
    sales_qty,
    creation_date,
    (production_qty - sales_qty) net_qty
    from xxsu_planning_report
    order by item_number,year,week_no;
    Any help will be much appreciated.
    Thanks and regards
    VJ

    Above error occured because you are trying to concatenate dbms output with some other string, which is not allowed.
    Declare
    TYPE plan_type IS TABLE OF xxsu_planning_report%ROWTYPE
    INDEX BY BINARY_INTEGER;
    plan_table plan_type;
    BEGIN
    plan_table(1).week_no := 24;
    plan_table(1).description := 'This is week 24';
    plan_table(2).week_no := 21;
    plan_table(2).description := 'This is week 21';
    for i IN 1..2 loop
    dbms_output.put_line(plan_table(i).week_no) || ' ' || plan_table(i).description);
    end loop;
    END;From your code, I didnt understood what you want to do. Using Associative Array would be wrong approach in this case.
    As per your scenario, you have to store max 12 records for each item number.
    create or replace type dailySales as object(Description varchar2(100), Sales number,  Week number);
    create or replace type saletab as table of dailySales;
    create table t_sales (p_item number, p_sales saletab);
    insert into t_sales values
    (p_item, ---------enter value for item number 1
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 1
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 2
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 3
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 4
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 5
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 6
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 7
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 8
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 9
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 10
    saletab(dailySales($n1,$n2,$n3)), ---------enter value for sales record for week 11
    saletab(dailySales($n1,$n2,$n3)) ---------enter value for sales record for week 12
    Enter 0 if no sales exist for any week. Because NULL would throw an exception.
    Execute the SQL query to check the output.Try this and let me know if any fyrther issues.

  • How to sort data in descending order when user clicks on the column heading

    Hi
    I have a report called "Top customers", which shows the top customers for a specific product line. It displays the customer name and one column with the total amount spent in the period for each product line. By default, the leftmost product line is sorted in descending order.
    If the user wants to know who are the top customers for another product line, they simply click on the column heading to sort the list by that column.
    The problem is that when you click for the first time on a sortable column heading, Apex sorts it in ascending order; you need to click on the same column heading again to sort in descending order.
    Is it possible to change this behaviour and sort the data in descending order in the first click? So the users don't have to click twice...
    Thanks
    Luis
    PS: Apex 3 running on Oracle 10.2.0

    Luis,
    See: Can I "catch" a click on a sortable column header of a report?
    Take a look at Anton Nielsen's answer with regards to hiding a column and displaying its value instead of the sortable column.
    Asumming the following simple report query:
    select product,sales
    from <table>
    Change that into:
    select product
    ,sales*-1 as reverse_sales -- Select this one as an extra column
    ,sales -- Hide this column
    from <table>
    In your report column attributes (of column reverse_sales), html-expression, type #sales#. It then displays the normal sales. However apex will generate a 'order by 2 asc' for the first time. The '2' will refer to the sales*-1 value: sorting it asc, is the same as sorting sales descending...
    Toon

  • How to sort data from database and display in combobox in required order

    Hi evrybody, it makes me sick i need to get data form database and fill combobox in required order (last item added to database - last firstName) actualy i already did that, but i'm useing DefaultComboBoxModel and all records are sorted in alphabetical order. Thanks very much for any help

    The items in the JComboBox are displayed in the order in which you add them to the combo box. Use an order by clause in your SQL statement.
    Don't [url http://forum.java.sun.com/thread.jsp?forum=54&thread=516608]crosspost.

  • How to sort data in Matrix report

    I've used Report6i and create report in Matrix format.I want the report to display data in sorting by data in cell. Anyone pls help me.
    --it's show this
    applicant_id/score Score
    08002 400
    08003 200
    08004 700
    08006 653
    08008 560
    08010 800
    -- but i want to see this
    applicant_id/score Score
    08010 800
    08004 700
    08006 653
    08008 560
    08002 400
    08003 200
    i tried to set the group's property( break order property ). It doesn't allow me to set break order property of applicant_id's group to none. And tried to write 'order by' in the SQL statement but it doesn't help.

    Hi,
    If Oracle can give you back the right sort order without any custom sorting,
    that means you should be able to get the same results in WebI.
    If the object that you pull from the universe is the wrong type (like numeric but you want it alphanumeric),
    then you can either request you designer to give you an object with the right data type,
    or you can change it by creating a report variable using
    FormatNumber([original object],"0")
    this will format the number to a number without leading zeroes, thousand separators or decimal point.
    Now you can use the object as if it came from the universe.
    So you can also use it on the x-axis of a chart.
    Btw. you can also do a custom sort on the x-axis(as long as it is an object or variable, not a formula)
    alternative, if you define a custom sort in a table block, you can state it should be used througout the document.
    (so also in the charts.
    Hope this helps,
    Marianne

  • How to read data from abstract class

    Hi,
    I have an abstract class which has a try block in the run method which looks like this:
    public void run()
    throws exception
    try
    ArrayList xCoord = new ArrayList();
    Double xValue = null;
    for (j=0; j<10; j++)
    xValue = new Double (table.getX(j).toDouble());
    xCoord.add(xValue); // to populate arraylist
    i also have the required catch statements, i have not written them here to keep in concise.
    My question is: How do I read the values stored in the xCoord arraylist from another 'concrete' class derived from the above abstract class.
    I know that for this, I first have to be able to execute the above "run" method, because that is how the arraylist will get populated with values. But how do I do this from the concrete class?
    Then, once the arraylist is formed, how do I read the values from the concrete class, without copying all the code?
    Any guidance will be really helpful. Thanks -- Vinay.

    Add a public or protected accessor (getter) method to retrieve the value calculated in run(). Modify run() to store the results in an instance variable in the abstract class.
    - Saish

  • How to sort data (i.e. sort by last name) in a related ?

    Hello,
    Is there a way to sort automatically records by "last name" in my related "contact" of my account view ?
    Even manually, we do not have any arrow !
    Many thanks and have a nice day.

    Thanls bobb for your reply.
    It works except for the first line which is not sorted by alphabetical order.
    i.e:
    M
    A
    C
    G
    V
    Z
    Does anyone have point out the same behavior ?
    Thanks again.

  • Sort data

    How to sort data query result each time one clicks sort
    button ...sort by name,date,etc

    I did dont work...
    =====
    <CFQUERY NAME="Rec" DATASOURCE="#EazyVector#">
    SELECT ctrData.FACILITY AS Facil,ctrData.CONTRACTNO AS
    CONTRACTNO,ctrData.CONTRACTDATE AS
    CONTRACTDATE,ctrData.CONTRACTTITLE AS
    CONTRACTTITLE,ctrData.DRWPROVIDEBY AS DRWPROVIDEBY,ctrDocs.DRWNO AS
    DRWNO,ctrDocs.SHEETNO AS SHEETNO,ctrDocs.CONTRACTNO AS
    DocCtrNo,ctrDocs.DRWTYPE AS DRWTYPE,ctrDocs.DISCIPLINE AS
    DISCIPLINE,ctrDocs.DRWTITLE AS DRWTITLE,ctrDocs.CONFCADDFILENAME AS
    ImageName,ctrDocs.DRWDATE AS DRWDATE ,ctrDocs.DOCID AS
    DOCID,ctrLoc.READONLYMEDIAPATH AS READONLYMEDIAPATH,
    ctrLoc.CONTRACTNO AS LocCtrNo
    FROM CONTRACTS ctrData,CONTRACT_DOCS
    ctrDocs,IMGS_LOCATION_FOLDER ctrLoc
    WHERE lower(ctrData.CONTRACTNO)=lower(ctrDocs.CONTRACTNO(+))
    AND lower(ctrData.CONTRACTNO)=lower(ctrLoc.CONTRACTNO(+))
    <CFIF Form.ConTNo NEQ "">
    AND lower(ctrData.CONTRACTNO) like lower('%#Form.ConTNo#%')
    </CFIF>
    <CFIF Form.ConTitle NEQ "">
    AND lower(ctrData.CONTRACTTITLE) like
    lower('%#Form.ConTitle#%')
    </CFIF>
    <CFIF #Form.Discipline# NEQ "">
    AND lower(ctrDocs.DISCIPLINE) LIKE
    lower('%#Form.Discipline#%')
    </CFIF>
    <CFIF #Form.DrawingNo# NEQ "">
    AND lower(ctrDocs.DRWNO) LIKE lower('%#Form.DrawingNo#%')
    </CFIF>
    <CFIF #Form.Facil# NEQ "">
    AND lower(ctrData.FACILITY) LIKE lower('%#Form.Facil#%')
    </CFIF>
    <CFIF #Form.DrwTitle# NEQ "">
    AND lower(ctrDocs.DRWTITLE) LIKE lower('%#Form.DrwTitle#%')
    </CFIF>
    <!--- Month
    <CFIF #Form.selectMonth# NEQ "">
    AND EXTRACT(MONTH FROM ctrData.CONTRACTDATE ) IN
    (#ListQualify(Form.selectMonth, "'")#)
    </CFIF>
    <!--- Day --->
    <CFIF #Form.selectDay# NEQ "">
    AND EXTRACT(DAY FROM ctrData.CONTRACTDATE ) IN
    (#ListQualify(Form.selectDay, "'")#)
    </CFIF>
    <!--- Year --->
    <CFIF #Form.selectYear# NEQ "">
    AND EXTRACT(YEAR FROM ctrData.CONTRACTDATE ) IN
    (#ListQualify(Form.selectYear, "'")#)
    </CFIF>--->
    <!--- Between Two Years --->
    <CFIF (#Form.selectYearF# NEQ "") AND (#Form.selectYearT#
    NEQ "")>
    AND ( EXTRACT(YEAR FROM ctrData.CONTRACTDATE ) BETWEEN
    #Form.selectYearF# AND #Form.selectYearT# )
    </CFIF>
    <!--- ORDER by most recent date first --->
    ORDER BY #sortKey# DESC
    </CFQUERY>

  • Sort data results

    How to sort data query result each time one clicks sort
    button ...sort by name,date,etc

    Say for instance you would like to out put the emails,
    fullname and city. Want to sort by each header.
    <cfparam name="sort" default="fullname asc">
    <cfquery name="whatever' datasource="yoursource">
    select *
    from tbl
    order by #sort#
    </cfquery>
    <!---- using U for ascending and D for descending order
    ---->
    <table>
    <tr>
    <td>
    Full Name <a href="page.cfm?sort=fullname
    asc">U</a> | <a href="page.cfm?sort=fullname
    desc">D</a>
    </td>
    <td>
    Email <a href="page.cfm?sort=email asc">U</a> |
    <a href="page.cfm?sort=email desc">D</a>
    </td>
    <td>
    City <a href="page.cfm?sort=city asc">U</a> |
    <a href="page.cfm?sort=city desc">D</a>
    </td>
    </tr>
    <cfquery query="whatever">
    <tr>
    <td>#fullname#
    </td>
    <td>#email#
    </td>
    <td>#city#
    </td>
    </tr>
    </table>
    So when the user clicks on Full Nam U it will send the sort
    value to the query and so forth.
    Hope this helps,
    Sevor Klu

  • How to Sort JTable data using Multiple fields (Date, time and string)

    I have to fill the JTable data with some date, time and string values. for example my table data looks like this:
    "1998/12/14","15:14:38","Unicorn1","row1"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/17","12:14:12","Unicorn4","row6"
    Now the Sorted Table should be in the following way:
    "1998/12/17","12:14:12","Unicorn4","row6"
    "1998/12/14","15:14:40","Unicorn4","row3"
    "1998/12/14","15:14:39","Unicorn2","row2"
    "1998/12/14","15:14:38","Unicorn1","row1"
    ie First Date field should be sorted, if 2 date fields are same then sort based on time. if date and time fields are same then need to be sorted on String field.
    So if any one worked on this please throw some light on how to proceed. I know how to sort based on single column.
    But now i need to sort on multiple columns.So what is code change in the Comparater class.
    Thanks in advance.. This is urgent....

    I think your Schedule objects should implement Comparable. Then you can sort your linked list using the Collections.sort() method without passing in a Comparator.class Schedule(Date date, String class) implements Comparable
      public void compareTo(Object obj)
        Schedule other = (Schedule)obj;
        return date.getTime() - other.getDate().getTime();
    }

Maybe you are looking for