Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Group Fields in ALV

Former Member
0 Kudos

Hi,

In My Report I want to group the fields in ALV i found the attribute SP_GROUP to be set with value and the internal table IT_SPECIAL_GROUPS to be passed to set_table_for_first_display method. My requirement is such that i need few fields to be common to multiple groups so can i use multiple value to SP_GROUP attribute while defining field catalog..?? Or any other method is there please suggest me.

Thank's & Regard's

Girija

5 REPLIES 5

Former Member
0 Kudos

Hi,

Use sort instead, below is the sample code.

*  Internal table for storing info. for ALV grid
data: i_sort2 TYPE LVC_T_SORT.
DATA: wa_sort2      LIKE LINE OF i_sort2.

  wa_sort2-spos = 1.
  wa_sort2-fieldname = 'EBELN'.
  wa_sort2-up = 'X'.
  wa_sort2-subtot = 'X'.
  APPEND wa_sort2 TO i_sort2.
  CLEAR wa_sort2.
  wa_sort2-spos = 2.
  wa_sort2-fieldname = 'EBELP'.
  wa_sort2-up = 'X'.
  wa_sort2-subtot = space.
  APPEND wa_sort2 TO i_sort2.
  CLEAR wa_sort2.
  wa_sort2-spos = 3.
  wa_sort2-fieldname = 'EINDT'.
  wa_sort2-up = 'X'.
  wa_sort2-subtot = space.
  APPEND wa_sort2 TO i_sort2.

Now use I_sort2 table with changing parameter IT_SORT of method SET_TABLE_FOR_FIRST_DISPLAY

0 Kudos

hi,

I din't understand your code how can i use this in Set_table_for_first _display method ..??

can you please be more Specific??

Regard's

Girija

Former Member
0 Kudos

Hi,

Can anyone Help me with this..??

Regard's

girija

0 Kudos

Hi Girija;

You can read below link and then apply your program.

There are all details in this documents for OO ALV. You can find "Group" in this documents.

Best regards.

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415...

Former Member
0 Kudos

Hi ,

You can sort the field based on the group and pass it in it_sort in method set_table_for_first_display.

DATA:li_sort TYPE lvc_t_sort,

lwa_sort TYPE lvc_s_sort.

lwa_sort-fieldname = 'VBELN'.

lwa_sort-spos = 1.

lwa_sort-up = 'X'.

lwa_sort-group = 'UL'.

APPEND lwa_sort TO li_sort.

lwa_sort-fieldname = 'POSNR'.

lwa_sort-spos = 2.

lwa_sort-up = 'X'.

lwa_sort-group = 'UL'.

APPEND lwa_sort TO li_sort.

Pass ths internal table li_sort to it_sort in method set_table_for_first_display.

The output will be grouped according to VBELN and POSNR.

Regards,

Archna