Double Sort in Query

Hi,
I have a report which shows Topic, Sub-Topic, and a key figure called Duration.  In my query I sort Topic in Ascending order.  Now, I want to sort Duration in Descending order withtin Sub-Topic only.  So, the original sort on Topic should remain in effect.  I tried using the SAP_BW_URL command to sort on key figures but it removes my sort on Topic.
I want my report to look like this:
Topic____Sub-Topic_____Duration
T1_______S2____________10
_________S4____________3
_________S5____________1            
T2_______S3____________10
_________S6____________9
T3_______S1____________20
Any ideas?
Thanks!

Hi,
You can find more information about "Sorting" in the link:
http://help.sap.com/saphelp_nw04/helpdata/en/1a/25213c9cffa027e10000000a11402f/frameset.htm
i.e: Right click on the characterstics.
With rgds,
Anil Kumar sharma .P

Similar Messages

  • Sorting  named query result

    hi, i am using an amendment method to sort named query results, it works fine for the queries that takes no parameters , but when it comes to a parameterized named query it doesn't work, any idea?

    hi, thank you for your reply,
    1- this is the code of the amendment method:
    ReadAllQuery raq =
    (ReadAllQuery)descriptor.getDescriptorQueryManager().getQuery("findUsersByCompany");
    raq.addDescendingOrdering("name");
    2- what do you mean but how do i execute the query?
    actually i have wrapped the named query in a session bean method, and i have simply dragged the method from the data control into my web page in a readonly table, i pass the parameter in a static manner in the page definition
    3- the result is displayed, no error is showed but it's not ordered correctly
    !!!

  • Need to sort a query 3 times

    Hi,
    I am writing a query as follows:
    SELECT
    GEM_MST.GEMID,
    GEM_MST.LOTID,
    GEM_MST.ASSORTPKTNO,
    GEM_MST.GEMPACKID,
    GEM_MST.S_SHAPEID,
    CO.COLORNAME,
    CL.CLARITYNAME,
    GEM_MST.S_CARATS,
    SUR_PARAM.PRICECT,
    GEM_MST.S_CARATS * SUR_PARAM.PRICECT S_PRICE,
    MUM_PARAM.M_PRICE,
    CARAT * MUM_PARAM.M_PRICE M_PRICE,
    GEM_MST.FACTORYPRICE,
    TAG.TAGID
    FROM
    GEM_MST GEM_MST,
    TAG_GEM_MAPPING TAG,
    GEM_SURAT_PARAMETER SUR_PARAM,
    GEM_MUMBAI_PARAMETER MUM_PARAM,
    COLOR_MST CO,
    CLARITY_MST CL
    WHERE GEM_MST.GEMID = TAG.GEMID
    AND GEM_MST.GEMID = SUR_PARAM.GEMID
    AND GEM_MST.GEMID = MUM_PARAM.GEMID
    AND GEM_MST.S_COLORID = CO.COLORID
    AND GEM_MST.S_CLARITYID = CL.CLARITYID
    AND GEM_MST.S_COLORID = CO.COLORID
    AND MUM_PARAM.ACTIVEFLAG = 'Y'
    AND TAG.ISACTIVE = 'Y'
    AND TAG.TAGTYPE = 'S'
    AND TAG.TAGID = 2
    ORDER BY GEM_MST.S_CARATS DESC;
    As per requirement, i need to sort this query as first on GEM_MST.S_CARATS DESC,
    On the sorted result sort on co.QUALITYORDER ASC,
    and On the sorted result sort on CL.QUALITYORDER ASC
    I have tried :
    ORDER BY GEM_MST.S_CARATS DESC, co.QUALITYORDER ASC,CL.QUALITYORDER ASC
    But its not giving expected result as i require.
    Please do the need full help.
    Thanks in advance.
    Would appreciate your prompt response.
    Regards,
    Vishal
    Edited by: vishal.p on Sep 22, 2010 7:02 AM

    This forum is meant for discussions related to database installs. Pl re-post in a more appropriate forum such as PL/SQL
    HTH
    Srini

  • Sorting a Query of a  Verity search

    I'd like to sort a verity collection's output by the latest
    date of the record.
    The way I did this in CF5 was to query the results of the
    verity search ORDER BY KEY DESC (key being the ID of the record,
    and therefore I got the order the way I wanted it)
    In CFMX it does not allow this, here is the error I'm
    getting:
    Query Of Queries syntax error.
    Encountered "KEY. Incorrect ORDER BY column reference [KEY].
    Only simple column reference, alias name, and integer column
    id are allowed.
    (an interesting note is that when I pass the records ID to
    CUTOM1 the sort works, however, I cannot do that because the way I
    built the results to display is based on the key desc etc.....)
    anyone know why this is and how to get around it?
    Thanks
    Yankee

    What position in your select statemen is the KEY column? If
    it is in the first position, just ORDER BY 1 DESC, if it is in the
    second, ORDER BY 2 DESC, etc.
    Phil

  • Double quotes in query

    Hi
    I get the last query executed using the ora_sql_txt (sql_text) function for some auditing.
    Now on some server I get the last query as
    select columnname from "schemaname"."tablename";
    i.e I get double quotes as extra.
    while on some I get without double quotes
    select columnname from schemaname.tablename;
    Is there some setting in oracle for this.
    I am using oracle 10g
    Sapan

    but when I try executing the query as
    select something from "schema_name"."tablename";
    it gives table not exists errror
    but
    select something from schema_name.tablename;
    returns query as
    select something from "schema_name"."tablename";
    using the function

  • Double entries in Query/mutiprovider

    Hi Friends,
    I have a multiprovider with 2 ODS (BW 3.1).
    When I build a bex query, in the bex analysis (excel) I can find double records.
    Not strange enough, only one of the record contains correct data, the other one contains data with no assignments or missing data..
    It seems the data get doubled but only a few fields.
    I have checked both ODS, the date looking good.
    In identify/assign foobject inmulti provider, do I have to tick the same infoobjcts in both ODS?
    I mean, I have customer number in both ODS, do I have to assign both to the multiprovider?
    Your help is highly appreciated.
    Rg. Jimbob

    Yes, if you have the same characteristics in both the Data providers, please do check those in the Multi Provider from both the sources.

  • Net value becoming double in a query

    Hi experts,
    We have a query based on an Infoset of Sales order header and AR_4.
    In the query output, against a customer the netvalue is becoming double in case of 2 acc doc, 3 times
    in case of 3 acc docs, 4 times in case of 4 acc docs like this it is increasing accordingly.
    How to solve this issue and get the netvalue only once ?
    Regards,
    Nishuv.

    Hi,
    "You will have to use calculated key figure for each of your key figures from the SALES doc cube(in this case net value) in the report and use exception aggregation with reference characteristic as accounting document number."
    Where should i maintain the exception aggregation i.e in the query designer level or while defining the
    key figure properties in modeling ?
    If in modeling, for netvalue in the aggregation tab should i mention the reference characteristic as acc
    doc no or sales doc no and option as Last or ?
    And also after loading data into the cube with these changes how to call that keyfigure in the query ?
    Please clarify these doubts.
    Regards,
    Nishuv.

  • Some Sorting Related Query I am facing....

    I have a class
    Period
    DateAndTime DT; // DT is a member variable
    There can be multiple instances of class Period...I am maintaing
    a vector for storing multiple objects...After vector is populated, I have
    to sort these Period objects (on DateTime-wise)...(I have to line them
    up so that they are in ascending order time-wise)
    I want to add the objects in vector in Sorted-way only, so that I don't have
    to iterate the Whole vector again.....I don't need to do the comparison of DateAndTime of
    Each object with other and then populate the collection again..
    How can achieve it.
    That when a new object comes, I put it into the right place
    depending upon DateAndTime field.....
    I am open to use any other Collection object (other than Vector)..
    Please give me suggestions...
    collection

    hi,
    I have done the following:-
    class Period implements Comparable
    Calender startTime;
    public int compareTo(Object obj) throws ClassCastException
    if (!(obj instanceof Period))
    throw new ClassCastException("A Period object expected.");
    Period prd = (Period)obj;
    if (startTime.before(prd.startTime)
    return -1;
    else if (startTime.after(prd.startTime)
    return 1;
    else
    return 0;     
    ArrayList list = new ArrayList();
    addObjectsInList(Period prd)
    list.add(prd);
    sortObjectsInList()
    Collections.sort(list);
    My Query is
    1) Where should I do handling for ClassCastException..
    In my case, no other type of object would come, but still
    I have added the check for ClassCastException....
    Is it mandatory to have this check or can I leave that
    I have seen many examples of CompareTo on threads in forum/as well as net...where no check has been done for ClassCastException...
    What should I do....Should the exception handling be done
    while I am adding the objects in List or sorting them?
    2) Is there anything else, I need to take care while
    implementing Comparable interface...

  • Initial load of inventory level from csv - double datarows in query

    Hello everybody,
    a query result shown in a web browser seems strange to me and I would be very glad, if anyone can give me some advice how to solve the problem. As I do not think that it is related to the query, I posted it into this forum.
    The query refers to an InfoCube for inventory management with a single non-cumulative key figure and two other cumulative key figures for increase and decrease of inventory. The time reference characteristic is 0CALDAY. The initial load has been processed reading from a flat file (CSV), the structure looks like this:
    Product group     XXX
    Day               20040101
    Quantity          1000
    Increase          0
    Decrease          0
    Unit               ST
    The initial load runs fine, the system fills all the record sets into the InfoCube. Unfortunately I do not know how to look at the records written into the cube, because only the cumulative key figures are shown in InfoCube-> Manage-> Contents.
    Well, when executing the query, a really simple one, the result is just strange, because somehow there are now two rows for each product group with different dates, one with the 1st of January, 2004 and the other for the 31st of December, 2003 containing both 1000 units. The sum is 2000.
    It became more confusing, when I loaded the data for increase and decrease: now the quantities and sums      are correct, but the date of the initial load is a few days later than before, the data table in the query does not contain the 1st of January.
    Does anybody know, what I did wrong or where there is information about how to perform an initial load of inventory from csv in a better way?
    Kind regards
    Peter

    Peter,
    Inventory is not that straight forward to evaluate as it is non-cumulative. Basically it means that one KF is derived from one/two other KFs. You cannot see non-cumulative KFs in manage infocube.
    Have you uploaded opening balances separately? If so, your data for 31st of december is explained.
    In non-cumulative cubes, there need not be a posting for a particular day for a record to exist. For e.g. if you have stock as 10 units on 1st and then no posting for 2nd and 3rd and then increase 10 units on 4th, even for 2nd and 3rd, the non-cumulative KF will report as 10 units (stock on 1st rolled forward).
    There is a how to...inventory management document on service market place that explains this quite nicely.
    Cheers
    Aneesh

  • ITunes double click problem (query bug)

    With the recent iTunes update 7.7.1(11), I noticed that when switching between iTunes (esp. when it is in the compact mode) and other apps, a single mouse click in iTunes is often interpreted as a double click. This leads to distress when I try to pause the current track as the double click action pauses the track then plays it.
    To relieve this symptom, I need to minimize iTunes and maximize it again.
    Anyone else out there with the same problem?
    (sorry about the double post - first time @ the discussion pages)

    i'm having this same problem, but the "auto" double-clicking happens in mac mail. i've checked mouse settings, i've rebooted, but nothing seems to help. whenever i switch into mail, my first click is always treated as a double-click. (very annoying, since it usually opens a message into an unwanted window.)
    another mouse-related problem: sometimes my mac seems to be swallowing mouse clicks. (not in mail, though! maybe that's where all those lost clicks are going! <g>) my mac acts as if i am clicking on a dead zone (that is, a region that doesn't accept clicks). i can click on the region all day (e.g. a tab in safari) and nothing will happen. if i, however, click on something else (even, say, just the background of a web page), the go back to the area that was dead moments before (that tab, e.g.), suddenly it accepts the click.
    any ideas?

  • Help with sorting a query

    Hi,
    I have one table (ctry) with a two columns as below
    ctry - varchar2(2)
    zone - varchar2(6)
    SE
    SE1:1
    SE
    SE1:2
    SE
    SE1:3
    SE
    SE1:4
    SE
    SE1:10
    SE
    SE1:11
    SE
    SE1:5
    If I sort as below
    select ctry, zone
    from ctry
    order by ctry, zone
    I got result as below
    ctry - varchar2(2)
    zone - varchar2(6)
    SE
    SE1:1
    SE
    SE1:10
    SE
    SE1:11
    SE
    SE1:2
    SE
    SE1:3
    SE
    SE1:4
    SE
    SE1:5
    I want result as below
    ctry - varchar2(2)
    zone - varchar2(6)
    SE
    SE1:1
    SE
    SE1:2
    SE
    SE1:3
    SE
    SE1:4
    SE
    SE1:5
    SE
    SE1:10
    SE
    SE1:11
    Is that possible at all when type is varchar2?
    Example table/data:
    create table ctry
    ctry varchar2(2),
    zone varchar2(6)
    insert into ctry values('SE', 'SE1:1');
    insert into ctry values('SE', 'SE1:2');
    insert into ctry values('SE', 'SE1:3');
    insert into ctry values('SE', 'SE1:4');
    insert into ctry values('SE', 'SE1:10');
    insert into ctry values('SE', 'SE1:11');
    insert into ctry values('SE', 'SE1:5');

    Hi,
    So, you have a number stored at the end of a VARCHAR2 column, and you want to threat it as a number when sorting.
    Pleiadian and Blushadow showed hos to actually convert that part of the string to a NUMBER.  If the part of the string after the ':' is not a number, even if that happens on only 1 row, row will get no results other than an error message.  To guard against that, you can pad just the part after the ':' with '0's, like this:
    SELECT    *
    FROM      ctry
    ORDER BY  REGEXP_REPLACE ( REGEXP_REPLACE ( zone
                                              , '(\d+$)'
                                              , '00000\1'
                             , '0+(\d{6})'
                             , '\1'
    The inner REGEXP_REPLACE adds 5 '0's before the group of digits at the end of the string.  (Since the column is defined as VARCHAR2 (6), you'll never have to add more than 5 '0's to get all the sub-strings to the same length.)
    The outer REGEXP_REPLACE removes extra '0's, so that all the numbers that were padded to more than 6 digits are now exactly 6 digits.
    As Blushadow siad, this is only a way of coping with the problem, not solving it.  If the part of the zone after the ':' needs to be treated like a NUMBER, then it should be in a NUMBER column.  Cramming it into the same column with 'SE1' seems to violate First Normal Form.  Why not split the zone into 2, or possibly more, columns?  If you must leave it as 1 column, can you store it in a useable form, so that you don;t need to ask questions like this?  If you must store the data exactly as posted, then add another column that reflect the sort order.

  • How can I double sort my message list? Sort then a sub sort

    I would like to sort my messages by date (or some other category), then sort by another category while keeping the first sort. In other words, a sort within a sort. I'm using TB 24.6.0

    example:
    If you select
    View > Sort by > select: 'From' and 'Descending' and 'Group by Sort'
    You will get a list of names Z at top and A at bottom, with a sublist of emails sorted with newest at top.
    Changing the sort selection from Descending to Ascending will put the names sorted A at top, but the dates per person will be oldest at top.
    As I prefer the emails to be in date newset on top, it means I have to select to have the order of 'From' with A at bottom; depends on your preference.
    Additional:
    If you start by selecting: 'From' and 'Descending' and 'Group by Sort'
    then change sort to 'Ascending', you may notice no change until you hover the mouse over the entire list, this is a known bug.
    Please feel free to Vote for this bug, you may need to logon / tregister.
    * https://bugzilla.mozilla.org/show_bug.cgi?id=497643

  • Sorting of Date field in the SQL Query useing ORDER BY

    Hi
    I am facing a problem when I am getting the results of a query from the ORacle 8i database using jdbc connection.
    The query is having a date field and I have to sort the query results using ORDER By for the Date field. The query is giving exact results in the SQL PLus interface.
    When I am getting this results in the GUI where servlets are being used an Exception is coming as not supported RefreshRow method.
    If anyone has faced this problem and have got the solutions please let me know.
    thanks
    sulfy

    That doesn't sound at all like an SQL problem.
    More like you trying to do updates on the resultset which is not allowed ...
    send a some code (not to much pls :) and we'll be
    able to help more
    cu
    Spieler

  • Multiple columns from a query sorted vertically

    Is it possible to sort a query resultset vertically, with
    multiple columns across the page, in the following manner, with
    page breaks after 40 rows? I can get it to sort horizontally just
    fine with tables, but how can it be done vertically as shown?
    JONES, Abby JONES, Betty JONES, Dawn JONES, Frank
    JONES, Adam JONES, Bill JONES, Debbie JONES, Gayle
    JONES, Alice JONES, Bob JONES, Denton JONES, Henry
    JONES, Ben JONES, Cathy JONES, Emma JONES, John

    This will get you started. I assume you had the appropriate
    order by clause in your query. I also assume you want 4 columns per
    line.
    My approach would be to convert the query to an array and
    then output the array.
    columns = 4;
    maxrows = 40;
    recordsperpage = columns * rows;
    records = query.recordcount;
    myArray = ArrayNew(2);
    ThisColumn = 1;
    ThisRow = 1;
    if (records gt recordsperpage)
    LoopTill = recordsperpage;
    else
    LoopTill = records;
    for ( ii = 1; ii lte LoopTill; ii = ii + 1){
    myArray[ThisRow][ThisColumn] = query.field[ii];
    increment ThisRow;
    if (ThisRow = MaxRows + 1) {
    ThisRow = 1;
    increment ThisColumn;
    } // if
    } // looop
    You can do the rest

  • Sorting query in workbook

    Hi Expert.
    I have a big problem.
    When I insert a query in a workbook this not sort by keyfigure.
    I insert a condition ( TOP 20 for example ).
    If I refresh a query in a workbook this sort correct but if I execute a workbook this is sorted by characteristic.
    My problem is like
    Sorting by a Key Figure in Query Designer
    Anybody find a solution?
    Thank,
    Marco

    add
    I can sort a query using VBA code but the problem is when I have a query with hierarchy.

Maybe you are looking for

  • Multiple Google calendars on one account no longer sync with Palm Pre

    Since the WebOS update in early Sept., the multiple Google Calendars that I own and which appeared on my Pre have disappeared.  I'm left only with the default account calendar.  The calendars which had appeared on the phone are still there in the pul

  • Some images do, some do not appear in Preview or Publish

    Greetings, I imported a FrameMaker file, which generated its own folder and the file with all of its screenshots are in that folder. Within RoboHelp (7, FlashHelp) all images appear as expected. When compiled for Preview or for Publshing, however, so

  • Error #1009, Is this a bug?

    I am using latest build of TLF (418),  when I tried to bind textFlows to the textFlow setter in SimpleEditorPanel(the Adobe example), the textFlows are from an ArrayCollection, the binding looks like: <local:SimpleEditorPanel id="simpleEditor"       

  • Oracle JDBC Driver too old in Oracle WebLogic Server 10.3

    I check oracle jdbc driver bundles in the Oracle WebLogic Server 10.3 The version is too old,and current version is: Oracle Database 11g Release 1 (11.1.0.7.0) JDBC Drivers The question is: Could we replace the old ojdbc6.jar with the current one (11

  • Regarding  working with oracle spatial database connections

    sir/madem, i am an engg student, my final year project on inserting data into oracle spatial database through java /jsp , i am working with oracle spatial database 10g/11g, i want know how to insert/retrive/ manuplute the spatial data into oracle spa