Dim Functions As Object
Dim GetCustomers As Object
Dim Customers As Object
Dim customers1 As Object
Dim Connection As Object
Private Sub SAPLogonControl1_Click()
Set Functions = SAPFunctions1
Set Functions.Connection = SAPLogonControl1.NewConnection
Functions.Connection.System = "W01"
Functions.Connection.ApplicationServer = "192.168.1.78"
Functions.Connection.SystemNumber = 0
Functions.Connection.User = "xxx"
Functions.Connection.Password = "xxxxxx"
Functions.Connection.Client = "202"
If Functions.Connection.Logon(form1.hWnd, True) = False Then
MsgBox "联接SAP失败!"
Exit Sub
End If
Set GetCustomers = Functions.Add("Z_MM_YKT_LL_1")
GetCustomers.Exports("MBLNR") = mblnr.Text (此处出现91错误)
GetCustomers.Exports("ZEILE") = zeile.Text
GetCustomers.Exports("USERID") = userid.Text
GetCustomers.Exports("USERNAME") = username.Text
If GetCustomers.Call = True Then
MsgBox " 已成功记录! "
Else
MsgBox " 记录失败!请检查凭证号和项目号是否正确 "
End If
Functions.Connection.Logoff