on 12-18-2012 10:17 AM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
http://help.sap.com/saphelp_crm700_ehp02/helpdata/EN/4a/097b0543f4088ce10000000a421937/content.htm
this both link u get complete reference with code but u need SAP.NET.CONNECTOR dll
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.