abhijit
Nov 29th, 2005, 12:24 PM
Hi Folks,
I have finally discovered a method of connecting VB 5 forms to SIEBEL. Its through COM. However the trouble that follows is much more painful.
Firstly you need to do a fresh siebel client installation.
Secondly the form crashes after doing a retrieval for the first time. Something is going very wrong. I am posting the code in case someone manages to see whats wrong.
Cheers,
Abhijit
Private Sub CommandButton1_Click()
Dim errcode As Integer
Dim SApp As SiebelApplication
Dim siebBusObj As SiebelBusObject
Dim siebBusComp As SiebelBusComp
Dim Name As String
Dim error As String
Dim myacc As String
ChDrive "D:"
' Use your installation directory
ChDir "D:\Siebel77\Client\BIN"
Set SApp = CreateObject("SiebelDataServer.ApplicationObject")
With SApp
.LoadObjects "D:\Siebel77\Client\BIN\ENU\siebel.cfg,ServerDataSrc", errcode
If errcode = 0 Then
TextBox1.Text = "Load Successfull" & SApp.GetLastErrText
.Login "SADMIN", "SADMIN", errcode
If errcode = 0 Then
TextBox1.Text = "Login Successfull" & errcode & SApp.GetLastErrText
'Creat A Business Object
Set siebBusObj = SApp.GetBusObject("Quote", errcode)
If errcode = 0 Then
TextBox1.Text = "BO Craetion Successfull" & SApp.GetLastErrText
'Create a Business Component
Set siebBusComp = siebBusObj.GetBusComp("Quote", errcode)
If errcode = 0 Then
TextBox1.Text = "BC Craetion Successfull" & SApp.GetLastErrText
With siebBusComp
.ClearToQuery errcode
.ActivateField "Account", errcode
.ActivateField "Opportunity", errcode
.ActivateField "Id", errcode
.SetSearchSpec "Id", TextBox2.Text, errcode
.ExecuteQuery True, errcode
If .FirstRecord(errcode) Then
TextBox3.Text = .GetFieldValue("Opportunity", errcode)
TextBox4.Text = .GetFieldValue("Account", errcode)
If errcode = 0 Then
TextBox1.Text = "Transaction Completed Successfully"
End If
Else
TextBox1.Text = "No Records Found. Please Enter a valid Quote #"
End If
End With
Else
TextBox1.Text = "BC Craetion Failed" & errcode & SApp.GetLastErrText
End If
Else
TextBox1.Text = "BO Craetion Failed" & errcode & SApp.GetLastErrText
End If
Else
TextBox1.Text = "Login Failed" & errcode & SApp.GetLastErrText
End If
Else
TextBox1.Text = "Could Not Load" & " " & errcode & SApp.GetLastErrText
End If
End With
End Sub
I have finally discovered a method of connecting VB 5 forms to SIEBEL. Its through COM. However the trouble that follows is much more painful.
Firstly you need to do a fresh siebel client installation.
Secondly the form crashes after doing a retrieval for the first time. Something is going very wrong. I am posting the code in case someone manages to see whats wrong.
Cheers,
Abhijit
Private Sub CommandButton1_Click()
Dim errcode As Integer
Dim SApp As SiebelApplication
Dim siebBusObj As SiebelBusObject
Dim siebBusComp As SiebelBusComp
Dim Name As String
Dim error As String
Dim myacc As String
ChDrive "D:"
' Use your installation directory
ChDir "D:\Siebel77\Client\BIN"
Set SApp = CreateObject("SiebelDataServer.ApplicationObject")
With SApp
.LoadObjects "D:\Siebel77\Client\BIN\ENU\siebel.cfg,ServerDataSrc", errcode
If errcode = 0 Then
TextBox1.Text = "Load Successfull" & SApp.GetLastErrText
.Login "SADMIN", "SADMIN", errcode
If errcode = 0 Then
TextBox1.Text = "Login Successfull" & errcode & SApp.GetLastErrText
'Creat A Business Object
Set siebBusObj = SApp.GetBusObject("Quote", errcode)
If errcode = 0 Then
TextBox1.Text = "BO Craetion Successfull" & SApp.GetLastErrText
'Create a Business Component
Set siebBusComp = siebBusObj.GetBusComp("Quote", errcode)
If errcode = 0 Then
TextBox1.Text = "BC Craetion Successfull" & SApp.GetLastErrText
With siebBusComp
.ClearToQuery errcode
.ActivateField "Account", errcode
.ActivateField "Opportunity", errcode
.ActivateField "Id", errcode
.SetSearchSpec "Id", TextBox2.Text, errcode
.ExecuteQuery True, errcode
If .FirstRecord(errcode) Then
TextBox3.Text = .GetFieldValue("Opportunity", errcode)
TextBox4.Text = .GetFieldValue("Account", errcode)
If errcode = 0 Then
TextBox1.Text = "Transaction Completed Successfully"
End If
Else
TextBox1.Text = "No Records Found. Please Enter a valid Quote #"
End If
End With
Else
TextBox1.Text = "BC Craetion Failed" & errcode & SApp.GetLastErrText
End If
Else
TextBox1.Text = "BO Craetion Failed" & errcode & SApp.GetLastErrText
End If
Else
TextBox1.Text = "Login Failed" & errcode & SApp.GetLastErrText
End If
Else
TextBox1.Text = "Could Not Load" & " " & errcode & SApp.GetLastErrText
End If
End With
End Sub