Skip to Content

Group/ Sort in ALV using OOPS

Hi Experts,

I am using ALV control USING OOPS on my screen output.

I need to sort/group the output by a field such that the field will not appear ONCE and the items reated to that will appear as

they are.

ex:

MATNR ITEMS DESC AMOUNT -->field catalog

abc 10 glass 10.0

20 black met 20.0

30 sulfa 30.0

abc 40 moldie 40.0

50 black met 11.0

60 sulfa 33.0

I have developed the ALV grid using OOPS.

Please suggest.

Thanks,

Ricky

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 19, 2011 at 03:39 AM

    Ricky,

    such that the field will not appear ONCE and the items reated to that will appear as they are .... I suppose you mean that you want to sort but you don't want to merge the same values..

    gt_sort-SPOS = 01.
    gt_sort-FIELDNAME = 'AENAM'.
    gt_sort-up = 'X'.
    append gt_sort.
    
    ls_layout-NO_MERGING = 'X'.
    
    CALL METHOD lo_alv->set_table_for_first_display
       EXPORTING
         i_structure_name              = 'MARA'
         IS_LAYOUT                     = ls_layout
      CHANGING
         it_outtab                     = gt_mara
         it_fieldcatalog               = gt_fcat
         it_sort                       = gt_sort[]
    *    it_filter                     =
      EXCEPTIONS
    .............
    

    I don't understand what you wanted to show with the data example you posted, let me know if I misunderstand your question/

    BR,

    Diwakar

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Diwakar,

      No. Its NOT working. Its NOT showing ZEBRA lines atleast .

      This is what my code is:

      data: gs_layout type lvc_s_layo.

       gs_layout-zebra = 'X'.
      
        call method r_grid->set_table_for_first_display
          exporting
            is_variant           = w_variant
            i_save               = 'A'
            i_default            = 'X'
            is_layout            = gs_layout
      *     it_toolbar_excluding = it_exclude
          changing
            it_outtab        = it_final 
            it_sort          = t_sort
            it_fieldcatalog      = gt_fieldcat.

      Any suugestions pls?

      Thanks

      Ricky

  • author's profile photo Former Member
    Former Member
    Posted on Aug 19, 2011 at 01:31 AM

    Hi Ricky,

    Refer to the links...

    http://wiki.sdn.sap.com/wiki/display/ABAP/ALVGridReport-withObjectOrientedSALVClasses

    http://wiki.sdn.sap.com/wiki/display/ABAP/OBJECTORIENTEDALV+Guide

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.