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: 

Header Line Per ALV group of items in GRID not LIST.

Former Member
0 Kudos

Hello Experts,

My question may seem very basic but i am stuck with it.

I am using ALV Grid function (REUSE_ALV_GRID_DISPLAY) to display my ALV.

Example Case :

I have 10 line items .

1) 2 line items are sports.

2) 2 line items are books.

3) 2 line items are Mobiles.

My ALV displays like this :

No. Object Object Type

1) Ball sports

2) Bat sports

3) Maths Books

4) History Books

5) Nokia Mobiles

6) Samsung Mobiles

And i want it like this :

No. Object

Sports <---- I want this to act as header per line item .

1) Ball

2) Bat

Books

3) Maths

4) History

Mobiles

5) Nokia

6) Samsung.

I.e i need a row stating Object Type IN ALV Grid similar to how we make use of AT NEW EVENT in LIST REPORT.

Thanks in Advance,

Sudeep.

Edited by: Sudeep Yerunkar on Jul 21, 2010 11:40 AM

1 ACCEPTED SOLUTION

vishal_sharda2
Participant
0 Kudos

Hi,

If GRID is a 'MUST' requirement, then you can try preparing your internal table in the manner you want the output.

Something like this:

- Sort the output internal table.

- Loop on the output int table.

- Use AT NEW object type

- Append Object Type into another internal table

- Then read rest of the records with same object type into another internal table and appending the same.

Not sure about the efficieny but you can try.

BR,

Vishal.

7 REPLIES 7

Former Member
0 Kudos

Hi Sudeep,

Check the Demo programs that SAP had provided.

Rather than using ALV Grid, check ALV Hierarchy that should help you BCALV_TEST_HIERSEQ_LIST

or check for other Demo programs in SAP

SE38 --- > BCALV*

Former Member
0 Kudos

Hi sudeep

REUSE_ALV_LIST_DISPLAY is FM used to display simple table structure.But ur requirement is to display data in hierarchy .

Like

Sports

Bat

Ball

Movies

For this purpose you need to use another Fm which is REUSE_ALV_HIERSEQ_LIST_DISPLAY.

Hope it will help you

Thanks!!

RJ

0 Kudos

Hello Raj / Rahul,

Thanks for replying , but my client's requirement is specific about ALV GRID & hence i am stuck .

If it was a list report , there are events which can handle the scenario.

Also the FM you have listed deals with LIST reports & not the GRID ones.

Plz help.

Thanks,

Sudeep.

Former Member
0 Kudos

Hello Sudeep,

the closest approach to your requirement are subtotal lines. If you don't like the subtotal texts you can change them by handling event SUBTOTAL_TEXT, see [http://wiki.sdn.sap.com/wiki/display/Snippets/DisplaysubtotaltextinALV+report].

0 Kudos

Hi Sudeep

I donu2019t thing subtotal will be of any help in your case.Acc to me your req is specific and can only be fulfilled by the Hiercharchy Structure and not by reuse alv grid display.

Thanks!!

RJ

vishal_sharda2
Participant
0 Kudos

Hi,

If GRID is a 'MUST' requirement, then you can try preparing your internal table in the manner you want the output.

Something like this:

- Sort the output internal table.

- Loop on the output int table.

- Use AT NEW object type

- Append Object Type into another internal table

- Then read rest of the records with same object type into another internal table and appending the same.

Not sure about the efficieny but you can try.

BR,

Vishal.

Former Member
0 Kudos

Thanks All.

I followed Vishal's method to display data .