07-21-2010 8:29 AM
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
07-22-2010 5:01 AM
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.
07-21-2010 10:43 AM
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*
07-21-2010 10:50 AM
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
07-21-2010 6:23 PM
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.
07-21-2010 11:09 PM
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].
07-22-2010 4:37 AM
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
07-22-2010 5:01 AM
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.
07-23-2010 5:56 AM