cancel
Showing results for 
Search instead for 
Did you mean: 

Check if SAP-Login successful

Former Member
0 Kudos

Hey there!

i want to check if my login to SAP was successful. I use this script:

Public Sub partSAP()

    i = 0

    Range("B:B").Clear

    Protokoll "Starte..."

   

    On Error GoTo Err

   

        'Variablen

    Dim SapGuiApp As Object

    Dim oConnection As Object

    Dim Session As Object

    Dim SAPguiAuto As Object

   

    If SapGuiApp Is Nothing Then Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")

    If oConnection Is Nothing Then Set oConnection = SapGuiApp.OpenConnection(sapSystem, True)

    If Session Is Nothing Then Set Session = oConnection.Children(0)

   

        'wenn SAP schon steht

'    Set SAPguiAuto = GetObject("SAPGUI")

'    If SapGuiApp Is Nothing Then Set SapGuiApp = SAPguiAuto.GetScriptingEngine

'    Set oConnection = SapGuiApp.Children(0)

'    If SAPSession Is Nothing Then Set SAPSession = oConnection.Children(0)

   

        'Fenstergröße anpassen

    Session.findById("wnd[0]").Restore

    Session.findById("wnd[0]").ResizeWorkingPane 111, 18, False

   

        'SAP-Login

    Session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = "330"

    Session.findById("wnd[0]/usr/txtRSYST-BNAME").Text = SAPForm.BoxUser.Text

    Session.findById("wnd[0]/usr/pwdRSYST-BCODE").Text = SAPForm.BoxPass.Text

    Session.findById("wnd[0]/usr/txtRSYST-LANGU").Text = "DE"

    Session.findById("wnd[0]").sendVKey 0

   

        'Systemnachricht wegklicken

    On Error Resume Next

    Session.findById("wnd[1]/tbar[0]/btn[0]").press

    Session.findById("wnd[1]/tbar[0]/btn[0]").press

    Session.findById("wnd[1]/tbar[0]/btn[0]").press

    On Error GoTo Err

   

        'Transaktion ausführen

    Session.findById("wnd[0]/tbar[0]/okcd").Text = "/n/SIE/AD_ZPP_PRIO"

    Session.findById("wnd[0]").sendVKey 0

   

        'Daten eingeben

    ErrLogin = True

    Session.findById("wnd[0]/usr/ctxtS_FEVOR-LOW").Text = ""

    ErrLogin = False

    Session.findById("wnd[0]/usr/ctxtS_DISPO-LOW").Text = "L03"

    Session.findById("wnd[0]/usr/txtS_WERKS-LOW").Text = "1"

    Session.findById("wnd[0]").sendVKey 8

.

.

.

How can i check if the login was succsessful or not?

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

do u have sap.net.connector.dll
then include it in your project & after that just fill include class sap connector pass connection string

then u will be check the code will work

but  u still need rcf call in sap to verify your data

Former Member
0 Kudos

sorry, i have no idea what you are talking about. iam not very expierienced in this.

maybe you can give me a code example? do you have any?

Former Member
0 Kudos