Hello community,

Freestyle BASIC Script Language (FBSL) is a true multitalent. It is possible to use it inside ABAP and to use it with SAP GUI Scripting, as the example here shows. It is only a simple logon, but it shows how to use FBSL in this case.

//-Begin----------------------------------------------------------------

  //-Directives---------------------------------------------------------
    #AppType Console
    #Option Strict

  //-Includes-----------------------------------------------------------
    #Include <Windows.inc>

  //-Main---------------------------------------------------------------
    Sub Main()

      //-Variables------------------------------------------------------
        Dim %SAPROTWrapper, %SapGuiAuto, %application, %connection
        Dim %session

      SAPROTWrapper = CreateObject("SapROTWr.SapROTWrapper", "")
      If Not SAPROTWrapper Then
        ExitProgram
      End If

      SapGuiAuto = GetValue("%o", SAPROTWrapper, ".GetROTEntry(%s)", _
        "SAPGUI")
      If Not SapGuiAuto Then
        ExitProgram
      End If

      application = GetValue("%o", SapGuiAuto, ".GetScriptingEngine")
      If Not application Then
        ExitProgram
      End If

      connection = GetValue("%o", application, ".Children(%d)", 0)
      If Not connection Then
        ExitProgram
      End If

      session = GetValue("%o", connection, ".Children(%d)", 0)
      If Not session Then
        ExitProgram
      End If

      PutValue(session, ".findById(%s).text = %s", _
        "wnd[0]/usr/txtRSYST-MANDT", "001")
      PutValue(session, ".findById(%s).text = %s", _
        "wnd[0]/usr/txtRSYST-BNAME", "BCUSER")
      PutValue(session, ".findById(%s).text = %s", _
        "wnd[0]/usr/pwdRSYST-BCODE", "minisap")
      PutValue(session, ".findById(%s).text = %s", _
        "wnd[0]/usr/txtRSYST-LANGU", "EN")
      CallMethod(session, ".findById(%s).sendVKey %d", _
        "wnd[0]", 0)

      ReleaseObject(SAPROTWrapper)

    End Sub

//-End------------------------------------------------------------------

FBSL can compile scripts to executable. On this way you can deliver your SAP GUI script to any target computer on Windows platform, without any dependencies.

Good Scripting.

Cheers
Stefan

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply