cancel
Showing results for 
Search instead for 
Did you mean: 

How to Insert a button in SAP standard Toolbar?

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schnell
Active Contributor

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-------------------------------------------------------------------

Answers (4)

Answers (4)

Sandra_Rossi
Active Contributor

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.

Former Member
0 Kudos

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).

Former Member
0 Kudos

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!

raymond_giuseppi
Active Contributor
0 Kudos

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

aneel_munawar
Participant
0 Kudos

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'.

Sandra_Rossi
Active Contributor
0 Kudos

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