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

Problem with sorting using ALV List

Former Member
0 Likes
259

Hi Experts,

I need help in sorting my output by their company code. Once this is sorted, the records in different company code will sorted by their cost center. The expected output is like below:

Company A

-


Pernr

Kostl

-


1000

0001

-


1002

0001

-


total

2

-


Pernr

Kostl

-


1001

0002

-


total

1

-


Company B

-


Pernr

Kostl

-


1005

0006

-


total

1

-


As of the moment I'm using the code below but the sorting is still a mess.

wa_sort-fieldname = 'BUKRS'.

wa_sort-group = '*'.

wa_sort-up = 'X'.

APPEND wa_sort TO it_sort.

wa_sort-fieldname = 'KOSTL'.

wa_sort-subtot = 'X'.

wa_sort-up = 'X'.

APPEND wa_sort TO it_sort.

Another question, how can the records be hidden and only the show the row of the subtotals and grand total?

Hope you can answer my questions. Thanks

Regards,

Rare

1 REPLY 1
Read only

Former Member
0 Likes
236

Hi,

I think as per your requirement you should use alv_tree, so that you can hide the other fields and show sorted data as requireed by you.

Thanks,

Anmol