ALV sort/group disfunction ?!

Hi there,
I'm a bit helpless because of the sort/group function my ALV should do. Current situation is that I'm using an CL_GUI_ALV_GRID.
CALL METHOD gr_config_alv_1_2->set_table_for_first_display
    EXPORTING
      is_layout                     = ls_layout
    CHANGING
      it_sort                       = sort_table
      it_outtab                     = config_1_2_table
      it_fieldcatalog               = cat_config_fieldcat_alv
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3.
  IF sy-subrc <> 0.
    EXIT.
  ENDIF.
So you can see that I'm using it_sort to tell the ALV how to sort the it_outtab. [Result looks like this|http://fabianvogt.com/alv_1.jpg].
What the it_sort does is sorting the it_outtab ASCENDING for the coloum "GRP" (display-name: "Bezugstyp"). So far so good...But I know that CL_GUI_ALV_GRID normally does some kind of grouping by merging cells with the same content. [This would look like that|http://fabianvogt.com/alv_2.jpg].
In my case it does not work and I don't have any idea why. I searched the CLASS for a hint or maybe an attribute which has to be filled/flagged to do this kind of grouping.
Looking forword to your help!

Hi everyone!
I've checked BCALV_TEST_GRID. Basically they do it the same way I'm trying. I found out that I have the possibility to set ls_layout-no_merging to control, whether cells with the same content are merged or not. By default no_merging is set SPACE, so the cells should be merged - NOT in my case.
Even if I set no_merging  =  '  ' (SPACE) manually, the merging won't be done.
Running out ouf ideas ...
NEWS:
I did some kind of a workaround, in my opinion even a nicer way to realize my purpose. So take a look at what I did right now:
(take a look at the screenshots in my previous posts for your better understanding)
- The old 'GRP' field (old content: 'B',' K', 'M') is now filled with 'Belegbezug', 'Kundenbezug', 'Materialbezug' and is set NO_OUT (fieldcatalogue).
- I insterted a field called 'CNT' type I, which i use to create Totals/Subtotals.
- NO_TOTLINE  = 'X' (Layout) --> total line is not shown; only subtotals
- TOTALS_BEF (Layout) --> subtotals are placed on top
[So this is what I got now|http://fabianvogt.com/alv3.jpg]. Much better than before!!!
My only problem is now, that the 'CNT' coloum looks pretty ugly and has no function except doing the sum thing.
I tried to make it invisible using the fieldcatalogue (NO_OUT / TECH), but then the total lines disappear :/
Any suggestions?
Edited by: Fabian Vogt on Oct 4, 2010 4:35 PM

Similar Messages

  • Sort-group in alv

    hi wat r the possible values tht can be passed for sort-group variable in alv report

    The only possible values for this field are.....
    *     Page feed    (incl. underline)
    UL     Underline
    This comes directly from the domain SLIS_CTRLS which is tied to this field.
    Regards,
    Rich Heilman
    Message was edited by:
            Rich Heilman

  • ALV Sort

    Hi Guru's
    i am use alv sort in my report .
    i use following code.
    but it gives me DUMP ERROR.
    my code like this.
    DATA : it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    FORM do_sort .
      it_sort-spos = 1.
      it_sort-fieldname = 'vbeln'.
      it_sort-tabname = 'it_vbak'.
      it_sort-up = 'X'.
      it_sort-subtot = 'X'.
    it_sort-group = '*'.
    it_sort-expa = 'X'.
      APPEND it_sort.
      it_sort-spos = 2.
      it_sort-fieldname = 'posnr'.
      it_sort-tabname = 'it_vbap'.
      it_sort-up = 'X'.
      it_sort-subtot = 'X'.
    it_sort-group = '*'.
    it_sort-expa = 'X'.
      APPEND it_sort.
    ENDFORM.  
    please tell me where is the error.
    Thanks in advance.
    Regards.
    Sam.

    Hi,
    Try the following code
    DATA : it_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
    FORM do_sort .
    it_sort-spos = 1.
    it_sort-fieldname = 'VBELN'.
    it_sort-tabname = 'IT_VBAK'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    it_sort-group = '*'.
    it_sort-expa = 'X'.
    APPEND it_sort.
    it_sort-spos = 2.
    it_sort-fieldname = 'POSNR'.
    it_sort-tabname = 'IT_VBAP'.
    it_sort-up = 'X'.
    it_sort-subtot = 'X'.
    it_sort-group = '*'.
    it_sort-expa = 'X'.
    APPEND it_sort.
    ENDFORM.
    Hope this will have u.
    If it is helpful provide point.
    Thanks.

  • Sorting /Grouping Issue: Single Artist Compilation Album Doesn't Group

    iTunes 8 Sorting / Grouping Issue
    EXAMPLE
    • Album: Essential Willie Nelson
    • There are 22 songs on this Disc
    • 19 of them are labelled "Willie Nelson" in the artist field
    • 3 of them are lebelled "Willie Nelson Feat. Waylon Jennings" in the artist field
    PROBLEM
    • Album will not stay grouped together when in the standard "Sort by Artist" in Grid View. A very legitimate expectation to be able to have Willie's name listed along with his pals in the artist field and have them grouped together in one album within Willie's albums section. 19 songs group within one album in the Willie Nelson section and the other 3 are placed separately either in the compilation section or as separate albums within the regular artists grid view.
    I've read most if not all postings that suggest solutions but no matter what... they don't work. The only way that I know to work is to strip out all other names and leave only "Willie Nelson" in the Artist field. All other sorting and grouping options don't work for this issue... I've tied every combination. My opinion is that this is just a limitation at this time and there is no solution until future updates. I don't want a cheezy work-around either, that's very "unApple like". I assume it to be fixed in future updates.
    Bueller... Bueller?
    Anyone?

    There's a few other "goodies" I have found also but haven't had time to check out.
    If you have songs not in iTunes that you want to add to iTunes in a different format than the song is in...
    (This is carried over from at least 7.4)
    Set the Importing prefs to what you want the new file to be.
    Hold the Option key and go to menu Advanced and select *Convert selection to* AAC (or whatever is in the Import prefs}.
    This will add it to iTunes in the new format.
    Previously, you had to Import the file, change the prefs, go to Advanced - *Convert selection to*, convert the file, then delete the original from iTunes.
    This is new...
    In iTunes 8, go to to File - > *Show duplicates*. (moved from View menu).
    Now hold Option and go to to File and it now displays *Show exact duplicates*.
    Don't know what it means by *exact duplicate* though.

  • How to get the sorted Groups in Adminstration Portal

    after adding a Child Group to the parent Group the Child Groups are not sorted.So
    how to get the sorted list when any child group is added to a parent group.In
    which class we have to make the changes to get the sorted group.

    Hi  Manorama,
    1) If you have already created a portal system as mentioned in following blog
                  /people/marcel.salein/blog/2007/03/14/how-to-create-a-portal-system-for-using-it-in-visual-composer
    2) If not, then try to create the same. Do not forgot to give the Alias name .
    3) After creating a system, log on to the VC, Create one iView.
    4) Now Click on "Find Data" button from the list which you can view in right side to Visual composer screen.
    5) After clicking on "Find Data" button, it will ask for System. If you have created your system correctly and Alias name is given properly, then your mentioned Alias name is appeared in that list.
    6) Select your system Alias name and perform search.
    7) It will display all the BAPIs and RFCs in your systems.
    8) Select required BAPI and develop the VC application.
    Please let me know if you any further problems.
    Thanks,
    Prashant
    Do reward points for useful answers.

  • Hotspot-clicking (Insert function) plus ALV Sorting

    Hi,
    I have a requirement where the ALV display has to be SORTED based on values entered/changed on a certain column. The sort works ok when used with a custom APPEND button for new records (always inserted at the bottom of the list).
    However, it does not work correctly when used with the Hotspot-click (INSERT functionality). It looks like if you CLICK on a particular record onscreen, you are actually addressing the original record in that position before the SORT was effected. 
    Is the Hotspot-clicking (Insert functionality) possible with ALV sorting? The ideal solution would be to have the ALV sorted at PBO and also at PAI so that the user can change existing records and add new ones with the sorting being updated everytime ON_DATA_CHANGED is triggered.
    Will appreciate any help on this.
    Thanks!
    Michael

    Hello Michael
    Thanks for further specifying your requirements. I have created the sample variant ZUS_SDN_ALVGRID_HOTSPOT_SORT_1 which contains two differences as compared to its template:
    Replace table VBAK with VBAP (so we have two levels of sorting: VBELN, POSNR)
    Move SET_TABLE_FOR_FIRST_DISPLAY method call into PBO
    When I click on the hotspot (VBELN) a new row entry for the order number is created. The sorting (VBELN, POSNR) is kept even though the new row has been appended to the itab.
    *& Report  ZUS_SDN_ALVGRID_HOTSPOT_SORT
    *& Thread: Hotspot-clicking (Insert function) plus ALV Sorting
    *& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1159431"></a>
    REPORT  zus_sdn_alvgrid_hotspot_sort.
    TYPES: BEGIN OF ty_s_outtab.
    INCLUDE TYPE vbap.
    TYPES: END OF ty_s_outtab.
    TYPES: ty_t_outtab    TYPE STANDARD TABLE OF ty_s_outtab
                          WITH DEFAULT KEY.
    DATA: gt_outtab    TYPE ty_t_outtab.
    DATA:
      gd_okcode        TYPE ui_func,
      gd_repid         TYPE syrepid,
      gt_sort          TYPE lvc_t_sort,
      gt_fcat          TYPE lvc_t_fcat,
      gs_layout        TYPE lvc_s_layo,
      gs_variant       TYPE disvariant,
      go_docking       TYPE REF TO cl_gui_docking_container,
      go_grid          TYPE REF TO cl_gui_alv_grid.
    *       CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA:
          ms_sel_row    TYPE lvc_s_row. " selected row
        CLASS-METHODS:
          handle_data_changed FOR EVENT data_changed OF cl_gui_alv_grid
            IMPORTING
              er_data_changed
              e_onf4
              e_onf4_before
              e_onf4_after
              sender,
          handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
            IMPORTING
              e_row_id
              e_column_id
              es_row_no
              sender.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    *       CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_data_changed.
        FIELD-SYMBOLS: <lt_outtab>  TYPE ty_t_outtab.
        BREAK-POINT.
      ENDMETHOD.                    "handle_data_changed
      METHOD handle_hotspot_click.
        " define local data
        DATA: ls_outtab    TYPE ty_s_outtab,
              ld_msg        TYPE bapi_msg.
        BREAK-POINT.
        CLEAR: lcl_eventhandler=>ms_sel_row.
        ms_sel_row = e_row_id.
        READ TABLE gt_outtab INTO ls_outtab INDEX e_row_id-index.
        CONCATENATE 'Selected Sales Order = ' ls_outtab-vbeln ' / '
                                              ls_outtab-posnr
          INTO ld_msg.
          message i398(00) with ld_msg.
        " Trigger PAI
        CALL METHOD cl_gui_cfw=>set_new_ok_code
          EXPORTING
            new_code = 'INSERT'
    *      IMPORTING
    *        rc       =
      ENDMETHOD.                    "handle_hotspot_click
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    PARAMETERS:
      p_vkorg      TYPE vkorg  DEFAULT '0001'  OBLIGATORY.
    START-OF-SELECTION.
    **  SELECT  * FROM  vbak INTO CORRESPONDING FIELDS OF TABLE gt_outtab
    **    UP TO 200 ROWS
    **         WHERE  vkorg = p_vkorg.
      SELECT * FROM vbap INTO CORRESPONDING FIELDS OF TABLE gt_outtab
        UP TO 100 ROWS.
      PERFORM init_controls.
    * Build fieldcatalog and set hotspot for field KUNNR
      PERFORM build_fieldcatalog.
      PERFORM set_layout_and_variant.
      PERFORM set_sorting.
      " Register EDIT event
      CALL METHOD go_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_enter
        EXCEPTIONS
          error      = 1
          OTHERS     = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET HANDLER:
        lcl_eventhandler=>handle_data_changed  FOR go_grid,
        lcl_eventhandler=>handle_hotspot_click FOR go_grid.
    * Link the docking container to the target dynpro
      gd_repid = syst-repid.
      CALL METHOD go_docking->link
        EXPORTING
          repid                       = gd_repid
          dynnr                       = '0100'
    *      CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * ok-code field = GD_OKCODE
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    *  SET TITLEBAR 'xxx'.
    * Display data
      CALL METHOD go_grid->set_table_for_first_display
        EXPORTING
          i_bypassing_buffer            = abap_true
          is_variant                    = gs_variant
          i_save                        = 'A'
    *      i_default                     = 'X'
          is_layout                     = gs_layout
    *      is_print                      =
    *      it_special_groups             =
    *      it_toolbar_excluding          =
    *      it_hyperlink                  =
    *      it_alv_graphics               =
    *      it_except_qinfo               =
    *      ir_salv_adapter               =
        CHANGING
          it_outtab                     = gt_outtab
          it_fieldcatalog               = gt_fcat
          it_sort                       = gt_sort
    *      it_filter                     =
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    **  CALL METHOD go_grid->refresh_table_display
    ***        EXPORTING
    ***          IS_STABLE      =
    ***          I_SOFT_REFRESH =
    **    EXCEPTIONS
    **      finished       = 1
    **      OTHERS         = 2.
    **  IF sy-subrc ne 0.
    ***       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    ***                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    **  ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE gd_okcode.
        WHEN 'BACK' OR
             'EXIT'  OR
             'CANC'.
          SET SCREEN 0. LEAVE SCREEN.
        WHEN 'INSERT'.
          PERFORM insert_row.
        WHEN OTHERS.
          " Check for changed data at the frontend (= grid control)
          CALL METHOD go_grid->check_changed_data( ).
      ENDCASE.
      CALL METHOD go_grid->refresh_table_display
    *    EXPORTING
    *      IS_STABLE      =
    *      I_SOFT_REFRESH =
        EXCEPTIONS
          finished       = 1
          OTHERS         = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CLEAR: gd_okcode.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  INIT_CONTROLS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM init_controls .
    * Create docking container
      CREATE OBJECT go_docking
        EXPORTING
          parent = cl_gui_container=>screen0
          ratio  = 90
        EXCEPTIONS
          others = 6.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD go_docking->set_extension
        EXPORTING
          extension  = 99999
        EXCEPTIONS
          cntl_error = 1
          OTHERS     = 2.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    * Create ALV grid
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = go_docking
        EXCEPTIONS
          others   = 5.
      IF sy-subrc NE 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " INIT_CONTROLS
    *&      Form  BUILD_FIELDCATALOG
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM build_fieldcatalog.
    * define local data
      DATA:
        ls_fcat        TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
    *     I_BUFFER_ACTIVE              =
          i_structure_name             = 'VBAP'  " 'VBAK'
    *     I_CLIENT_NEVER_DISPLAY       = 'X'
    *     I_BYPASSING_BUFFER           =
    *     I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = gt_fcat
        EXCEPTIONS
          inconsistent_interface       = 1
          program_error                = 2
          OTHERS                       = 3.
      IF sy-subrc NE 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    **  LOOP AT gt_fcat INTO ls_fcat.
    **    CASE ls_fcat-fieldname.
    **      WHEN 'VBELN'  OR
    **           'ERDAT'  OR
    **           'ERZET'  OR
    **           'ERNAM'  OR
    **           'AUART'  OR
    **           'NETWR'  OR
    **           'WAERK'.
    **        CONTINUE.
    **      WHEN OTHERS.
    **        ls_fcat-no_out = abap_true.
    **    ENDCASE.
    **    MODIFY gt_fcat FROM ls_fcat INDEX syst-tabix.
    **  ENDLOOP.
    * Only non-key fields are editable
    **  ls_fcat-edit = 'X'.
    **  MODIFY gt_fcat FROM ls_fcat
    **    TRANSPORTING edit
    **    WHERE ( fieldname NE space ).
      ls_fcat-hotspot = abap_true.
      MODIFY gt_fcat FROM ls_fcat
        TRANSPORTING hotspot
        WHERE ( fieldname = 'AUART'   OR
                fieldname = 'VBELN' ).
    **  DELETE gt_fcat FROM 15 TO 99.
    ENDFORM.                    " BUILD_FIELDCATALOG_KNB1
    *&      Form  SET_LAYOUT_AND_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_layout_and_variant .
      CLEAR: gs_layout,
             gs_variant.
      gs_layout-cwidth_opt = abap_true.
      gs_variant-report = syst-repid.
      gs_variant-handle = 'GRID'.
    ENDFORM.                    " SET_LAYOUT_AND_VARIANT
    *&      Form  SET_SORTING
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM set_sorting .
    * define local data
      DATA: ls_sort   TYPE lvc_s_sort.
      REFRESH: gt_sort.
      CLEAR: ls_sort.
      ls_sort-spos = 1.
      ls_sort-fieldname = 'VBELN'.
      ls_sort-up = abap_true.
      APPEND ls_sort TO gt_sort.
      CLEAR: ls_sort.
      ls_sort-spos = 1.
      ls_sort-fieldname = 'POSNR'.
      ls_sort-up = abap_true.
      APPEND ls_sort TO gt_sort.
    ENDFORM.                    " SET_SORTING
    *&      Form  INSERT_ROW
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM insert_row .
    * define local data
      DATA: ls_outtab   TYPE ty_s_outtab,
            ld_order    TYPE vbeln.
      READ TABLE gt_outtab INTO ls_outtab
                           INDEX lcl_eventhandler=>ms_sel_row-index.
      ld_order = ls_outtab-vbeln.
      " Find last item of sales order
      LOOP AT gt_outtab INTO ls_outtab
                        WHERE ( vbeln = ld_order ).
      ENDLOOP.
      " Create next item:
      add 10 to ls_outtab-posnr.
      " NOTE: added at the end of the list
      APPEND ls_outtab TO gt_outtab.
      " NOTE: insert new row AFTER selected row => works, too
    **  INSERT ls_outtab INTO gt_outtab
    **                   INDEX lcl_eventhandler=>ms_sel_row-index.
    ENDFORM.                    " INSERT_ROW

  • 'HASH GROUP BY' and 'SORT GROUP BY' 11.2.0.2

    deleting this thread..
    Edited by: OraDBA02 on Oct 3, 2012 2:35 PM

    select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE 11.2.0.2.0 Production
    TNS for Linux: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    Optimizer parameter
    NAME TYPE VALUE
    optimpeek_user_binds boolean FALSE
    filesystemio_options string setall
    object_cache_optimal_size integer 102400
    optimizer_capture_sql_plan_baselines boolean FALSE
    optimizer_dynamic_sampling integer 2
    optimizer_features_enable string 11.2.0.2
    optimizer_index_caching integer 0
    optimizer_index_cost_adj integer 100
    optimizer_mode string ALL_ROWS
    optimizer_secure_view_merging boolean TRUE
    optimizer_use_invisible_indexes boolean FALSE
    optimizer_use_pending_statistics boolean FALSE
    optimizer_use_sql_plan_baselines boolean FALSE
    db_file_multiblock_read_count integer 128
    optimizer_index_caching integer 0
    optimizer_index_cost_adj integer 100
    SQL
    SELECT sum(this_.AMOUNT) as y0_, count(this_.GC_ID) as y1_,count(distinct this_.GC_ID) as y2_, this_.GC_TRANSACTION_TYPE_ID as y3_
    from GC_TRANSACTIONS this_ where this_.MARKETPLACE_ID=:1 and this_.CUSTOMER_ID=:2 and this_.EXTERNAL_GC_TRANSACTION_ID=:3
    group by this_.GC_TRANSACTION_TYPE_ID;
    Indexes and Histograms
    INDEX_NAME LAST_ANALYZED COLUMN_NAME COLUMN_POSITION NUM_ROWS BLEVEL CLUSTERING_FACTOR DESCEND
    I_GCT_CUSMKTLSTUPD 17-jul-2012:00:15:09 CUSTOMER_ID 1 222812460 3 150983660 ASC
    MARKETPLACE_ID 2 3 150983660 ASC
    GC_TRANSACTION_TYPE_ID 3 3 150983660 ASC
    I_GCT_EXT_GC_TRANS_ID_EXE 17-jul-2012:00:17:35 EXTERNAL_GC_TRANSACTION_ID 1 234832560 3 165680180 ASC
    C_ID
    EXTERNAL_GC_EXECUTION_ID 2 3 165680180 ASC
    Histograms
    COLUMN_NAME NUM_DISTINCT NUM_NULLS LAST_ANALYZED SAMPLE_SIZE AVG_COL_LEN HISTOGRAM
    COLUMN_NAME NUM_DISTINCT NUM_NULLS LAST_ANALYZED SAMPLE_SIZE AVG_COL_LEN HISTOGRAM
    EXTERNAL_GC_EXECUTION_I 21657463 54047480 24.Jul.12/00:21:28 8788182 12 HEIGHT BALANCED
    D
    EXTERNAL_GC_TRANSACTION 20790576 0 24.Jul.12/00:21:28 11481216 18 HEIGHT BALANCED
    _ID
    CUSTOMER_ID 5130572 0 24.Jul.12/00:21:28 11483246 7 HEIGHT BALANCED
    MARKETPLACE_ID 6 0 24.Jul.12/00:21:28 11482295 4 FREQUENCY
    GC_TRANSACTION_TYPE_ID 21 0 24.Jul.12/00:21:28 11483039 3 FREQUENCY
    GC_TRANSACTION_ID 229686260 0 24.Jul.12/00:21:28 11484313 8 NONE
    Histograms distibution for MARKTEPLACE_ID
    Enter value for column_name: MARKETPLACE_ID
    COLUMN_NAME ENDPOINT_VALUE CUMMULATIVE_FREQUENCY FREQUENCY ENDPOINT_ACTUAL_VALU
    MARKETPLACE_ID 3 6543166 6543166
    MARKETPLACE_ID 4 11041781 4498615
    MARKETPLACE_ID 5 11459282 417501
    MARKETPLACE_ID 35691 11469536 10254
    MARKETPLACE_ID 44551 11475336 5800
    MARKETPLACE_ID 78931 11482295 6959
    6 rows selected.
    CBO switches between two plans
    plan-1
    Plan hash value: 2380563624
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 13 (100)| |
    | 1 | HASH GROUP BY | | 1 | 42 | 13 (8)| 00:00:01 |
    | 2 | VIEW | VW_DAG_0 | 1 | 42 | 13 (8)| 00:00:01 |
    | 3 | HASH GROUP BY | | 1 | 43 | 13 (8)| 00:00:01 |
    |* 4 | TABLE ACCESS BY INDEX ROWID| GC_TRANSACTIONS | 1 | 43 | 12 (0)| 00:00:01 |
    |* 5 | INDEX RANGE SCAN | I_GCT_EXT_GC_TRANS_ID_EXEC_ID | 11 | | 4 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    4 - filter(("THIS_"."CUSTOMER_ID"=:2 AND "THIS_"."MARKETPLACE_ID"=:1))
    5 - access("THIS_"."EXTERNAL_GC_TRANSACTION_ID"=:3)
    Bind (child_curosr=1)
    select SQL_ID,CHILD_NUMBER,HASH_VALUE,NAME,DATATYPE,WAS_CAPTURED,LAST_CAPTURED,VALUE_STRING from V$SQL_BIND_CAPTURE where SQL_ID='&sql_id'
    order by LAST_CAPTURED;
    Enter value for sql_id: 1hc1r8qubfdnh
    1hc1r8qubfdnh 1 3031905936 :1 2 YES 24.Jul.12/00:52:29 3
    1hc1r8qubfdnh 1 3031905936 :2 2 YES 24.Jul.12/00:52:29 535098352
    1hc1r8qubfdnh 1 3031905936 :3 1 YES 24.Jul.12/00:52:29 203-2351701-6925919
    Plan-2
    Bind (child_curosr=6)
    Plan hash value: 700639342
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | | | 13 (100)| |
    | 1 | SORT GROUP BY | | 1 | 43 | 13 (8)| 00:00:01 |
    |* 2 | TABLE ACCESS BY INDEX ROWID| GC_TRANSACTIONS | 1 | 43 | 12 (0)| 00:00:01 |
    |* 3 | INDEX RANGE SCAN | I_GCT_EXT_GC_TRANS_ID_EXEC_ID | 11 | | 4 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter(("THIS_"."CUSTOMER_ID"=:2 AND "THIS_"."MARKETPLACE_ID"=:1))
    3 - access("THIS_"."EXTERNAL_GC_TRANSACTION_ID"=:3)
    bind values
    select SQL_ID,CHILD_NUMBER,HASH_VALUE,NAME,DATATYPE,WAS_CAPTURED,LAST_CAPTURED,VALUE_STRING from V$SQL_BIND_CAPTURE where SQL_ID='&sql_id'
    order by LAST_CAPTURED;
    Enter value for sql_id: 1hc1r8qubfdnh
    1hc1r8qubfdnh 6 3031905936 :1 2 YES 24.Jul.12/03:06:04 5
    1hc1r8qubfdnh 6 3031905936 :2 2 YES 24.Jul.12/03:06:04 1278126152
    1hc1r8qubfdnh 6 3031905936 :3 1 YES 24.Jul.12/03:06:04 171-5012459-0045134
    Why is CBO using two different 'HASH GROUP BY' with view 'VW_DAG_0' in first plan ?
    Is that due to difference in MARKETPLACE_ID =4 And 5 ?

  • Hash GROUP BY And Sort GROUP BY

    Can anyone please explain how does Hash GROUP BY And Sort GROUP BY exactly work ?
    Thank you.

    As the name suggests, SORT GROUP BY achieves the same goal by sorting.According to Tom SORT GROUP BY doesn't always sort correctly .. tried to understand his explanation as he said "It always did a BINARY SORT - not a character set sort. So the data would be sorted incorrectly if you use anything but very simple ASCII strings..."
    can you give me an example where binary value of a string A is greater than string B while ascii value of string B is greater than string A ?
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:75397449124988
    Thank you

  • TableSorter - Sorting grouped columns

    Hi,
    I am implementing a web dnypro application on NWDS 7.1.
    Is it possible to sort a grouped column with the TableSorter.java class?
    As mentioned in the below document, it should be possible.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30291df2-b980-2a10-0884-839c4f7f147e
    I can sort single columns, but sorting grouped columns is not possible.
    Any idea about this?
    Thanks,
    Regards,
    Yasar

    Hi,
    Please go through
    Enhanced Web Dynpro Java TableSorter
    Enhanced Web Dynpro Java TableSorter for SAP NetWeaver 04s
    Regards
    Ayyapparaj

  • WDA ALV - value grouping after column sort

    Hi,
    We are using the WDA ALV component in our application. Whem making use of the standard 'sort' functionality by pressing on a column header, all identical values of that
    column are grouped into a single group entry.
    As we still need to access every single cell of that column, I am looking for a way to
    suppress this value grouping after sort. I did not find any methods in the ALV model to do so. Any ideas on how to suppress this?
    Thanks for your help!
    Robert

    Hi Robert,
    You can call the method set_grouping_allowed in the interface if_wd_salv_sort.
    data lo_interfacecontroller type ref to iwci_salv_wd_table .
    data lo_value type ref to cl_salv_wd_config_table.
    data lo_field type ref to cl_salv_wd_field.
    lo_interfacecontroller =   wd_this->wd_cpifc_alv_comp( ).
    lo_value = lo_interfacecontroller->get_model( ).
    lo_field = lo_value->if_salv_wd_field_settings~get_field( fieldname = 'CURRENCY' ).
    lo_field->if_salv_wd_sort~set_grouping_allowed( value  = ABAP_false.).
    Regards,
    Neha
    <i><b>PS:Reward if helpful</b></i>

  • Alv Sort and Grouping

    Hello Friends,
    I have made an ALV report where I am sorting on the second column which is a field called 'SUPPLIER_ID'.
    I am to group the supplier_id, so that only the first row shows the supplier id, and those rows with the same id should not be shown. But am having trouble with this.
    check  Supplier ID     field2  field3
               xxxxx            xxx    xxx
                                    xxx   xxx
                                    xxx   xxx
              xxxxxx           xxx    xxx.
    These are the steps I do in the code.
    1. I build the fieldcatalogue
    2. then I select the data
    3 . set the sort order
         DATA: x_sort TYPE slis_sortinfo_alv.
         CLEAR x_sort.
         x_sort-fieldname =  'SUPPLIER_ID'.
         x_sort-tabname   = 'GT_OUTTAB'.
         x_sort-up = 'X'
         x_sort-spos = 2.
         APPEND x_sort TO t_sort.
    4. Then I call the Reuse function.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         IS_LAYOUT                         = ls_layout
         IT_FIELDCAT                       = t_fieldcat
         i_callback_pf_status_set       = l_status
         i_callback_program               = l_repid
         it_sort                                  = x_sort
       TABLES
          T_OUTTAB                          = gt_outtab
       EXCEPTIONS
         PROGRAM_ERROR                     = 1
         OTHERS                            = 2
    But all the rows show the supplier ID, what am I doing wrong?
    best regards B
    Edited by: Baljinder Singh Gosal on Sep 29, 2008 2:36 PM

    types: begin of gs_outtab.
    types:
             SUPPLIER             TYPE ZSAM_LAC-SUPPLIER,
             SUPPLIER_ID        TYPE ZSAM_LAC-SUPPLIER_ID,
             SPEND                 TYPE ZSAM_LAC-SPEND,
             lights               type char1,
             color                type i,
             tabcol               type lvc_t_scol,
             id                   type char25,
             name                 type icon-name,
             symbol               type icon-id,
    end   of gs_outtab.
    data: gt_outtab type standard table of gs_outtab,
          wa_outtab  type gs_outtab.
    data: gr_container type ref to cl_gui_custom_container,
          gs_layout type lvc_s_layo,
          gt_fieldcat type lvc_t_fcat.
    perform display.
    form display.
        data: ls_layout   type slis_layout_alv,
              t_fieldcat  TYPE slis_t_fieldcat_alv,
               x_sort     TYPE slis_sortinfo_alv
              t_sort      TYPE slis_t_sortinfo_alv,
              l_status    TYPE slis_formname,
              l_repid     TYPE syrepid.
         REFRESH t_sort.
         REFRESH t_fieldcat.
         g_pf_status = 'SALV_STANDARD'.
         l_status = 'SET_PF_STATUS'.
         l_repid = sy-repid.
    Layout
         ls_layout-lights_tabname   = '1'.
       ls_layout-lights_fieldname = 'LIGHTS'.
         ls_layout-coltab_fieldname =  'TABCOL'.
       ls_layout-zebra = 'X'.
         PERFORM set_fieldcat2 USING:
    *pos fieldname          ref_field           ref_tab   len   noout  text_m   text_l   txt_s    reptxt  ddic  hotsp icon  chckbx edit  dosum  inttype symbol   tech     group fieldcat
    1   'CHECK'            'XFELD'              space     space space 'Select' 'Select' 'Sel'    'Select' space space space 'X'   'X'    space   space     space   space  space   t_fieldcat,
    2   'SUPPLIER'         'SUPPLIER'          'ZSAM_LAC' space space  text-hl5 text-hl5 text-hl5 space   space space space  space space space   space     space   space  space   t_fieldcat,
    3   'SUPPLIER_ID'      'SUPPLIER_ID'       'ZSAM_LAC' space space  text-hl4 text-hl4 text-hl4 space   space space space  space space space   space     space   space  'A'   t_fieldcat,
      perform get_data
      perform set_icons.
      perform set_order USING 'ORKLA_COMP_NAME' 'GT_OUTTAB' 'X' space space t_sort.
      CLEAR x_sort.
      x_sort-fieldname = 'SUPPLIER_ID'.
      x_sort-tabname   = 'GT_OUTTAB'.
      x_sort-up = 'X'.
      x_sort-spos = 1.
      APPEND x_sort TO t_sort.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         IS_LAYOUT                         = ls_layout
         IT_FIELDCAT                       = t_fieldcat
         IT_EXCEPT_QINFO                   = gt_exc
         i_callback_pf_status_set          = l_status
         i_callback_program                = l_repid
         it_sort                           = t_sort
       TABLES
          T_OUTTAB                          = gt_outtab
       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.
    endform.                    " display_fullscreen

  • ALV Sorting Not Working after Adding Checkbox to ALV

    Hi All.
    I am currently doing an ALV report using REUSE_ALV_GRID_DISPLAY function. I am sorting the list by Employee Name and Personnel Area. It works fine where the personnel are field and employee name field are merger together for same personnel are and employee name. But afterwards I added a checkbox field to the internal table and the list outputs a checkbox for each line. Afer  putting the checkbox the list no long merges the same personnel are and employee name fields according to original sorting.
    Can anyone explain if there is a way to solve this?
    Thanks a lot.
    Lily

    yes there is a way. Just see this..
    There is no Straight forward solution. There is a work around.
    REPORT  ztest_check_box                         .
    TYPE-POOLS: slis,icon.
    DATA: BEGIN OF it_vbap OCCURS 0,
           vbeln LIKE vbap-vbeln,
           matnr LIKE vbap-matnr,
           posnr LIKE vbap-posnr,
           kunnr LIKE vbak-kunnr,
           kwmeng LIKE vbap-kwmeng,
           check TYPE c,
           id TYPE icon-id,
          END OF it_vbap.
    DATA: it_fieldcat  TYPE slis_t_fieldcat_alv.
    DATA:  x_fieldcat  TYPE slis_fieldcat_alv.
    DATA: it_sort TYPE slis_t_sortinfo_alv,
          x_sort TYPE slis_sortinfo_alv.
    SELECT vbak~vbeln
           vbak~kunnr
           vbap~posnr
           vbap~matnr
           vbap~kwmeng
           INTO CORRESPONDING FIELDS OF TABLE it_vbap
           FROM vbak JOIN vbap
           ON vbak~vbeln = vbap~vbeln.
    SORT it_vbap BY matnr.
    DELETE it_vbap WHERE matnr IS INITIAL.
    LOOP AT it_vbap.
      it_vbap-id = '@T9@'.
      MODIFY it_vbap.
    ENDLOOP.
    x_fieldcat-fieldname = 'ID'.
    x_fieldcat-seltext_l = 'CHECK'.
    x_fieldcat-outputlen = 4.
    x_fieldcat-icon  = 'X'.
    x_fieldcat-col_pos   = 1.
    x_fieldcat-hotspot  = 'X'.
    x_fieldcat-tabname   = 'IT_VBAP'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'MATNR'.
    x_fieldcat-seltext_l = 'MATNR'.
    x_fieldcat-col_pos   = 2.
    x_fieldcat-tabname   = 'IT_VBAP'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'KUNNR'.
    x_fieldcat-seltext_l = 'KUNNR'.
    x_fieldcat-col_pos   = 3.
    x_fieldcat-tabname   = 'IT_VBAP'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'VBELN'.
    x_fieldcat-seltext_l = 'VBELN'.
    x_fieldcat-col_pos   = 4.
    x_fieldcat-tabname   = 'IT_VBAP'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'POSNR'.
    x_fieldcat-seltext_l = 'POSNR'.
    x_fieldcat-col_pos   = 5.
    x_fieldcat-tabname   = 'IT_VBAP'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_fieldcat-fieldname = 'KWMENG'.
    x_fieldcat-seltext_l = 'KWMENG'.
    x_fieldcat-col_pos   = 6.
    x_fieldcat-do_sum   = 'X'.
    x_fieldcat-tabname   = 'IT_VBAP'.
    APPEND x_fieldcat TO it_fieldcat.
    CLEAR x_fieldcat.
    x_sort-fieldname = 'MATNR'.
    x_sort-spos       = 1.
    x_sort-up = 'X'.
    x_sort-group = 'X'.
    x_sort-subtot = 'X'.
    APPEND x_sort TO it_sort.
    CLEAR x_sort.
    x_sort-fieldname = 'KUNNR'.
    x_sort-spos       = 2.
    x_sort-up = 'X'.
    APPEND x_sort TO it_sort.
    CLEAR x_sort.
    x_sort-fieldname = 'VBELN'.
    x_sort-spos       = 3.
    x_sort-up = 'X'.
    APPEND x_sort TO it_sort.
    CLEAR x_sort.
    *DATA:x_layout TYPE lvc_s_layo.
    *x_layout-box_fname = 'CHECK'.
    *x_layout-no_rowmark = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
    *   is_layout          = x_layout
        i_callback_user_command = 'USER_COMMAND'
        it_fieldcat        = it_fieldcat
        it_sort            = it_sort
      TABLES
        t_outtab           = it_vbap[]
      EXCEPTIONS
        program_error      = 1
        OTHERS             = 2.
    IF sy-subrc ne 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    *&      Form  itab_user_command
    *       text
    *      -->WHATCOMM   text
    *      -->WHATROW    text
    FORM user_command USING whatcomm TYPE sy-ucomm selfield TYPE
    slis_selfield.
      IF selfield-fieldname = 'ID'.
        READ TABLE it_vbap INDEX selfield-tabindex.
        IF sy-subrc = 0.
          IF it_vbap-check = ''.
            it_vbap-id = '@R7@'.
            it_vbap-check = 'X'.
          ELSE.
            it_vbap-id = '@T9@'.
            it_vbap-check = ''.
          ENDIF.
          MODIFY it_vbap INDEX selfield-tabindex.
        ENDIF.
      ENDIF.
      selfield-refresh = 'X'.
    ENDFORM.                    "itab_user_command
    if you want to make the above code to work in lower versions then you have to do this..
    then maintain the ICON using the view V_ICON from SM30 add the New Entry.
    get the properties from the below screen shot.
    http://img404.imageshack.us/img404/3338/testig9.png

  • Regarding ALV sort & summation

    Hi
       I want to do sort & summation in ALV programatically.
    Can anyone provide me the sample code.
    Ponits are assured for helpful answers.
    Regards,
    kumar

    Hi,
    chk thi:
    report  zkeerthi_alv2                           .
    tables: vbak.
    type-pools : slis.
    data: begin of it_vbak occurs 0,
          icon type icon-id,
          vbeln like vbak-vbeln,
          audat like vbak-audat,
          vbtyp like vbak-vbtyp,
          auart like vbak-auart,
          augru like vbak-augru,
          netwr like vbak-netwr,
          waerk like vbak-waerk,
          end of it_vbak.
    data: g_repid like sy-repid,
          wa_sort type slis_sortinfo_alv,
          it_sort type slis_t_sortinfo_alv,
          wa_layout type slis_layout_alv,
          it_fieldtab type slis_t_fieldcat_alv,
          wa_fieldcat type slis_fieldcat_alv.
    selection-screen begin of block b1 with frame.
    select-options:s_vbeln for vbak-vbeln,
                   s_vbtyp for vbak-vbtyp default 'C'.
    selection-screen end of block b1 .
    selection-screen begin of block b2 with frame.
    parameters: list radiobutton group rad1,
                grid radiobutton group rad1.
    selection-screen end of block b2.
    initialization.
      g_repid = sy-repid.
    start-of-selection.
      select vbeln
             audat
             vbtyp
             auart
             augru
             netwr
             waerk into corresponding fields of table it_vbak
             from vbak where audat > '01/01/2004' and
             netwr > 0 and
             vbeln in s_vbeln and
             vbtyp in s_vbtyp.
      loop at it_vbak.
        if it_vbak-netwr < 10000.
          it_vbak-icon = '@08@'.
        elseif it_vbak-netwr > 10000 and it_vbak-netwr < 100000.
          it_vbak-icon = '@09@'.
        elseif it_vbak-netwr > 100000.
          it_vbak-icon = '@0A@'.
        endif.
        modify it_vbak index sy-tabix.
      endloop.
    end-of-selection.
      perform sort_list.
      perform modify_fieldcat.
      perform layout_list.
    *&      Form  sort_list
          text
    -->  p1        text
    <--  p2        text
    form sort_list .
      clear wa_sort.
      wa_sort-fieldname = 'AUART'.
      wa_sort-spos = '1'.
      wa_sort-up = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-fieldname = 'VBTYP'.
      wa_sort-spos = '2'.
      wa_sort-up = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-fieldname = 'WAERK'.
      wa_sort-spos = '3'.
      wa_sort-up = 'X'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
    endform.                    " sort_list
    *&      Form  layout_list
          text
    -->  p1        text
    <--  p2        text
    form layout_list .
      clear wa_layout.
      if list = 'X'.
        wa_layout-zebra = 'X'.
        wa_layout-window_titlebar = 'LIST DISPLAY'.
        wa_layout-subtotals_text = 'SUBTOTAL'.
        wa_layout-totals_text = 'TOTAL'.
        call function 'REUSE_ALV_LIST_DISPLAY'
         exporting
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
           i_callback_program             = g_repid
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      I_STRUCTURE_NAME               =
           is_layout                      = wa_layout
           it_fieldcat                    = it_fieldtab[]
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
           it_sort                        = it_sort[]
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = ' '
      IS_VARIANT                     =
      IT_EVENTS                      =
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
          tables
            t_outtab                       = it_vbak
    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.
      elseif grid = 'X'.
        wa_layout-zebra = 'X'.
        wa_layout-window_titlebar = 'GRID DISPLAY'.
        wa_layout-subtotals_text = 'SUBTOTAL'.
        wa_layout-totals_text = 'TOTAL'.
        call function 'REUSE_ALV_GRID_DISPLAY'
         exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
           i_callback_program                =  g_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
           is_layout                         = wa_layout
           it_fieldcat                       = it_fieldtab
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
           it_sort                           = it_sort
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
          tables
            t_outtab                          = it_vbak
    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.
      endif.
    endform.                    " layout_list
    *&      Form  modify_fieldcat
          text
    -->  p1        text
    <--  p2        text
    form modify_fieldcat .
      clear wa_fieldcat.
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'ICON'.
      wa_fieldcat-seltext_l  = 'LIGHTS'.
      wa_fieldcat-icon = 'X'.
    WA_FIELDCAT-ddictxt = 'l'.
      wa_fieldcat-col_pos = 1.
      wa_fieldcat-outputlen = 10.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'VBELN'.
      wa_fieldcat-seltext_l  = 'SALES DOCUMENT'.
    WA_FIELDCAT-ddictxt = 'l'.
      wa_fieldcat-col_pos = 2.
      wa_fieldcat-outputlen = 10.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
    when 'maktx'.
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'AUDAT'.
      wa_fieldcat-seltext_l  = 'DATE'.
    WA_FIELDCAT-ddictxt = 'l'.
      wa_fieldcat-col_pos = 3.
      wa_fieldcat-outputlen = 15.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'VBTYP'.
      wa_fieldcat-seltext_l  = 'SALES CATEGORY'.
      wa_fieldcat-col_pos = 4.
      wa_fieldcat-outputlen = 10.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'AUART'.
      wa_fieldcat-seltext_l  = 'SALES DOCUMENT TYPE'.
      wa_fieldcat-col_pos = 5.
      wa_fieldcat-outputlen = 10.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'AUGRU'.
      wa_fieldcat-seltext_l  = 'ORDER REASON'.
    WA_FIELDCAT-ddictxt = 'l'.
      wa_fieldcat-col_pos = 6.
      wa_fieldcat-outputlen = 10.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'NETWR'.
      wa_fieldcat-seltext_l  = 'QUANTITY'.
      wa_fieldcat-do_sum = 'X'.
    WA_FIELDCAT-ddictxt = 'l'.
      wa_fieldcat-col_pos = 7.
      wa_fieldcat-outputlen = 25.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
      wa_fieldcat-tabname   = 'IT_VBAK'.
      wa_fieldcat-fieldname = 'WAERK'.
      wa_fieldcat-seltext_l  = 'CURRENCY'.
    WA_FIELDCAT-ddictxt = 'l'.
      wa_fieldcat-col_pos = 8.
      wa_fieldcat-outputlen = 10.
      append wa_fieldcat to it_fieldtab.
      clear wa_fieldcat .
    endform.                    " modify_fieldcat
    regards,
    keerthi

  • ALV -- sorting fields

    hi there experts...
    I´m doing an alv report and I want to know if it's possible to sort the alv like I'm going to explain:
    WA_SORT-SPOS = 1.
      WA_SORT-FIELDNAME = 'EKGRP'.
      WA_SORT-TABNAME = 'T'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
      WA_SORT-SPOS = 2.
      WA_SORT-FIELDNAME = 'EKNAM'.
      WA_SORT-TABNAME = 'T'.
      WA_SORT-UP = 'X'.
      APPEND WA_SORT TO IT_SORT.
      CLEAR WA_SORT.
    I want to sort this two fields in order that, i just want to group the equal values of EKNAM that correspond to a single value of EKGRP nad not to group all equal values of EKNAM with diferent EKGRP values.
    Output Example of what I want:
       EKGRP   |   EKNAM  |   DESC
    -----------|----------|-------------
           1   |   001    | blabla1
               |----------|-------------
               |   002    | blabla2
               |          |-------------
               |          | blabla3
    -----------|----------|-------------
          2    |   002    | blabla4
               |          |-------------
               |          | blalba5
               |--------- |--------------
               |   012    | blabla6
    With normal sort, value 002 for EKNAM field is grouped independently from the value of EKGRP field...
    Is it possible to do??
    Tanks
    Edited by: Hermano.Andrade on Apr 8, 2009 5:59 PM

    HI,
    Refer to this link..https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/sortinALV
    Opp's sorry it is not possible...if the value is same for the corresponding two values in the different sort column then the values are merged and displayed at first instead of showing once again if any change in the any of the values in other sort column.
    Instead you can update the internal table in the same way as required and display as the output. The restriction on this you need to disable the sort buttons on the alv and no other operations to be performed.

  • Windows 8 libraries don't sort/group by metadata (like Windows 7 could)

    One of the great things about the Windows 7 libraries was the way they let you group and sort the stuff in them. For example, in the music library you could sort by artist, and it would group them by albums (see attached).
    By contrast, the Windows 8 libraries (at least on my computer - if I'm doing something wrong let me know...) are completely crippled. In particular:
    files that are stored in subdirectories are only ever shown by folder - the libraries view will not sort these by any metadata (such as date, album, artist, author, ...); and
    even files that are in one of the root directories indexed by the library will not be sorted and grouped as usefully as in the Windows 7 libraries. You get to choose one thing to group by, and one thing to sort by. And every view shows every song - no nice
    collecting into albums or dates as in the Windows 7 view.
    (see attached - in this picture the 8 files listed are in C:\Users\[me]\Music, while the remaining files are in subfolders).
    Is there any way to make Windows 8 libraries work like Windows 7's?
    (In the case of music, I note that the Xbox Music Metro app has no difficulty sorting the library in various ways (although, from memory, it didn't work when it was originally released) - but the photos app doesn't and I'm not sure about videos).
    (As a subscript, I note that the screenshots in this thread seem to suggest that Windows 8 at least once had the same functionality as Windows
    7, albeit that there is no cover art shown in that pic. So it's entirely possible that it's something I'm doing wrong (but I have no idea what...).
    Any ideas?

    Hi,
    Based on my test, we can use the following setting to sort by artist.
    If you cannot see the option, please restore the Default Libraries to check the result.
    1.Open an Explorer window.
    2.In the Navigation Pane, right click on Libraries, and click on Restore Default Libraries.
    Regards,
    Kelvin Xu
    TechNet Community Support

Maybe you are looking for