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

Several headers in ALV Grid

Former Member
0 Likes
1,229

Hi all.

I have a problem i hope you can help me with.

Is it possible to have several headers in an ALV grid?

I want the data to be shown in clusters with a header,

fx. AT NEW flightnumber.

add a header.

ENDAT.

Is this possible?

Regards

Liselotte Hjelmbjerg

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,023

Hi,

Maybe you should simply add a grouping column (in the example: FLIGHTNUMBER) at the first position of your grid and then sort the table by this column?

Regards, Joerg

Hi all.

I have a problem i hope you can help me with.

Is it possible to have several headers in an ALV grid?

I want the data to be shown in clusters with a header,

fx. AT NEW flightnumber.

add a header.

ENDAT.

Is this possible?

Regards

Liselotte Hjelmbjerg

7 REPLIES 7
Read only

andreas_mann3
Active Contributor
0 Likes
1,023

Lieselotte ,

please use fm <b><b>REUSE_ALV_HIERSEQ_LIST_DISPLAY</b></b>

here's a sample :

demo-report <b>BCALV_TEST_HIERSEQ_LIST </b>

Andreas

Read only

Former Member
0 Likes
1,024

Hi,

Maybe you should simply add a grouping column (in the example: FLIGHTNUMBER) at the first position of your grid and then sort the table by this column?

Regards, Joerg

Read only

0 Likes
1,023

Hi Joerg.

You name an example: FLIGHTNUMBER, where can i find it and is FLIGHTNUMBER the full name?

Regards

Liselotte

Read only

0 Likes
1,023

Hello Loselotte,

Misunderstanding

I meant the columnt (fieldname) FLIGHTNUMBER in your example code.

My suggestion would be to add FLIGHTNUMBER as the first column in your grid and then sort by FLIGHTNUMBER. You would achieve a result similar to the one with AT ... ENDAT.

Regards, Joerg

Read only

0 Likes
1,023

Hi again.

I have added the column, but how do i make it a grouping column? Do you have an code example?

This is how it looks now:

School 12000 25

School 13000 36

School 14000 89

Junior 23000 84

Junior 24000 56

I would like that School and Junior is only present once.

Regards

Liselotte

Read only

0 Likes
1,023

Hi,

Two possible ways:

1) Interactively - simply execute the report and select the first column and sort by this column. Afterwards you can save this layout - standard ALV behaviour.

2) Programmatically - you prepare an internal table with a description of your sorting criteria and pass it to the methods / FMs. See the Reference at https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/an easy reference for alv grid control.pdf

section C.2 for an example.

Hope this helps (please reward me if it does ,

Joerg

Read only

Former Member
0 Likes
1,023

What do you want to put in the header? If it is a total of some numeric fields, then follow the earlier suggestion to sort by FLIGHTNUMBER, then use the subtotaling features of the ALV grid to get a header line with the subtotals.

Let us know how it goes.