Sapass

 Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> Sap_Active_X>Log on by Logon Control



Index

Log on by Logon Control

Same as to go with Function, you can logon with Logon object. But some of the methods are only available in the Function object so it's better to go along with Function object. This utilize the ActiveX module in ...SAP/FrontEnd/Controls/wdtlog.OCX. This actually nothing different from the one in Function object.


(A) Example of VBA/VB macro code
Sub TempLogon4()

Dim objLogon As Object 'Logon control
Dim sapConn As Object
Set objLogon = CreateObject("SAP.LogonControl.1") 'Create ActiveX object

Set sapConn = objLogon.NewConnection
If sapConn.Logon(0, False) <> True Then 'Try Logon
  MsgBox "Cannot log on to SAP"
End If

End Sub


(B) Properties for Connection object
EventsLong Enables or disables events triggered by the control
tloDisableAllLogonEvents = 0
tloEnableOnClick = 1
tloEnableOnLogoff = 2
tloEnableOnError = 4
tloEnableOnCancel = 8
tloEnableAllLogonEvents = 32767
*All can be combined.
CaptionString Text on the button.
BackColorColor Background color of the button.
hWndHWND Window handle of the button.
EnabledEnabled Enables the button.
FontFont Font of button text.
ParentHWND Window handle of parent window.
DefaultBoolean Button Default pushbutton.
ApplicationName String Name of the application that uses the Logon control, used to identify connections.
SystemString SAP system name.
ApplicationServer String Application server name.
SystemNumberLong System number.
MessageServerString Message server name.
GroupNameString Group name.
TraceLevelLong Debug on/off.
RfcWithDialogLong Connection go through SAP GUI.
*Any other values than 0 will be treated as "On". (Read/Write)
ClientString Logon client.
UserString Logon user.
LanguageString Logon Language.

17-Sep-2005