Skip to Content
avatar image
Former Member

How to Insert a button in SAP standard Toolbar?

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


Saptarshi Mitra

logo-1.png (5.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Nov 08, 2016 at 06:57 AM

    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.


      ;-Include files-------------------------------------------------------
        #Include "Include\Constants.au3"
        #Include "Include\WinAPI.au3"
        #Include "Include\WindowsConstants.au3"
        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
              Case $WM_MOUSEMOVE
                ToolTip("This is my button")
              Case $WM_MOUSELEAVE
              Case $WM_LBUTTONUP
                ;Add your code here
                MsgBox(0, "", "This is my button")
          Return _WinAPI_CallWindowProc($hbtn_SCAP_Proc, $hWind, $uMsg, _
            $wParam, $lParam)
      ;-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, _
            Dim $ptr_SCAP_CallBack = _
              DLLCallBackRegister("btn_SCAP_CallBack", "ptr", _
            _WinAPI_SetWindowLong($hbtn_SCAP, $GWL_WNDPROC, _
          ;-Set tray--------------------------------------------------------
            $Quit = TrayCreateItem("Exit")
            While 1
              Switch TrayGetMsg()
                Case $Quit
          _WinAPI_SetWindowLong($hToolBar1, $GWL_WNDPROC, $hbtn_SCAP_Proc) 
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 04, 2016 at 11:57 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 04, 2016 at 10:12 AM

    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.



    Add comment
    10|10000 characters needed characters exceeded

  • Nov 04, 2016 at 03:08 PM

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


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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 08, 2016 at 10:10 AM

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

    Add comment
    10|10000 characters needed 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!