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: 

How can I add a custom title to multiple ALV reports selected by layout?

former_member210148
Participant
0 Kudos

Greetings and good day, everyone!

Within the past week or so, I posted a question asking the best way to create a program that would generate multiple ALV reports. I got some great ideas, and I've actually coded up a few simple demos based on your feedback -- thank you!

Here's the issue I'm running into: Many of you suggested that I put all report records into one table, and create a field that I could use to filter on later to determine which fields I want to display for the report. For example, if I have 3 different reports, I put all the fields for all 3 reports into a table. I then add a "report key" field. As I put records into the report table for report 1, I code "01" into the "report key" field. I do the same for reports 2 and 3, assigning each a "report key" of "02" and "03", respectively.

I then set up layouts in the ALV for each of the three reports, using the filter option to only pull records with the "report key" value for that particular report. This all works wonderfully! However, I seem to have lost the ability to show a custom title for each layout. I can create a generic TITLEBAR (like "Reporting Center") but I don't know how to reset the grid's title when a layout is selected. I was hoping that SAP might use the layout description as the title on each page, but it doesn't -- it uses the TITLEBAR text.

Any ideas? I think this might be the best way to program multiple ALV reports, but if I can't display the right report title for a particular layout, I'll probably have to go back to my other alternative of putting each report in its own container/screen, and having a button to access each report from the application toolbar.

Thanks,

4 REPLIES 4

Former Member
0 Kudos

Here, i am displaying the title based on the selection-screen radio button selected by user.

you can replace with your requirement.

IF p_disp = c_x.

wa_layout-window_titlebar =

'Display Work Order History / Status'.

ELSEIF p_del = c_x.

wa_layout-window_titlebar =

'Delete Work Order History / Status'.

ELSEIF p_upd = c_x.

wa_layout-window_titlebar =

'Change Work Order History / Status'.

ENDIF.

Regards,

Srikanth.

0 Kudos

Srikanth,

I don't have any Selection Screen radio buttons for the user to select a particular report; in my case, they specify some needed criteria by the program in the Selection Screen, the program goes off and does a fair bit of processing/updating, and then displays the ALV reports when finished. They don't want to choose one particular report to view ahead of time; they want to have all 3 (in my case) there to see what processed correctly, what was eligible to process but kicked out with errors, and what failed some matching checks done up front (this layout includes additional fields from the input file so they can see what didn't match up against R/3).

So, while I do like the code example you presented, I don't think it's going to help me in my case.

Former Member
0 Kudos

Are you using ALV grid function module or controls using OO? In the function module, you will find the parameter I_GRID_TITLE which you can use to set the title of the grid. In OO, you can use the method SET_GRIDTITLE of the CL_GUI_ALV_GRID class.

Former Member
0 Kudos

You should use the GRID_TITLE parameter to have a separate heading for each grid you are displaying.

Regards,

Ravi