Skip to Content
0

How to Insert a button in SAP standard Toolbar?

Nov 03, 2016 at 02:56 PM

274

avatar image

Hi All,

I have requirement wherein I need to put a custom button in the SAP STANDARD Toolbar, which on being pushed shall redirect to a link which will contain my Company details or can be used to segregate the Production and Non- Production system.

Also I would like to know the SAP standard program which triggers when the SAP easy Access screen loads, as I want my requirement to be placed just after logging into SAP landscape.

I have attached the screenshot depicting the same requirement

Thanks in advance :)

Sincerely,

Saptarshi Mitra

logo-1.png (5.8 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Stefan Schnell Nov 08, 2016 at 06:57 AM
3

Hello Mitra,

from another non-backend perspective it is possible to customize the toolbar. Here is a frontend solution via AutoIt script which adds a button to the toolbar of the SAP GUI. The script uses Windows API functions to add the button to the toolbar. It gets the handle from the toolbar, adds a button and registers a callback routine. In this callback routine you can add your activities. Here you can control the SAP GUI via SAP GUI Scripting or communicate with the backend via RFC. But it is necessary to copy a local AutoIt interpreter with the dependent include files on the frontend server.

Cheers
Stefan

;-Begin-----------------------------------------------------------------

  ;-Include files-------------------------------------------------------
    #Include "Include\Constants.au3"
    #Include "Include\WinAPI.au3"
    #Include "Include\WindowsConstants.au3"

  ;-Variables-----------------------------------------------------------
    Dim $hWin, $hToolBar1, $Quit
    Dim $hBtn_SCAP_Proc
    ;-Predefined variables----------------------------------------------
      Dim $WinTitle = "[CLASS:SAP_FRONTEND_SESSION]"
      Dim $ToolBar1 = "[CLASS:Afx:525A0000:0:00010003:00000010:00000000]"
      Dim $ToolBar2 = "[CLASS:Afx:525A0000:8:00010003:00000000:00000000]"

  ;-Function btnSCAP_CallBack-------------------------------------------
    Func btn_SCAP_CallBack($hWind, $uMsg, $wParam, $lParam)
      Switch $uMsg
        ;-ToolTip-------------------------------------------------------
          Case $WM_MOUSEMOVE
            ToolTip("This is my button")
          Case $WM_MOUSELEAVE
            ToolTip("")
        ;-ButtonClick---------------------------------------------------    
          Case $WM_LBUTTONUP
            ;Add your code here
            MsgBox(0, "", "This is my button")
      EndSwitch
      Return _WinAPI_CallWindowProc($hbtn_SCAP_Proc, $hWind, $uMsg, _
        $wParam, $lParam)
    EndFunc

  ;-Procedure AddButton-------------------------------------------------
    Func AddButton()
      $hWin = WinGetHandle($WinTitle)
      $hToolBar1 = ControlGetHandle($WinTitle, "", $ToolBar1)
      ;-SCAP button-----------------------------------------------------
        Dim $hbtn_SCAP = _WinAPI_CreateWindowEx(0, "BUTTON", "My Button", _
          $WS_VISIBLE + $WS_CHILD, 680, 6, 75, 20, $hToolBar1)
        $hbtn_SCAP_Proc = _WinAPI_GetWindowLong($hbtn_SCAP, _
          $GWL_WNDPROC)
        Dim $ptr_SCAP_CallBack = _
          DLLCallBackRegister("btn_SCAP_CallBack", "ptr", _
          "hwnd;uint;long;ptr")   
        _WinAPI_SetWindowLong($hbtn_SCAP, $GWL_WNDPROC, _
          DLLCallBackGetPtr($ptr_SCAP_CallBack))
      ;-Set tray--------------------------------------------------------
        Opt("TrayMenuMode",1)
        $Quit = TrayCreateItem("Exit")
        TraySetState()
      ;-MainLoop--------------------------------------------------------
        While 1
          Sleep(35)
          Switch TrayGetMsg()
            Case $Quit
              ExitLoop
          EndSwitch
        Wend
      _WinAPI_SetWindowLong($hToolBar1, $GWL_WNDPROC, $hbtn_SCAP_Proc) 
      DLLCallBackFree($ptr_SCAP_CallBack)
    EndFunc
    
  ;-Main----------------------------------------------------------------
    AddButton()    

;-End-------------------------------------------------------------------

addbutton.jpg (59.5 kB)
Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Nov 04, 2016 at 11:57 AM
1

You just can't customize the "standard toolbar" (the one you indicate).

.

But you may modify the standard "system" and "help" menus (GUI status MEN of program MENUSYST; modification key needed), to add your own menu entry.

Share
10 |10000 characters needed characters left characters exceeded
Aneel Munawar Nov 04, 2016 at 10:12 AM
-1

create a z program and copy the status bar from the standard sreen to that z program and then create an enhancement point in the standard program and set the status from your Z program.

Example.

SET PF-STATUS 'ZBO00V' of PROGRAM 'ZSAPMV13A'.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

This will only apply to the "application toolbar", the OP wants the "standard toolbar".

0
Raymond Giuseppi
Nov 04, 2016 at 03:08 PM
0

AFAIK this part of screen is not available to us, but you could try to 'play' with a toolbar (cl_gui_toolbar) attached to current dynpro at start of session (some exit like EXIT_SAPLSUSF_00, but try/catch/entry as a rule, else you may kill connection to your system...)at your own risk!

But there are other options like display of a small html in right part of menu dynpro that are much more safe. (*)

Regards,
Raymond

(*) 1387086 - HTML viewer in SAP Easy Access screen

Share
10 |10000 characters needed characters left characters exceeded
Armin Junge Nov 08, 2016 at 10:10 AM
0

Maybe you can add your Button with SAP Personas. I know you can add Buttons (e.g. on screens) this way, but I'm not sure if it is also possible for the standard toolbar (I never tried).

Show 1 Share
10 |10000 characters needed characters left characters exceeded

It is possible, but you'd need to build a flavour for every transaction in which you need this extra button. If you only need it in a few transactions this would work. If you need it in lots of, or all, transactions, this isn't practical!

0