How to enabale ALV grid display in MB5B in S4 HANA
There is an old requirement from functional side and end users for having MB5B in ALV grid display format. “Is it possible to display the result of transaction MB5B as ALV gird ?”
In this blog I will discuss the steps needed to enable ALV grid display format for tcode MB5B in S4 HANA.
Output of MB5B is as follows without “Output as ALV Grid” indicator.
To enable option of “Output in ALV Grid”. You have to activate the business function.
“LOG_MM_OPTIMIZATIONS” and BADI “MM_UI_OPTIMIZATIONS”.
Details is available in sap note.
2998335 – Activate “Output as ALV Grid” indicator in MBLB – SAP ONE Support Launchpad
After completing these steps output will be as follows showing “Output in ALV Grid” option.
The instructions in the note are very short:
I'm honestly not sure why this needs to be complicated and couldn't just be included by default. It's still an option on selection screen. If someone doesn't want it, they won't use it.
Thanks a lot for your effective solution.
To make it clear, it's not my solution, I just copy-pasted from the SAP note. For some reason the author didn't do that and not everyone has S-user to access SAP Notes all the time.
Glad you found it useful. Thanks!
Exactly what I was looking for my requirement. Thank you so much for this post. Extremely helpful.
I activated the BADI and Business function. I see output as ALV grid checkbox now.
This is my observation of standard SAP code and system behavior:
If we simply select the output as ALV grid checkbox, it does NOT show the output as ALV grid. It still shows the output as List.
In order to show the output as ALV Grid, we have to additionally select the "Total Only - Non - Hierarchical Representation checkbox. ONLY if both the checkboxes are selected, output comes as ALV grid.
Output looks like this:
ALV Grid display
I figured this out by debugging the standard code for MB5B when I noticed that we need to enable this checkbox. Not sure if I am doing anything incorrectly. My question is - When this is not mentioned in the SAP Note, why is the code only showing ALV grid output when the Totals checkbox is checked?
If we look at line 1396 of report RM07MLBD, we will see if else statement.
This is where, standard code checks if the totals logic should be applied or not.
Scenario 1: Execute the report by selecting only the ALV grid checkbox.
We will see that code will execute line no 1414 in report RM07MLBD which is nothing but displaying the output as List.
Scenario 2: Execute the report by selecting ALV grid as well as Totals checkbox.
We will see that code will execute line no 1406 in report RM07MLBD which is nothing but displaying the output as ALV Grid.
So based on my understanding, we have to select Totals checkbox in combination with ALV grid checkbox.
Experts - Please correct me if this understand is wrong.