Group Sort ALV

Hi,
Is it possible to group sort on ALV?
it seems we are able to merge together several rows via sort but only on its field level.  is it possible to be a group field level?
example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO.  Can we make the PO number as the first priority sorting without changing the position of the fields?

c z wrote:
Hi,
>
> Is it possible to group sort on ALV?
>
> it seems we are able to merge together several rows via sort but only on its field level.  is it possible to be a group field level?
>
> example if i sort PO number first and vendor second it will have individual PO and the vendor field is merge together if it is the same with a different PO.  Can we make the PO number as the first priority sorting without changing the position of the fields?
If I have understood your requirement correctly, group sorting should be as simple as filling up the 'IT_SORT' parameter(REUSE_ALV_GRID_DISPLAY/REUSE_ALV_LIST_DISPLAY/CL_GUI_ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY)
as shown below: (please let me know if I have misunderstood your requirement).
ls_sort-spos = '1'.
  ls_sort-fieldname = 'FIELD1'.
  ls_sort-up = 'X'.
  APPEND ls_sort TO it_sort.
  CLEAR ls_sort.
  ls_sort-spos = '2'.
  ls_sort-fieldname = 'FIELD2'.
  ls_sort-up = 'X'.
  APPEND ls_sort TO it_sort.
  CLEAR ls_sort.
Even after displaying the ALV, columns can be group sorted by selecting all of them together(by dragging the cursor over all the columns that need to be sorted)
-Rajesh.

