Skip to Content
0
Former Member
Jul 08, 2016 at 11:04 AM

Approve shopping carts extensions - How to hide "Forward"? (Hook problem)

35 Views

My goal is to hide the forward button in the footer of this app. I will explain my investigation but if you don’t like to read this you can just skip to the final question.

Step 1: reading documentation

I checked the online help for the app extensibility: http://help.sap.com/fiori_bs2013/helpdata/en/a7/93ca5209b3be66e10000000a441470/content.htm

There you can find the hook list. Regarding to the description extHook3 seems to be the one to get it done. But extHook3 is in ItemDetail.contoller.js. But there is no footer if the view ItemDetail is displayed. Maybe you can add some buttons to the header here like it is described in the code of the app but I think you can't hide (remove) a footer button here.

Step 2: searching the right hook

The S3 view has to be the right view because it is the right side of this master/detail app and it has a footer und the corresponding controller creates the footer buttons.

extHook2 is listed in the online help for S3. But if you look at the code it seems again the wrong place. But I've found another hook which isn't documented, extHookBind.

If I write the following code in the extHookBind of my extended controller for S3

this.setBtnEnabled("forwardBtn", false);

It's works as expected. The button "Forward" isn't active. So this hook seems to be a good candidate.

But I want to hide the button. So I need different code here.

Step 3: Finding the right code and examine the S3 controller code

I searched via Google for a solution for my problem and found hints that SAP provides special hooks (extHookChangeFooterButtons) for doing this. But I haven't such a hook in the approve shopping carts app.

If you look into the S3 controller code you can find a function createHeaderFooterOptions for creating custom footer options. But the return isn't stored in any variable. The function setHeaderFooterOptions calls every time this create method. I see no chance to manipulate the button list.

I tried to create the button list by myself and I removed the "Forward" button. But If I do this the current visibility status of the Approve and Reject button is gone. I have to set it again in correspondence to the currently shown data. In my mind this is too complicated.

Final question

Is there any easy way to accomplish my goal?