Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Button like Object services button in Application tool bar

Former Member
0 Likes
1,424

Dear Friends,

I have to add a button in application tool bar which is similar to Object Services button in any transaction.

This i could do in ALV tool bar by following BCALV_GRID_07.

but instead of a button like that in ALV tool bar i need a button in Application tool bar which i build using PF Status.

Any help in this regard is higly appreciated.

-


I could add same functionality using ALV tool bar button but i want it in application tool bar

-


regards,

Simha

1 ACCEPTED SOLUTION
Read only

ian_maxwell2
Active Participant
0 Likes
972

I'm not sure the exact answer, but I suggest looking into the following:

Function SWU_OBJECT_PUBLISH, if you execute this function it places the GOS button at the top left of the screen. This function is called by several transactions that use GOS, in particular I traced through MM02 and saw the call to it. The function is a wrapper around the class CL_GOS_MANAGER which in turn calls the class CL_GUI_TOOLBAR (Inherited from CL_GUI_CONTROL) to handle the toolbar and button. Specifically if you put a breakpoint on the constructor of CL_GUI_TOOLBAR and run a transaction such as MM02 you'll see the call that is done to initialize the button.

It's kind of cool, you can call this function in SE37 and suddenly there is a GOS button display in SE37 linked to whichever buisness object instance that you gave the ID for in the input parameters.

Looking a bit further through the code and debugging it appears that the button is handled as an ActiveX or JavaBean control (Dependending on the environment).

IF NOT activex IS INITIAL.

clsid = 'SAP.Toolbar.1'.

ELSEIF NOT javabean IS INITIAL.

clsid = 'com.sap.components.controls.toolBar.SapToolBar'.

ENDIF.

This would lead me to belive that you could build similiar functionality by building your own ActiveX control, registering it then calling it from your own class that would extend CL_GUI_CONTROL.

I've done some building of controls in the past (several years ago) but it isn't too difficult. I used a windows based language (Delphi) to build the control and then built a class on the SAP side to interface with it. The controls that I did were in the main part of the screen instead of the toolbar, but I'm sure that some more debugging of CL_GUI_TOOLBAR would show what settings are required to get it to display in the toolbar area.

The one issue I see with this is that external controls such as this would have to be installed on all workstations that will be using your functionality. In the case of the GOS control this would have been installed along with the SAPGUI.

I hope this helps. It's not your full answer but hopefully leads you in the right direction.

~Ian

4 REPLIES 4
Read only

uwe_schieferstein
Active Contributor
0 Likes
972

Hello Simha

I assume you would like to have buttons with the small icon for a dropdown list of "sub-functions".

Question: Have you ever seen a SAP standard application with such function buttons in application toolbar?

I am not aware of any. Thus, I assume this functionality is not possible.

Also, think about the definition of such a button in the GUI builder: one button = one function

Sub-Functions can be implemented by sub-menus.

If you nevertheless find a way to implement your requirement please share your knowledge with us.

Regards

Uwe

Read only

0 Likes
972

Hi Uwe,

Thanks for you sarcastic answer..Never mind.

But we developers have to make crazy users understand our difficulty, Right !!!

Will definitely let you know if i find a solution to this problem.

Thanks,

Simha

Read only

ian_maxwell2
Active Participant
0 Likes
973

I'm not sure the exact answer, but I suggest looking into the following:

Function SWU_OBJECT_PUBLISH, if you execute this function it places the GOS button at the top left of the screen. This function is called by several transactions that use GOS, in particular I traced through MM02 and saw the call to it. The function is a wrapper around the class CL_GOS_MANAGER which in turn calls the class CL_GUI_TOOLBAR (Inherited from CL_GUI_CONTROL) to handle the toolbar and button. Specifically if you put a breakpoint on the constructor of CL_GUI_TOOLBAR and run a transaction such as MM02 you'll see the call that is done to initialize the button.

It's kind of cool, you can call this function in SE37 and suddenly there is a GOS button display in SE37 linked to whichever buisness object instance that you gave the ID for in the input parameters.

Looking a bit further through the code and debugging it appears that the button is handled as an ActiveX or JavaBean control (Dependending on the environment).

IF NOT activex IS INITIAL.

clsid = 'SAP.Toolbar.1'.

ELSEIF NOT javabean IS INITIAL.

clsid = 'com.sap.components.controls.toolBar.SapToolBar'.

ENDIF.

This would lead me to belive that you could build similiar functionality by building your own ActiveX control, registering it then calling it from your own class that would extend CL_GUI_CONTROL.

I've done some building of controls in the past (several years ago) but it isn't too difficult. I used a windows based language (Delphi) to build the control and then built a class on the SAP side to interface with it. The controls that I did were in the main part of the screen instead of the toolbar, but I'm sure that some more debugging of CL_GUI_TOOLBAR would show what settings are required to get it to display in the toolbar area.

The one issue I see with this is that external controls such as this would have to be installed on all workstations that will be using your functionality. In the case of the GOS control this would have been installed along with the SAPGUI.

I hope this helps. It's not your full answer but hopefully leads you in the right direction.

~Ian

Read only

0 Likes
972

Hi Ian,

Thanks for yout inputs and insight.

I shall try to debug as you said and try to handle in the same way as handled in any standard transactions.

Thanks.

Simha

--

closing this thread

---