Similar Messages

  • Print Issue with Sorted ALV Grid

    Hi Team,
    I am using ALV display for my Program. Iam using REUSE_ALV_GRID_DISPLAY. Also i have a Sorting condition for my ALV grid. So iam filling the Sort table & passing it to the Function module. The data is displayed correctly with Sorting as required in the Output.
    Now the issue is with: Print from this ALV. When we try to print the data, The requirement is that the Print should be same as how it is displayed in the ALV. "Grouped Columns"..... But now, the Print is that all the data is filled in all the columns. But user wants the Print also to appear  same as it is shown in a Sorted ALV display.(With some similar column data missing in succeding sort columns until new entry starts)
    Please suggest a solution to acheive the same.
    Thanks & regards,
    Chaitanya

    Look at Q#19 in the note 1009650. Merging functionality is available only for ALV grid display.
    Related Note: 447055
    Work around would be to display the excel in the SAP window (Excel in Place)  and print it from Excel. Read the following thread to make the necessary settings to make it work. Download Report exactly same as seems with Layout set !!
    Edited by: Jeevan Sagar on Jan 19, 2012 12:38 AM

  • Problem in Grouping the ALV output

    Hi Experts
    I want to group the ALV Grid output Division wise
    for that I have written following code
      wa_sort-spos = '1'.
      wa_sort-fieldname = 'REGIOAREA' .
      wa_sort-tabname = 'IT_FINAL' .
      wa_sort-up = 'X'.
      wa_sort-group = '*'.
      wa_sort-subtot = 'X'.
      APPEND wa_sort TO it_sort .
      CLEAR  wa_sort.
    I m passing it_sort table in the FM for sorting but output is not getting grouped can you please
    tell me what is the problem ?
    How to group the report ?
    Helpful answers will be highly rewarded
    Regards
    Bikas

    Hi ,
           I also have the similar way coded .
      DATA: s_sort TYPE slis_sortinfo_alv.
      CLEAR s_sort.
      s_sort-fieldname = rv_fieldname.
      s_sort-spos = rv_spos.
      s_sort-up = c_x.
      s_sort-group   = c_underline.
      APPEND s_sort TO rt_sort.
      CLEAR  s_sort.
    I don't have a subtotal for that fiels .
    It works for me .

  • How to keep selection (or select) the row of SORTED ALV table?

    Dear Experts,
    I have WD ALV table with grouped and therefore sorted layout. I know that sorted ALV beahve differently.
    The problem is that if the values in cell is updated (setting attribute of selected element of context node bound to the ALV table), then the whole table is redrawn and selection disappears. It does not happen when layout of ALV is not sorted/grouped.
    I need somehow to select the ALV line again. Method MOV_To of IF_WD_CONTEXT_NODE for some reason is not working in sorted ALV (it selects element on node but not in ALV table). And in ALV Interface controller I also could not find anything usefull.
    Thanks.
    Best regards,
    Dmitry.

    Hallo Dmitry,
    See the sap note :1445428
    [https://service.sap.com/sap/support/notes/1445428|https://service.sap.com/sap/support/notes/1445428]
    Follow this thread which suggest a work around.
    [ALV Table set lead selection while sorting is enable for a column|ALV Table set lead selection while sorting is enable for a column]

  • How do I change the number in a Top N Group Sort

    I have a report that I have grouped on a particular field (Cust.Name specifically). I then used the group sort expert and selected the Top N selection in the combo box under the Cust.Name tab. I put in a default number of 20. What I want to do is to set this number for the Top N group sort via .NET. Does anyone know the correct method for doing this in either VB.NET or C#.NET. I am using VS 2005 Pro and the embedded Crystal Reports engine for VS.NET. Thank you.
    Ed Cohen

    Hello, Edgar;
    In the bundled version of Crystal Reports 10.2 in Visual Studio .NET 2005 you will need to use the following code:
    Private Sub Set_TopN()
            Dim TopNSortField As TopBottomNSortField
            'Get the Sort field by index
            'Cast it as a TopBottomNSortField
            If TypeOf crReportDocument.DataDefinition.SortFields.Item(0) Is TopBottomNSortField Then
                TopNSortField = crReportDocument.DataDefinition.SortFields.Item(0)
                TopNSortField.NumberOfTopOrBottomNGroups = 10
            Else
                TopNSortField = Nothing
            End If
        End Sub
    In a full version of Crystal Reports there is an option to create a parameter as a number such as {?TopN} and then pass the value to it at runtime.
    In the Crystal Reports designer you need to create the parameter and then go to Report|Group Sort Expert.
    Choose TopN based on your field.
    Where N is... You will need a number there. I used 1. But then I clicked on the Formula editor [X+2] and added the parameter field {?TopN}.
    Passing the parameter at runtime ran the number I requested.
    Elaine
    Edited by: Elaine Dove on Mar 3, 2009 12:12 PM

  • Sum of a sum when using Top N in the Group Sort Expert

    Hi All,
    I have a small problem I can't quite seem to work out.
    I have a report where each line is for a particular Product, and is a summation of the Sales for that Product over several Locations. When you click on the line, it shows the breakdown of Sales over each Location.
    I use the Group Sort Expert to display the Top N results, where the 'N" is set in a formula to a parameter passed in to the report, so the user can select the top 5,10,50 etc. Products across all Locations.
    At the bottom of the report, I want to have a sum of a column of Sales $. I need that sum to only be a sum of the Top N records selected.
    Since each line is a summation of the all the products for the Locations, what I need is a sum of that sum for the Top N, but Crystal will not let you add the sum of a sum, so I'm not sure how to accomplish this.
    If I just do a sum of the underlying values I get a total for all the Products, regardless of the Top N.
    Hope that makes some sense !
    Many Thanks
    Paul

    Hi Sastry,
    I tried your suggestion, thanks, but I don't think it's the answer. For a start Crystal will not let me do that, it pops up a message box when I try to run the report "A running total cannot refer to a print time formula. Details: Record Number". I also added the record number field next to the lines in the report to see what the result would be, and I don't think it would work anyway.
    Here is an example using Units sold:
    Product Name--LocationUnits Sold--Record Number
    Product A -<All Stores>----8
    Store A--1--
    1
    Store B--3--
    2
    Store C--4--
    3
    Product B--<All Stores>--3      
    Store A--2--
    4
    Store B--1--
    5
    Product C--<All Stores>--
    1
    Store A--1--
    6
    Note that only the bold lines are shown in the report,. If you click on the bold line, then the breakdown of the stores is shown. For the above example, I am showing the Top 2 units across all stores (so Product C is not shown at all), but there are actually 5 records, so if I used a formula where RecordNumber <=N, where in this case N=2, I would get a total units sold of 1 + 3 (records 1 and 2) which is incorrect.
    I will have more of a think on this and see if I can find a solution, in the mean time, any other suggestions ? Is there some wya of checking if the line is visible maybe ?
    Thanks for your time !
    Paul

  • Group Sort on formula field

    I am using CR Professional 11.5 on Windows XP/Progress platform.
    I have a formula field that calculates the GM% on the Employee Group Footer level and want to sort the employees in descending order by GM%.  I have gone in circles trying to calculate this field differently in order to be able to perform a Group Sort but this GM% cannot be summarized, which would allow me to use the Group Sort Expert.
    The fact that GM% is used in businesses world-wide each and every day makes this unbelievable that it should prove to be this difficult.  Is there something that I am missing as a newbie to CR design? 
    Any help provided is greatly appreciated!
    Marlene Human

    That's so awesome!  If only I knew how to use sql commands!  Everytime I try to create one it has errors that I dont' understand.  Do you know of a site for sql syntax that might help me to do this?  I have looked and can't find what I need to make this happen.
    So what I need to do is to use 'Formula Workshop' and create a new SQL Expression Field?  Using the formula above, how would this look in SQL?
    Thank you so much for your help...I am so grateful!!!  I have been working on this for months and keep hitting this snag.  I first started out using a cross-table and got confused because you can't summarize the GM% so I then changed the summary to 'weighted average of GM% with Tech/Rev' so that helped, but the Total per Employee has been keeping me stumped. 
    Thanks again.

  • Group/Sort Summary Totals for Duration % Complete not working

    Hello, I'm new to this forum and have used p3 off and on years ago and had some exposure to p5, my background is more toward Project Controls - Cost management rather than scheduling. Here is my issue/question: I was told by the PM not to baseline the schedule (I know, I should have but I didn't, I did as I was specifically requested), that is a topic for another day, however. I am trying to understand the process of the % completes on my resource loaded schedule which all activities are set to duration percent complete. The schedule has roughly quarter of the activities which have been actualized, but my issue is with the "Summary Totals" of the duration % complete when I select that option in the Group/Sorting. All of the activities in a group for example will show 0% complete but the Summary Total of those activities will show greater than 0% or some of the activities duration % completes show a value greater than 0% but the Summary Total of those activities show 0%. What is causing this and why are they not consistent? Any help is greatly appreciated!
    Shannon

    I'm currently showing the duration % complete with a renamed label. The total is not rolling up to the summary. I've also discovered that the unit % complete is not calculating correctly too I believe. For example: I have 3708 budgeted hours and have expended 656 hours and the Unit % Complete is showing 19.08% when I would have thought that the % would have been calculated based on Actual Units (656) / Budgeted Units (3708) totaling 17.69% not 19.08% which it is showing. I cannot find in the reference manual how the percent completes are calculated for units nor in the help section of the software itself either. An explenation would be greatly appreciated!
    Shannon

  • Use parameter to specify "N" in Top N Group Sort

    I've successfuly set up a parameter which is passed to the Group N Sort criteria.
    Is there a way I can use this to set NO group sort? I've tried setting it to zero & 999999999 but it falls over.

    I think you can enter the values only between 1 to 32767. You can try creating a sample report with groups in it and go to group sort expert and select top N and try to add the value 0 then you will get a popup saying "Please enter an integer between 1 and 32767"
    Regards,
    Raghavendra

  • GROUP SORT PARAMETER

    I have a report with a group sort of the "Top N" items based on profit.  I already have a parameter that allows the user to specify the "N", but I want to also give the option to change the group sort based on sales or units sold.  Is there a way to do that?

    hello all,
    actually Brian's solution is correct...i use this method all the time.
    add two more steps to his solution...you should have created a formula with syntax
    Select {?GroupField}
       Case "Sales" :{table.SALES}
       Case "Units Sold" :{table.UNITS_SOLD}
       Default :{table.SALES};
    1) now add this formula to the details section, right click on it, and add a Summary, type = Sum.
    2) now go to the Group Sort Expert and add the formula, removing any other sorts in there already.
    you can now sort the groups on this formula that he gave you.
    if you have crystal reports 2008 or 2011 you can also use Interactive Sorts instead of using a parameter / prompt.
    cheers,
    jamie

  • Group sort using 2 fields

    Is there any way that I can have two fields as a group sort in order that the first group sort field will repeat when the second field changes?
    Thanks.
    Leah

    One possibility would be to create a calculated item (ItemA||ItemB), and use that as a hidden group sort. Not sure about your platform, but in Desktop, you need to specify the item as a 'group' sort, then change it to 'hidden'. You would still display your original items, but don't sort on them.

  • Group Sort Option

    I have a formula on a group level.  That is in basic sum(x)-sum(y)/sum(y).
    I need to use this as a group sort option and it does not seem to allow me to

    Hi Brian,
    In order to sort with the result of sum(x)-sum(y)/sum(y) use the group sort order based on sum(x). Since we cannot sort on the result of the formula that contains summaries.
    Thanks & Regards,
    Raghavendra.G

  • Group Sort Expert Top N

    In Group Sort Expert I have a group called @Sku and I want to select the top 500 based on Sum of @SortByData which works except the totals are for the whole group and not just the top 500.
    Also I would like to select Ascending/Descending based on a parameter field IN the Group Sort Expert since I'm using a based on field (not in Group Expert Change Group Options).

    Hi sharonamtowler,
    My requiremnet is TOP N Materials based on the Current Availiable Stock in each Plant.  In CR from my db, I get four records in Details section for each Material (on 4 weeks, let say 48,49,50,51 ) of a Plant.
    I have grouped on Plant & material. 
    But to get Top N Materials I have to do Summation(Current Availiable Stk) which mean in My Material Group Section I get the Sum of Current availibale Stock of 4 weeks. But I need Top N based on the last weeks Current Availible Stock.
    How to do this?
    I left Plant in Group Sort Expert with No Sort and on Material I have given TOP N.
    I need to know whether only Summation Values should be used in Group sort expert ?
    please some help me solvethe issue.
    Edited by: KRISHNA CHAITANYA B on Dec 29, 2009 6:12 AM

  • Group Sort Filtering

    Hi
    I have a report which has a group sort on number of days sickness leave for employees over a period of a year .
    Is there a way of setting a condition on the group (sub) total to exclude total sickness less than 8 days and the individual lines that make up the sub total?
    Or could you advise of an alternate way to do this.
    So to recap I need to exclude employees whose sickness total for a year is less than 8 days.And the report lists individual entries of sickness for a year by employee.
    I am using Discoverer Desktop version 4.
    Thanks
    Edited by: user650649 on 23-Jul-2010 02:28

    Hi,
    In general, you can do this by using an analytic sum function in a calculation. So you would calculate the total number of days sickness partitioned by the employee and the year. You can then include this calculation in a condition to exclude all the records where this total is less than a given value.
    Regards,
    Rod

  • Group sort

    Hi
    I have a date field and i did a group sort on that feild, for some reason its not giving me the months in order.For example
    the result must be like below
    JAN 08
    FEB 08
    MARCH 08
    APR 08
    Instead its showing
    MARCH08
    JAN08
    APRIL 08
    FEB 08
    please any advice will be of great help.
    Thanks

    You can display the data any way you want, but if you sort on a date that is in a "Month, Year" format, they will sort alphabetically. You need to sort on the numeric month to get things to display in standard calendar order.
    Show the date as you want, but sort on a calculation that uses the numeric month (and do not sort on the date being displayed). When setting up the sort, check the "Hidden" box, and the column will not be displayed.

