on 11-30-2004 9:03 AM
Hi friends ,
i've a strange problem.I use VB.NET
I declare and instance any DI object variables like "Company","Business Partners" and others.
While in normal procedures their values are recognized,in the Application_ItemEvent() and called functions they seem to lose their value...
My tool recognizes with (intellisense)the object, but in the runtime it seems not regognize the object....a little example :
I make an instance of a new company variable.
I set the properties and then connect it.
It works well until the VB procedures work,but then ,when Application_ItemEvent() takes place,it is not recognized.
I tried to declare a company object in this last Sub Application_ItemEvent() giving it the value of the Application.company ,but this last one works properly ,instead the new object seems empty.
I tried everything,
Can you help me please??
Thenk you
Giammichele
Hi Giammichele, your connection is bad!
You use the connection Single Sign On.
Ciao Giammichele, tu devi usare la connessione Single Sign On che ti allego sotto in VB.NET:
Public sCookie As String
SboGuiApi = New SAPbouiCOM.SboGuiApi
StringaConnessione = Environment.GetCommandLineArgs.GetValue(1)
SboGuiApi.Connect(StringaConnessione)
applic = SboGuiApi.GetApplication()
oCompany = New SAPbobsCOM.Company
sCookie = oCompany.GetContextCookie
sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)
If oCompany.Connected = True Then
oCompany.Disconnect()
End If
If Not oCompany.SetSboLoginContext(sConnectionContext) = 0 Then
SBO_Application.MessageBox("Impossibile stabilire una connessione")
End
End If
oCompany.UseTrusted = False
If Not oCompany.Connect = 0 Then
SBO_Application.MessageBox("Impossibile connettersi al database")
End
End If
Best Regards
Serema
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Visual studio.NET
XP professional
SAP Business one 2004 A (6.70.165) DEMO
this is my app code:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim WithEvents a As SAPbouiCOM.Application
Dim compagnia As New SAPbobsCOM.Company
Dim bp As SAPbobsCOM.BusinessPartners
Dim txtcardname As SAPbouiCOM.EditText
Dim frmUnico As SAPbouiCOM.Form
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim gui As New SAPbouiCOM.SboGuiApi
gui.Connect("0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056")
a = gui.GetApplication
compagnia.Password = a.Company.UserName
compagnia.UserName = a.Company.UserName
compagnia.Server = "rossini"
compagnia.CompanyDB = "ROGA2"
compagnia.Connect()
Dim path As String
Dim xmlD As New MSXML2.DOMDocument
path = System.Reflection.Assembly.GetExecutingAssembly.Location
path = path.Substring(0, path.LastIndexOf("bin")) & "form2.srf"
xmlD.load(path)
a.LoadBatchActions(xmlD.xml)
bp = compagnia.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(compagnia.Server) '------ (WORKS!!!!)----
bp.GetByKey("002")
a.MessageBox(bp.CardName) '------ (WORKS!!!!)----
MsgBox(bp.CardName) '------ (WORKS!!!!)----
End Sub
Private Sub a_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles a.ItemEvent
Select Case pVal.FormType
Case 134
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
End Select
Case 2000003000
Select Case pVal.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_LOAD
Dim d As New SAPbobsCOM.Company
frmUnico = a.Forms.Item(pVal.FormUID)
frmUnico.Title = "New form XML"
txtcardname = frmUnico.Items.Item("txtCN").Specific
Case SAPbouiCOM.BoEventTypes.et_CLICK
Select Case pVal.ItemUID
Case "cmdClic"
If pVal.Before_Action = True Then
a.MessageBox("called event on click chiamato") '------ (WORKS!!!!)----
a.MessageBox(compagnia.Server) '------ (*****NOT WORKS******)----
bp.GetByKey("002")
a.MessageBox(bp.CardName) '------ (*****NOT WORKS******)----
txtcardname.Value = bp.CardName '------ (*****NOT WORKS******)----
End If
End Select
End Select
End Select
End Sub
End Class
Could it be a limitation of SBO 2004 DEMO?
I think I can't manage DI objects from UI.
I'm wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.