Application Development and Automation 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: 
Read only

Grouping fields in the list

Former Member
0 Likes
865

Hello ,

I have a internal table with data to be displayed on the screen .Simple list just to check data , There are lot of rows

with same value in the first colon. I want group them by that colon to have more visibility on the screen.

What I am doing now is loop in the internal table and simply write on the screen , I can find any addition on WRITE statement or

any other way to do grouping.

Please advice .

Krsto

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
799

hi there,,,,,

This is sample code u may get solution modifying this

CLEAR LS_SORT.

LS_SORT-SPOS = 1.

LS_SORT-FIELDNAME = 'DISPO'.

LS_SORT-UP = 'X'.

LS_SORT-SUBTOT = 'X'.

LS_SORT-GROUP = '*'.

LS_SORT-TABNAME = 'INT_GETDATA'.

APPEND LS_SORT TO G_SORT.

CLEAR LS_SP_GROUP.

LS_SP_GROUP-SP_GROUP = 'A'.

APPEND LS_SP_GROUP TO GT_SP_GROUP.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

I_CALLBACK_USER_COMMAND = 'SUB_USER_COMMAND'

IS_LAYOUT = G_LAYOUT

IT_FIELDCAT = GT1_FIELDCAT[]

IT_EVENTS = GT_EVENTS[]

IT_SPECIAL_GROUPS = GT_SP_GROUP[]

IT_SORT = G_SORT[]

IS_PRINT = GS_PRINT

TABLES

T_OUTTAB = INT_GETDATA[].

reward if useful,

cheers,

rekha

4 REPLIES 4
Read only

Former Member
0 Likes
800

hi there,,,,,

This is sample code u may get solution modifying this

CLEAR LS_SORT.

LS_SORT-SPOS = 1.

LS_SORT-FIELDNAME = 'DISPO'.

LS_SORT-UP = 'X'.

LS_SORT-SUBTOT = 'X'.

LS_SORT-GROUP = '*'.

LS_SORT-TABNAME = 'INT_GETDATA'.

APPEND LS_SORT TO G_SORT.

CLEAR LS_SP_GROUP.

LS_SP_GROUP-SP_GROUP = 'A'.

APPEND LS_SP_GROUP TO GT_SP_GROUP.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

I_CALLBACK_USER_COMMAND = 'SUB_USER_COMMAND'

IS_LAYOUT = G_LAYOUT

IT_FIELDCAT = GT1_FIELDCAT[]

IT_EVENTS = GT_EVENTS[]

IT_SPECIAL_GROUPS = GT_SP_GROUP[]

IT_SORT = G_SORT[]

IS_PRINT = GS_PRINT

TABLES

T_OUTTAB = INT_GETDATA[].

reward if useful,

cheers,

rekha

Read only

0 Likes
799

Thank you

Edited by: Krsto Gjergja on Apr 9, 2008 12:15 PM

Read only

Former Member
0 Likes
799

Hi,

What ever u are doing to show the list is correct way of doing. I have solve a similar kind of issue by following the same procedure.

Regards,

Pratyush.

Read only

Former Member
0 Likes
799

write like below

sort internal table by keyfield.

at new keyfield

write keyfield..

endat.

here keyfield is the field you want to group by

do reward if helpful