Skip to Content
Technical Articles

SAP GUI Scripting in the Context of NetWeaver Business Client, a New Perspective

We see at the DSAG (German SAP User Group) the NetWeaver Business Client (NWBC) as replacement in the near future for the SAP GUI for Windows with the SAP Logon. From this point I considered the SAP GUI Scripting with NWBC for Desktop. At first I installed the NWBC 4.0 PL 4 and configured the application server. It runs well and I directed my attention to the SAP GUI Scripting.

First of all, it works. But there are some differences to SAP GUI Scripting inside SAP GUI for Windows.

  1.  If I open a second NWBC Client window and use the method Connections from the Application object with the property Count, I get not more than one connection. SAP GUI Scripting uses only the first NWBC Client window. Look here:
  2. The correct entry in the running object table (ROT) for the SAP GUI Scripting inside NWBC is SAPGUISERVER.
  3. If I record a SAP GUI Script with NWBC, it sets SapGuiAuto = GetObject(“SAPGUI”). If I start this script from Windows Explorer, it runs in a normal SAP GUI for Windows session. I think it should be SapGuiAuto = GetObject(“SAPGUISERVER”).
  4. In the NWBC is no Ok-Code-Field visible. It is possible to use it with SAP GUI Scripting because it is in the scripting object hierarchy, but it is not possible to record something with it in NWBC.
  5. In the NWBC is no Toolbar[1] visible and not useable. Older SAP GUI Scripts will not work and there is no equivalent.

My momentary conclusion: SAP GUI Scripting in the context of NWBC offers not the same possibilities as in SAP GUI for Windows context now. We will see what will happen in the future development of NWBC in this sector, I am curious.

You must be Logged on to comment or reply to a post.
  • Hello community,

    to 5.: I export with Scripting Tracker the object hierarchy from transaction code SE16 from the SAP GUI for Windows and the NWBC for Desktop and compare it. Here are the differences:

    In NWBC are available:

    In SAP GUI for Windows are available:

    The buttons from Toolbar[1] are now the buttons 210 to 213 in Toolbar[0].
    It seems that all buttons from Toolbar[1] are now in Toolbar[0]. I checked it with the transaction codes SE37 and ST05.

    Karsten Schurr had the great idea to work exclusively with the virtual key codes, and this works perfect.

    The following example works on both:
    session.findById("wnd[0]/tbar[0]/okcd").text = "/nse16"
    session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").text = "TSTC"
    session.findById("wnd[0]").sendVKey 7
    session.findById("wnd[0]").sendVKey 8

    This example works only on SAP GUI for Windows:
    session.findById("wnd[0]/tbar[0]/okcd").text = "/nSE16"
    session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").text = "TSTC"

    For the future it seems to be better to work with virtual key codes.

    • Have you tired to use business client 6 that is not returning any connection object from application object?

      I've SAP GUI 6.4 and SAP Business Client 6 installed on my machine. I'm able to use SAP scripting without any issue when working on SAP GUI 6.4 but when trying to use scripting on SAP GUI from SAP business client i'm unable to get any SAP connection object.

      I've verified that scripting is enabled on client as well as server side. I was able to get 'GuiScriptingEngine' object after retrieving SAP GUI object from window ROT. However I’m unable to retrieve connection object from 'GuiScriptingEninge' object as it does not has any children. No matter how many SAP connection/session are up, it always returns 0 child.

      • Hello Obaid,

        the combination of SAP GUI for Windows 6.40 and SAP NetWeaver Business Client 6 is little bit unusual. The support for SAP GUI 6.40 ends in October 2008 and the SAP NetWeaver Business Client 6 release date is October 2015.

        You can analyze the combination with Scripting Tracker.


        In my example with SAP GUI 7.40 and NWBC 5 you see each open session and NWBC flag is set.

        Try it in your environment and let us know your results.



        • Hi Stefan,

          Thanks for the update. In my earlier response I was refereeing to SAP GUI 7.4 instead of 6.4 (that was typo on my end).

          Though I never had trouble in using  scripting API on machine having NWBC 5 and SAP GUI 7.4. But after upgrading to Business client 6, I'm unable to get any connection object through the scripting. Interestingly, on same machine, I was able to interact with SAP GUI 7.4 with scripting without any issue.

          For Business client 6, I also tried to use SAP GUI native record and playback tool. Though this tool was recoding a script in similar fashion as was with NWBC 5 but when i play back that script i was getting same error. The error occurred at a point when it tried to retrieve connection object after retrieving object form window ROT.

          I'm wondering if SAP GUI has dropped support of scripting API with Business client 6!

          • Hello Obaid,

            I installed the actual release of NWBC 6.0 PL 1 on my system and try the SAP GUI Scripting and all works well - no problems with anything, all works as expected. I can record and I can replay, no restrictions, no problems, no dropping support. SAPGUISERVER exists in the ROT.


            It seems another point of problem in your case.