Maybe you are looking for

  • Cannot connect to local Oracle11g manually?

    Dear, I installed Oracle 11g on WinXP SP2 machine using localhost with only 1 database SID="EBIZ". There are 2 services called OracleOraDb11g_home1TNSListener and OracleServiceEBIZ. By default, these services have startup type as Automatic, and I can

  • Reporting Posts to the Moderator

    There are several occasions that may warrant the need to report a post to the moderator, for either editing or removal.  It is important that all forum users know how to do this.  We all are prone to spelling mistakes, uploading incorrect files, or a

  • Adobe CS4 Installation Vista, WONT?

    Hello out there whoever reading this, I am new on this forum. :) I would ask if any of you guys have/had the same problem as me, when I press the exe (installation file) and when i gave premissions to install the program, nothing pop-up how come? I t

  • Can't sync cause of unknown error 13019

    I just updated my i-pod touch with 3.1.3 and now when I try and sync it won't finish and all it says is unknown error 13019. I have restarted my computer and changed USB cables. Everything is updated, I don't know what to do.

  • Apple Mail client app (version 8.0) using 100%+ of CPU upon using mail drop (13" R-MBP running Yosemite 10.10)

    Hello Support Community, I am having quite the interesting issue. I have read plenty of reports where users' Apple Mail app is using 100% of CPU. This did not start for me until I went to go use the new mail drop feature in Yosemite. I am running Yos