There are documents already published on how to restrict F4 help values in BI Report queries. But in case where you have to do this for more than one query we can make this dynamic and same BADI implementation can be called for all the reports for which this is required.
We were working on retail SAP BI implementation and we have a requirement of having different levels of article hierarchy in selection screen in most of the reports that we have developed. Now the requirement was to populate the second level of hierarchy based on the first level and third level based on the second level.
So for example this first level of hierarchy is Department.
Department will have Values as below
Now if the next level is division it will have values like
Now if the user enters Department 1, for division F4 help he should only see below values
Now this has to be done for many reports.
We can create a parameter table in SAP BI and call it “ZBI_F4_HELP”.
Below will be the fields in the table
I_Query = Technical Name of the Query
I_IOBJNM = Technical Name of the Info-Object
I_VNAM = Technical Name of the Variable by which the info-object is restricted
I_DESC = The level of the Info-object (In our scenario for Department it will be 1 for division it will be 2)
The screenshot below shows the sample entries.
So from above screenshot what we want is when Query ZRT_MP01_Q046_A is executed, we want the F4 values for variable for 0MATERIAL_0CM_CDT2 should populated based on value for variable for 0MATERIAL_0CM_CDT1 and value for 0MATERIAL_0CM_CDT3 should be populated based on the variable value for 0MATERIAL_0CM_CDT2.
The code in BADI will look something like below.
We first read entries from the parameter table ZBI_F4_help for the given query.
Now we have to read the relevant row for the given info-object and populate variable values accordingly.
Sample code is given below for 2 levels. The values for second level is read from material master.