Explore ALV Graphs
Graphs play a very vital role and have got great impact on business decisions. Senior Management, Clients, Customers all such stake-holders want to see information through Graphs to understand things easily. In SAP we have easy tool facility in ALV screens, but …… It has been observed that threads related to ALV Graphs are rarely seen here.
At the end of this document, members will be familiar with the basics about the ALV Graphs, as well as about various features available. I am sure certain cross-section of members will be benefited by this post through which they will be learning how to interpret the ALV data into various types of Graphs.
The features discussed in this document are largely applicable to ALVs of custom programs developed through SAP Queries or ABAP codes using fm ‘REUSE_ALV_GRID_DISPLAY‘. Things mentioned in this document are not applicable to ALV Graphs through Standard programs.
Here we start…..
How we get a Graph in ALV?
We know that Graphs need numeric fields for Y-Axis. So the ALVs not containing a single numeric field are not Graph-relevant. Also the field for which you want to plot a Graph, looks like a Numeric, but if its data type is Character, then too it is not possible to plot a Graph for this field. In other-words we can say that, the ALV Layout where there is no icon in the Application Toolbar, we will not be able to draw Graphs.
Ok…Let’s come back to the Graph possibilities. We are in the following ALV screen. Here these are 2 fields for X-Axis namely FinYr and Equipment Description. We have 4 numeric fields for Y-Axis i.e., MTBR, MTTR, TotBDns and Avlb%.
Now select the first 2 columns (for X-Axis) and 3rd column for Y axis (Means we are drawing graph for MTBR values) as shown in the picture below….
….and click on the Graph icon to get this graph window.
What we see in this picture is, system default scale presents only 5 bars in X-axis, for the rest we need to use horizontal Scroll (seen in the picture).
Here we start our exploration of ALV Graphs
1. To have all the Graph bars in one view (in other-words to remove horizontal scroll)
Place the Mouse pointer anywhere on the X-axis line and Right click, to get this menu.
Click on Format Axis… to get a pop-up screen. Go to the tab Scale.
Change the value shown above to as many as you want. In our case the bars are 8. So we change this value to 8. Now the graph has got rid of horizontal scroll showing a;; the Graph bars, like this.
2. The Y-Axis
We see the bar with maximum value is touching the top of the Graph area, by default setting, where we want create some room above this. This is nothing but we need to set the Y-Axis value. Our present maximum value of Y-Axis is 2400. We want to change this to say 3000.
In a similar way we did for X-axis, keep the mouse pointer anywhere on the Y-Axis line, and right click. Go to Scale tab. and …….
change the Maximum value to 3000. See the graph now.
3. Display values on the Bars:
Right click anywhere in the Plot Area to get this menu.
4. Change the Type of Graph (Say to a PIE chart)
Refer to menu picture in Point3 above. Click on chart Type and in the pop-up Select Pies.
Select the pie pattern you like, We here selected the 1st one. Now see how our Graph looks like.
We got the Pies chart but the values disappeared. Follow the procedure explained in point3 to have Values of the Pies.
A number of Chart Type are available in this section of the Menu.
5. Titles to the Graph
Now Let’s Give a Title to our Graph and Configure it. Go to the Title tab of the menu in Point3, Give the Title you want. Say ‘MTBR Values FinYr-wise in Hrs’..
You can Drag & Drop this title to anywhere in the Chart Area. Also you can configure the Font, Font Size, Color etc by Right clicking on the edges of this Title box and choosing Format Chart Title.
In a similar way you can have Titles for your Axes from the same tab (Title tab).
6. Similar Graphs can be drawn for the rest of the value fields viz., MTTR, TotBDn and Avlb% by selecting these fields as the 3rd field for Graph (First two fields being FinYr and Equipment Description for X-Axis)..
7. Multiple Value Graphs:
Many times we have a requirement for multiple parameters for Y-Axis. This suits when we have an ALV report something like:
MTBR (Hrs) Financial Year wise:
In this case: The X-Axis will have FinYr, like the present case. The Y-Axis can have all the Equipment fields. In this case there will be 3 bars with different colors above each FinYr on X-Axis. This is a very suitable case for Multi-bar Graph because of the uniformity in UOMs for all 3 bars i.e., Hrs.
No two ALV fields in our current ALV are having same UOMs for demonstrating this case, we choose two fields MTBR and Avlb%. for this demo. I’ve selected first two columns(FinYr and Equipment Description), and MTBR and Avlb% (total 4 columns) . Now upon Clicking on the Graph icon, system presented the following Graph…
Now let’s discuss about the UOM (Unit Of Measure) on the Y-Axis. When this was a graph for MTBR alone the Y-Axis unit of Hrs is OK. But when we have plotted the Avlb% also, the Maximum value of which is 100, all these bars fell within the first grid line, which is 500 high.
8. Secondary Axis:
The above is the right situation to discuss about the Secondary Axis. i.e., we will have the vertical line on the right side converted as Axis for the 2nd bar (Avlb%). For this Right click on Plot Area ….
Select Secondary Axis.
Now your Graph looks better like this. (The Secondary Axis selected automatically has 0 – 100 Range)
To have values on the Secondary Axis, select as under in the Axes tab of Chart Options.
9. Changing the Colors of Bars, Pies etc.
For this Choose this option:
10. There are other features in the Plot Area / Chart Options Menu as shown below.
Some useful features are
– In the Grid-lines Tab you can remove or set Grid lines for both Axes.
– In the Legend tab you can have the Color Legend Settings.
You may explore what is there in other 2 tabs Data Table and Options. With this we have explored almost everything in ALV Graphs.
11. Now How to Save Graphs which we configured with so much effort.:
Without closing the Graph-window in the ALV layout, click on the Save Layout button on the Application toolbar
and Save the Layout. Now your graph is saved. Any time you select this layout, the graph will be appearing, Similarly, when you save any Selection screen variant with this Layout, upon Executing the report you will be directly presented the Graph. Please read ALV Graphs : An Accidental Discovery for details.
Graphs on Sub-Totals
While replying to a member’s query, I’d recalled another feature that should be added to this document., i.e., Graphs on sub totals
Suppose I try to draw a graph between Equipment and Breakdown duration for IW28 ALV by giving list of Equipments and range of Malfunction Start Date. In this case the output is likely to have several line items for a single equipment. The Graph (X-Axis) will be crowded with of Equipments repeating themselves several times. From such graph we would not get any information for analysis. Here comes the Sub-Total Graphs. For follow these steps. (Have Equipment and Breakdown Duration fields as 1st 2 columns for simplicity)
1. Sort the ALV by Equipment field
2. Select the Breakdown column and click on icon to display the totals.
(Notice that as immediately after this step a sub-total icon would be added to the toolbar next to icon.)
3. Now Select the Equipment column and click on this Sub-total icon. A report like this would appear.
This is giving Equipment wise Total Breakdown duration. Now let’s draw graph for Equipment-wise Breakdown duration. For this, click on the icon at Red-Arrow shown in above picture. This collapses the details and only Sub-total are visible now. as under.
Now select the Equipment Column and click on the Graph icon to get the desired Graph. I have taken IW28 case for ease of demonstration of this section (Sub-total graphs). As I said in the beginning, Graphs through standard reports are not that explorable as discussed in this document. For this very reason, I developed ZIW28 through Infoset query, where all these graph features are available.
Hope this document too helps members across the spaces in SCN.
Jogeswara Rao K
Keep it up for sharing your knowledge,it benefits to others as well as yours.
Thank you Sir,
for your recognition and continued support.
Jogeswara Rao K
Jogeshwara Rao garu,
It is nice to see your effort to help people.
Thank you Kishore !
The above Document is very very useful & Helpful for me
Can We get above such Graphs in IW28 Report also [Only Single column is selected in IW28]
As you must have read in the document, there needs to be atleast one Numeric Field in the IW28 ALV output. Such only 2 fields are there in IW28 report.
1. Breakdown Duration(Hr)
2. Wrk. Center Load/Piece
So you can draw Graphs for these parameters against your Equipment or Notification or Malfunction Date etc as X-Axis.
Select Equipment field and Breakdown Duration field, click on Graph icon.
Jogeswara Rao K
I have added some information at the bottom of the post about Sub-total Graphs. Please go through this. In fact another thing I realised was the things explained here are more applicable to Z programs or Infoset Queries. The Graphs through Standard programs are not that flexible.
Jogeswara Rao K
Hello Ashu and Joegeshwara,
We also have row count as numeric value field in most of the ALV reports for plant maintenance ( refer note 2111087). You can use this count to create meaningful chart for example number of orders for different types of maintenance activities.
Excellent Design of ALV Graphs with report presentation, Keep it up...!!!
Thanks for sharing ....!!!
Thank you Akhilesh for your good words!
Another excellent document - always thought that the use of graphs within the ALV functionality of list edit reports was pretty poor but your document dispells that theory!!
Thank you Gary for the motivating words. I'm glad you are benefited by this work.
That's very helpful. Great document.
Hi Jogeswara .
If I may, I still complement your document with the hint of how to print the chart.
Place the Mouse pointer anywhere and Right click, to get this menu.
For example, I generated a PDF 😉
That's a great Value addition. One needs to have a PDF printer installed in the PC, so that he/she can use this print option and get the graph created in PDF format. e.g., I did the same thing with my PDF printer pdf995 which is a part of Software995 package freely available on net. (Several other free pdf printers are available on net)
As far as the type of Graph you've used, as I mentioned there are such several types user can explore.
I should thank you to have added more value to this work, the final objective of which is benefit to the member.
Jogeswara Rao K
Useful to many...
Thanks for sharing
Thank you for your valuable review.
Jogeswara Rao K
I have seen SAIL in your profile earlier now I couldnt see.
Have you resigned or retired sir.
Just asked out of curiosity sorry if it seems too personal.
Very nice document .Thanks for your effort it will helpful for end users in lot of cases.
Thank you Gurunath for the review!!!
Jogeswara Rao K
Excellent, thanks for sharing this option.
Do you have any information from supporting graphs in WebDynpro based tables in a familiar way?
Thank you for the praise Krisztian Mihaly,.
I have yet to work in the queried area.
Jogeswara Rao K
excellent work, very useful document.
Thank you Jogeswara for sharing this Doc. 🙂
Thank you Nihal ! 🙂 Pleasure is all mine in sharing knowledge.
Thank you very much Anwer !
Thank you Silambu !
Though i am not the PM consultant,your contributions touches the heart of the consultants , how to involve in KEY RESULTS AREA / KEY PERFORMANCE AREAS of the company,
I would liked to learn PM module from you.
With best regards,
Thank you for the kind words as always.
The KPAs etc, if desired to be mapped through PM objects. then they can be mapped as Tasks of a Notification, whereas the Notification can be created in the name of an employee or in the name of a Section of the company as the requirement may be. And the Fulfillment can be described in the Tasks Long Texts. If marks to be give, you can have additional fields using User-Exit QQMA0011.
As far as learning a module is concerned, it is my strong belief that effective learning takes place only when we have real tasks in hand. In the other case, things faded away within no time. Few minutes ago I was telling one of my colleagues that I appear to be a teacher here, but in fact, I am the largely benefiting student here. So if you start with real assignments, SCN can be a perfect teacher for you.
Thanks again Devendra
Jogeswara Rao K
Thanks for your updation and courtesy.
Very Helpful!! Thank You!
Very helpful!!! Thank you !
Glad you liked it Santosh.
Thanks for your contribution, your document is helpful for all consultants irrespective of there modules. once again thanks a lot.
Thank you kamal,
That's a great compliment !
Jogeswara Rao K
Nice Blog. Very helpful when we are working report with Graphs. Thanks for sharing.
Glad Rajesh, You've found it Useful 🙂
nice doc !!!!!!!
Thank you Sandeep 🙂
This is very helpful and detailed document. It's very useful when we are working with Graphs.
Thanks a lot for sharing.... 🙂
Thank you Parag
Hi Jogeshwara ,
Thank you ..
Its very usefull document
🙂 Thank you mahabooba
Nice presentation & documentation Thanks for sharing
Thank you Mr.Sukant 🙂
Thanks for sharing & caring;
Thank you Mehmood Bhai
Excellent document. its very useful .
Am glad you are benefited by this work.
Thank you for review Nitin !
Very Helpful Document. Thanks for this. I used this in Implementation project.
Thank you Chaitanya 🙂
Thanks for nice document:) its so helpful
My doubt is there anywhere the graph which we save particular to layout will be saved?
Please see this post ALV Graphs : An Accidental Discovery
Thank you. A wonderful document from a great talented consultant 😀
Thank you Karim, That is a great compliment. 🙂
Dear Mr Jogeswara,
Its really new thing to know in such detail.Thanks for sharing it.
Thank you swapnil 🙂
Thank you swapnil 🙂 for the review.
The document make it so easy and interesting, thank you..
between, as in the last step I tried saving the layout after setting the properties keeping the graph itself, but it gets reset back to default form after saving the layout. would you be able to advise?
You need to either Tick the default checkbox while saving the layout OR Give the saved layout name, in the selection screen layout field, like this, before executing.
I did check Default settings check box and provided layout field too,still graph properties gets refreshed.. 🙁
May be the thing I observed was happening under some circumstances. My experience was with Z reports. I am not sure whether this would happen in graphs from standard reports.
Probably yes, I followed the given steps and it didn't happen as expected, its a z report only- anyhow, thank you for your kind response, appreciate it..
your document was a good experience though..
My recommendation is that you install last version of SAP GUI. Same issue happened to us and the solution was to update it.
Nice document and very usefull.
Thanks for sharing..
Thank you for the knowledge sharing.
Have you given any detailed method to address the KPA issue, which you have hinted-like using notification?
Have a great day,
Thank you James,
Probably you were referring to my reply to Devendra on KRA/KPA. That was an idea for mapping in SAP if someone desires. We did not have to go for this. Our employee KPA system is browser based on asp. There might be standard ways in SAP-HCM which we do not have.
You too Have a great Day.
Thank you Sam 🙂
Hi Jogeswara rao,
Keep Blogging 🙂
Thank you Vamsi,
Thank you Mr. Roa for the excellent guide on ALV graph. I am truly amazed with the detail level and completeness of this guide. Keep up your good work!
If I may ask for a favour. Could you elaborate further how's X-Axis and Y-Axis being determined in the graph? And, how easy is it to swap X-Axis with Y-Axis?
Thank you in advance. Cheers.
A graph is drawn for a numeric field as Y axis vs a field selected by you for X-axis. This is DEFAULT arrangement. In other words this is the Default Graph type or Chart type system provides (Type name is Columns). For your requirement of swapping axes, indirectly you are asking for a different Chart type called Bars. For this, Right click anywhere in the chart area and click on Chart Type... Now, when you click on any pattern you liked, your job is done. You will get a graph with swapped axes.
Hope you can see this. It's simple.
Hello Mr. Rao.
Thank you for your reply. Now I understand how's system determines X-Axis.
However, my question remain open for Y-Axis with the given scenario below in the context of Lines Graph.
Assuming I have column A, B and C which are all numeric fields. I choose column A as X-Axis. Between column B and C, I would need system to choose column C as Y-Axis instead of column B. In this case, how do I explicitly tell the system?
Hope you could enlighten me on this while I am still in the midst of figuring it out myself.
There are 2 options for you.
1. Hide column B
2..Remove Totaling of this column by selecting and clicking on icon.