Sorting a KF in report

Hi,
I have a report where I need the report to be sorted on a KF when the report is loaded FIRST TIME.
Please let me know how to acheive that ?

Hi rvn,
One way to do that is to create a condition using TOP N and use a very big data value in N, like 999,999,999. If you use TOP N, then the report will be sorted on this KF in Descending order on the execution of the query.
Or you can also set the property in the workbook and save it.
Hope this helps...

Similar Messages

  • Sorting in Blocked ALV Report

    Hi Experts,
    Can i achieve sorting in Blocked ALV report as we can do in ALV Grid Display.???
    If so, how can this be achieved????
    For example, if there are 3 records with the same value for a field.....say thfreee rows with name 'Gaurav'.
    I want to show 'Gaurav' only in the first row and the other two rows must be empty.
    Gaurav 1 2 3
    Gaurav 4 5 6
    Gaurav 7 8 9
    Should be seen as
    Gaurav 1 2 3
               4 5 6
               7 8 9
    Thanks and regards
    Gaurav raghav

    Here is the code.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = sy-repid
          i_structure_name       = 'ZCRM_ACTIVITY_REPORT'
        CHANGING
          ct_fieldcat            = gt_fieldcatalog[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc EQ 0.
          CLEAR gs_sort.
          gs_sort-fieldname = 'ORG'.
          gs_sort-tabname = 'GT_ITAB'.
          gs_sort-spos = '1'.
          gs_sort-up = 'X'.
          APPEND gs_sort TO gt_sort.
        CLEAR gs_sort.
        gs_sort-fieldname = 'EMPLOYEE'.
        gs_sort-tabname = 'GT_ITAB'.
        gs_sort-spos = '2'.
        gs_sort-up = 'X'.
        APPEND gs_sort TO gt_sort.
      ENDIF.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
          EXPORTING
            is_layout                  = gt_layout
            it_fieldcat                = gt_fieldcatalog
            i_tabname                  = 'GT_ITAB'
            it_events                  = gt_events
            it_sort                    = gt_sort
            i_text                     = 'Report 1 '
          TABLES
            t_outtab                   = gt_itab
          EXCEPTIONS
            program_error              = 1
            maximum_of_appends_reached = 2
            OTHERS                     = 3.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.

  • Sorting images mislabeled in Report Attributes?

    I added some custom images in the Sorting section of the Report Attributes. When I ran the report the images displayed were opposite of what I expected (i.e. the descending image displayed for an ascending sort and vice versa.) Upon further investigation it appears that the labels in the Sorting section are indeed reversed. The descending image is displayed when the sort order is ascending and vice versa. Is this a bug?

    Erik,
    Thanks, this explains it. By specifying the request as part of your URL you run into the recently uncovered issue. The request you're setting is REMFROMLIST and ADD2LIST. You probably either have links that include those requests or you have branches where you specify them. Either way, in order to get reports sorting to work, you'll have to make sure that the request strings are not part of your URL. This is a work-around and the upcoming HTML DB patch release will solve this issue.
    One way of avoiding this is to have computations on the previous pages that set a napplication level or page level item to the REMFROMLIST and ADD2LIST values and then you can use those items for your conditions that are currently evaluating those strings.
    Hope this helps and sorry for the inconvenience,
    Marc

  • How can I get (using API) the current sort column for some report

    hello,
    How can I get (using API) the current sort column for some report ? For example something like "fsp_sort_1_desc" - if the user sorts by the first column ?
    I cannot use the :REQUEST for this, sometimes the current sort column is not in the :REQUEST, but it is still active.
    I thought it was posssible by using
    APEX_UTIL.GET_PREFERENCE (
    p_preference IN VARCHAR2 DEFAULT NULL,
    p_user IN VARCHAR2 DEFAULT V('USER'))
    RETURN VARCHAR2;
    function, but I don't really know which preference should I pass as parameter.
    looking in WWV_FLOW_PREFERENCES$, i saw preferences_names like FSP4000_P527_R6281510839654570_SORT , I'm not sure how this name is formed.
    I'm using generic columns for that complex report (which has a flexible number of columns shown), and the idea is that sometimes I have to overwrite that sort column, in case the user chose the version of the report with fewer columns than the previous one.
    Can I get (using API) a list of all preferences set for some user ?
    Thank you,

    seems that it is FSP<app_number>P<pagenumber>R<regionnumber>_SORT.
    is there anyplace where I can get these kind of things documented ?
    Thank you.

  • Sort field in ALV report

    Hi Expert,
    IN  ALV report using RESUE_ALV_GRID_DISPLAY . I want to sort the second field of ALV output . In this function module  RESUE_ALV_GRID_DISPLAY  using event PF_STATUS . so can u tell me how sort the second field .
    Regards
    Bhabani

    Hi,
    check the fallowing code
    IT_SORT TYPE SLIS_T_SORTINFO_ALV,
    WA_SORT TYPE slis_sortinfo_alv,
    ****SORT LABELS AT RUN TIME
      WA_SORT-TABNAME = 'IT_FINAL1'.
      WA_SORT-FIELDNAME = 'BUDAT'.
      WA_SORT-UP = 'X'.
      WA_SORT-GROUP = 'X'.
    WA_SORT-subtot = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-TABNAME = 'IT_FINAL1'.
      WA_SORT-FIELDNAME = 'MATNR'.
      WA_SORT-UP = 'X'.
      WA_SORT-GROUP = 'X'.
    WA_SORT-subtot = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM               = SY-REPID
          I_CALLBACK_TOP_OF_PAGE           = 'TOP_OF_PAGE'
          IS_LAYOUT                        =  LAYOUT
          IT_FIELDCAT                      = IT_FIELDCAT
          IT_SORT                          = IT_SORT
          I_DEFAULT                        = 'X'
          I_SAVE                           = 'U'
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
         TABLES
           T_OUTTAB                        = IT_FINAL1
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Regards
    Nandan.N

  • Issue with sorting in a PPR report

    Hi:
    I have a report based on a query that references a view whose defining query references a remote table. I have the columns of this report enabled for sorting and there is no default sort column specified
    All is fine when the page containing this report is called up for the first time. The problems start once I click a column heading to sort the report by that column. The report then renders with fewer than 15 rows (the rows per page value) and hence the pagination links disappear. if I now click a different column heading then more than 15 rows are shown again. I cant say whether the truncation of the result set ihappens only when sorting by a particular column. It does appear to be random. Surprisingly, if PPR is disabled then this bizzare behaviour is not seen.
    Any idea what is going on here ?
    Varad

    Hi Carl:
    I have posted the page at apex.oracle.com. The URL is http://apex.oracle.com/pls/otn/f?p=23548:22
    However, the problem doesnt manifiest itself here.
    Further investigation on my side leads me to believe that it is the contents of one of the columns displayed by the report (column named STMT) that appears to be the culprit. I remove this column from the report and all is well. The column contents are pl-sql/SQL statements. I cant understand why the contents of the column should matter.
    Thanks for your response.
    Varad

  • Sort problem in a report

    Hi,
    I'm using the sort on a report with 7 columns. For each column I've specified
    the sort sequence from 1 to 7. The last sort is a date field. If i sort now the
    last column and i change to next report side the sort change jump to the first column.
    Is there somebody who had also a problem like this?
    Greets,
    Tom

    You can check boxes to determine which columns can be sorted; if you check one or more boxes, you also need to set the "Sort Sequence" attribute under the "Report Attributes" tab of your SQL query region. So to use sorting you must.
    1. ensure you don't have an order by in your SQL statement
    2. check one or more "sort" boxes
    3. set the default order in one or more column in the "sort sequence" column
    Hope this helps,
    Mike

  • Sort columns in matrix report

    Hi all
    I create matrix report( in version 9i)
    I want sort columns of report
    when i use order by it sort rows but i want sort columns
    my query is like this:
    SELECT
    Code,
    name,
    DECODE(cons_code, '1', 'A',
    '2', 'B',
    '3','C',
    '4', 'D',
    '5', 'E') Activity,
    SUM(amnt) amount
    From Mytable
    Where ....
    group by
    Code,
    DECODE(cons_code, '1', 'A',
    '2', 'B',
    '3','C',
    '4', 'D',
    '5', 'E')
    my group base on code
    my columns base on Activity
    and cells are Amount
    my report result is:
    ........ B E D A C
    name1 1 1 1 1 2
    name2 3 4 8 6 1
    I want this :
    ........ A B C D E
    name1 1 1 1 1 2
    name2 3 4 8 6 1
    ....

    Hello,
    How about this?
    SELECT Code, name,
    DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D','5', 'E') Activity, SUM(amnt) amount
    From Mytable
    WHERE ....
    GROUP BY Code, name, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')
    ORDER BY code, DECODE(cons_code, '1', 'A', '2', 'B', '3','C', '4', 'D', '5', 'E')

  • Sort in Cross-Tab report

    I have a cross-tab report that lists dates as headers and employees as rows. The data at every cell shows the qty (it is like timesheet report). The totals are shown for every row and column. The report layout looks something like this:
    ----------- <date> <date> <date> .... <Total>
    <name> <qty> <qty> <qty> <qty>
    <name> <qty> <qty> <qty> <qty>
    <name> <qty> <qty> <qty> <qty>
    <Total> <qty> <qty> <qty> <qty>
    The report definition looks like this (I numbered the columns to make it easier to write about them):
    01: <?horizontal-break-table:1?>
    02: <?for-each-group@column:EMPLOYEE_TIME;./TRANSACTION_DATE?><?sort:TRANSACTION_DATE;'ascending';data-type='date'?>
    03: <?TRANSACTION_DATE?>
    04: <?end for-each-group?>
    05: <?for-each-group:EMPLOYEE_TIME;./EMPLOYEE_NAME?><?sort:EMPLOYEE_NAME?><?variable@incontext:G1;current-group()?>
    06: <?EMPLOYEE_NAME?>
    07: <?for-each-group@cell://EMPLOYEE_TIME;./TRANSACTION_DATE?>
    08: <?sum ($G1[(./TRANSACTION_DATE=current()/TRANSACTION_DATE)]/TRANSACTION_QTY)?>
    09: <?end for-each-group?>
    10: <?sum ($G1/TRANSACTION_QTY)?>
    11: <?end for-each-group?>
    12: <?variable@incontext:T;.//EMPLOYEE_TIME?>
    13: <?for-each-group@cell://EMPLOYEE_TIME;./TRANSACTION_DATE?>
    14: <?sum (current-group()/TRANSACTION_QTY)?>
    15: <?end for-each-group?>
    16: <?sum ($T/TRANSACTION_QTY)?>
    The XML data is not sorted in any way and the report sorts it by employee and date. As you see at the line 02 I applied the sort by the transaction date. The sort works as expected, however the actual QTY are not showing at correct cells. If I remove sort it works fine but the dates are in random order. I suspect it is because I sort transaction date at header level and the QTY is not aware about it. I tried to apply the sort at line 07 but it does not help.
    Does anyone has any idea how to get this report to display data correctly?

    I have a SR which has associated bug 6131270.
    Here is the latest from my SR:
    UPDATE
    =======
    Hi Tomas,
    The bug has been updated. Development has recommended
    "You also need the patch from bug 4332399 to solve the java.util.EmptyStackException. "
    Please review above bug if you have access.
    Please consider applying Patch 4332399 - XSL:SORT FAILED IN A 2 LEVEL XSL:FOR-EACH-GROUP CASE
    Backport is included in patch 5840358 for EBS customers.

  • Sorting of columns in report with values from lookup table (LOV)

    Hi,
    I have a report where I looku the values using a number of LOVs. I'd like to enable sorting on those columns in the report whihc works BUT the report get's sorted on the numric looku pvalue instead of the description for example COUNTRY_ID instead of COUNTRY_DESC.
    I have played around with the function APEX_ITEM.ITEM_TET_FROM_LOV in my SQL query:
    select ID, NAME,
    APEX_ITEM.TEXT_FROM_LOV(COUNTRY_ID, 'COUNTRY_LOOKUP') COUNTRY,
    from VAR
    But I get the following error:
    report error:
    ORA-06550: line 1, column 13:
    PLS-00103: Encountered the symbol "COLLECT" when expecting one of the following:
    := . ( @ % ;
    ORA-06550: line 1, column 82:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    . ( , % from
    So I am thinking that I am doing something very wrong? Is there another way to accomplish this?
    Andy

    you need to use htmldb_item.text_from_lov in your query.
    this will then deocde the key value to the description within the query itself and therefore allow you to do your sorting.

  • Dynamic sorting in Cross Tab Report

    I have 2 cross tabs in a report with element linking that filters data in 2nd report when I click on values in the first. I'd like a way to be able to sort the results in the 2nd cross tab in ascending or descending order dynamically.
    Please see image below (click image for better quality) for a detailed representation of the problem.
    Is this possible?

    Right click on crosstab and go to Crosstab Expert and in the columns click on "group options" button and in the options tab select "Use a formula as sort order" and write the condition like this
    if {?Parameter}="Ascending" then
    crAscendingOrder
    else
    crDescendingOrder
    Hope this helps!
    Raghavendra

  • Report not initially sorted as defined by Report Attributes "Sort Sequence"

    I have a Report Region with Type SQL Query and Source "SELECT * FROM <table>" where <table> has a primary key from a sequence. Under Report Attributes, I have Report Column "ST_NM" with Show and Sort checked and having a Sort Sequence of "1". I assume this is to set the iniital display sequence but regardless, the report rows display in Primary key order initially.
    To try it: http://apex.oracle.com/pls/apex/f?p=21997:2 with Dever/Ima9Dever
    1) How do I set the initial display sequence to be other than the primary key sequence?
    [Note: It seems to work part (or all?) of the time under our 4.1 implementation.]
    Thanks,
    Howard
    I thought this one would be easy!

    Howard (DBA in Training) wrote:
    I have a Report Region with Type SQL Query and Source "SELECT * FROM <table>" where <table> has a primary key from a sequence. Under Report Attributes, I have Report Column "ST_NM" with Show and Sort checked and having a Sort Sequence of "1". I assume this is to set the iniital display sequence but regardless, the report rows display in Primary key order initially.
    To try it: http://apex.oracle.com/pls/apex/f?p=21997:2 with Dever/Ima9Dever
    1) How do I set the initial display sequence to be other than the primary key sequence?
    [Note: It seems to work part (or all?) of the time under our 4.1 implementation.]Standard reports store sort columns persistently across sessions as user preferences. It's likely that Dever user has at some point clicked to sort on the PK column and created a persistent preference. Try it with a new user that has never viewed the page before...
    See +{thread:id=2433320}+ for more on this, including how to reset it.

  • Sort order problem in reports

    Dear members,
    I have report with a field name sort_order but it don't show data in asending order, but first sort another column item_name in asending order.
    the sort_order is number
    item_name is char
    order by property of number is asending and item_name is none.
    both in same group.
    where I am wrong?
    Regards:

    hi O.Developer,
    here is my query:
    select MILL_ORDER, mill
    from tran_master
    group by MILL_ORDER, mills
    order by Mill_order, mills
    Mill Sort Order
    MILL1 1
    MILL2 2
    MILL3 3
    MILL4 6
    MILL5 7
    MILL6 8
    MILL7 10
    KP1 11
    MILL9 12
    DBL 13
    FAT 14
    BUT the above query gives the following out put:
    Mill Sort Order
    MILL1 1
    MILL2 2
    MILL3 3
    MILL4 6
    MILL5 7
    MILL6 8
    MILL7 10
    MILL9 12
    DBL 13
    FAT 14
    KP1 11
    regards:

  • Sort function in web report using servlet

    Dear all
    Please help me this out. I'm doing an online report using servlet. When the report is displayed as a table on the web, is there a way to have a sort function-when you click on the tabs, it will sort the data accordingly.
    If I didn't state my question clearly, please let me know.
    Thank you all for your kind help!
    Grace

    You could probably do that using Javascript, but it's beyond my competence to even suggest how. Alternatively you could make the tabs behave as buttons that send a "sort me" request to the server, which would send out new, resorted, HTML.

  • Problem  in  specifing the intial sorting column of  a report

    hi
    we have a report based on a table with 6 columns in our home page .we display all the six columns as sortable.
    we also need to sort the contents of the report by 4th column by default when ever the user logs in ,but what happens is ,report gets sorted automatically depening upon the previous sorting column selected
    is there any way of telling htmldb to sort the report by 4th column ..
    many thanks
    S.Jawahar

    hi ,
    this infotype has a interesting solution . In my case it was  for US country .
    We select the veteran status and this is field P0077-VETST  which is stored in DB table .
    Now based on this value and the molga of that pernr  we need to look at the T5UVT table for the combinations avaliable for MOLGA AND  VETST .
    Based on the config's of this table the screen values are getting populated .
    It dosent allow any combinations and the picked values are passed to the screen for fields Q0077-VETS1 VETS2 VETS3 VETS4 .
    Br,
    Vijay.

  • Need to sort results in a report in descending order

    Hi,
    We have OIM 10g and we need to sort the report on date in descending order. I tried this code but still the column is not getting sorted.
    Evertime I generate the report, the results are sorted only in ascending order.
    Here the stored procedure code for sorting:
    strOrderByClause := 'abc.date';
    IF strsortorder_in = 'DESC' THEN
    intSortDirection_in := 0;
    ELSE
    intSortDirection_in := 1;
    END IF;
    Please let me know if you have faced similar issue.
    Thanks,
    Kalpana.

    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

Maybe you are looking for

  • How do you browse transparenly with Firefox?

    We have an issue where some die hard Firefox users are having trouble getting to certain internet sites, or heck certain e-mails cause these same popups by just trying to read the message. Problem is that these individuals will get a pop up box askin

  • Itunes match hangs up

    iTunes Match hangs up....on the first Song of 1700 Songs to down/upload. Everytime i start Itunes, it fetch up my informations about my music....but it stops uploading on the first Song of 1700. Where is the Problem? And where can i get back my money

  • There is no iweb folder in application support

    there is no iweb folder in application support. Why?

  • Installing PS Elements 11 from disk

    I am blocked from installing PS Elements 11 on my Mac by a notice that I must close:      elementsautoanalyzer      dynamiclinkmanager I have no idea where these programs reside on my computer nor how to close them. Help? Thanks.. Jack

  • Two comment box one page

    hey does anyone know how to create two comment box opposing each other i'm trying to make a debate site and i want to be able to have two comment box on that people see each other comment of depending on each each box you comment in and have it conne