Hello,
I need to pilot SAPGUI from my own Lazarus app using the SAPGUI Scripting interface.
I've found a similar help request on the SAP forum, but unfortunatly there is no answer:
https://scn.sap.com/thread/2137793Using VB.net I can connect to SAPGUI with a few lines of VB code:
Imports SAPFEWSELib 'import SAPGUI Scripting library
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim sapguiauto As Object = GetObject("SAPGUI") 'create activex object
Dim application As GuiApplication = sapguiauto.getscriptingengine 'get scripting engine
Dim connection As GuiConnection = application.Children(0) 'get first connection
Dim session As GuiSession = connection.Children(0) ' get first session
session.FindById("wnd[0]/tbar[0]/okcd").text = "IW23" 'select transaction IW23
session.FindById("wnd[0]").sendvkey(0) 'send return key
session.FindById("wnd[0]/usr/ctxtRIWO00-QMNUM").text = "91013157" 'feed additional data
session.FindById("wnd[0]").sendvkey(0) 'send return key
End Sub
End Class
It would be nice if someone could convert these few lines of VB code to FPC/Lazarus code.
I've already imported SAPFEWSELib from "c:\program files\sap\frontend\sapgui\sapfewse.ocx", but I'm not able to create the ActiveX object properly.
Within "sapfewselib_1_0_tlb.pas" converted file I find:
TEvsGuiSession = Class(TEventSink) and TEvsGuiApplication = Class(TEventSink)
Thank you in advance for your help.