Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
6,964

I read recently some great articles about the new enhancement framework from Thomas Weiss. You can find the series in the SDN wiki here.

I got an idea, how easy it is to extend SAP classes or function modules for customers without making modifications! In my article I want to show you how you can restrict the hierarchies for profit center if user presses F4 help on a hierarchy variable in the Bex variable screen with the enhancement framework.

I created a few very simple hierarchies on profit center.

 

I created a very simple query on a cube where I had Profitcenter, Fiscal period and Amount. It simply shows the periodic costs for the profit centers.  Then I created a hierarchy variable and a hierarchy node variable and added it to the query as filters for profit center.

"

The corresponding variable for hierarchy nodes:

The query itself looks simple:

If you execute the query, the variable screen appears and asks you to choose a hierarchy. If you press F4 button for value help for the hierarchies, BW standard displays all hierarchies of profit center. In my example, I got this result.

This is not very comfortable, especially if the user is restricted to one or two hierarchies only. He has to know which to choose or find out with trial and error the hierarchy he’s authorized for. It would be nice to have an option where you can display the hierarchies only the user is granted for or hide those hierarchies which should not be used for a query. I debugged the F4 help in ABAP and Java Web. I found out, standard BW ends up in the function module RSR_HIER_IOBJ_GET.  Unfortunately I found no parameter to restrict the hierarchies. Of course I don’t want to make a modification to this function module. The new enhancement framework now gives you a very easy solution to solve this problem.

The first thing you have to do is create an enhancement. In transaction SE37 choose function module "RSSH_HIER_OF_IOBJ_GET" and display code. Go to menu Function Module->Enhance Source Code. The source code will be displayed in a sort of modification view. Now you can go to menu EDIT->Enhancement Operations->Show Implicit Enhancement Points. You will see an enhancement point at the beginning and at the end of your function module. 

In this very simple demo case extending the function module at the end is the appropriate thing. I take the results of the function module and delete all hierarchies from the result table except one. But you could also think of an authorization table to select the authorized hierarchies or implement any algorithm to restrict the number of hierarchies displayed. Because it is the central end point for all hierarchies of every infoobject, you should restrict the function to only this infoobject and/or user you want to restrict. For any other infoobject and/or user the code will not be executed. For use in authorization you have to make sure that you have taken users with star-authorization into account. Otherwise it can happen that users couldn't choose any hierarchy to this infoobject.

Now place your curoso at the second enhandement point at the end of the standard code and go to menu EDIT->Enhancement Operations->Create Enhancement. In the following Popup you will we be asked if you want to enhance declaration, code or cancel this operation. I choose "Code". In the next window you enter the name your enhancement like this: 

 

Now you can enter your code, save and activate and test it. After activation the function group will also be recompiled!

 

Now save and activate your enhancement. The function module will also be re-compiled. Now execute the query again. Press F4 help on your hierarchy variable. The result will be that:

The result is really overwhelming.

3 Comments
Labels in this area