on 10-13-2008 1:20 PM
Hi,
I have added a 'Define New' option in the combo and if the combo select is 'Define New' then the User defined Table Form which was created with 'No Object' was called and the entry was added in that form. All his operations perform well. But my problem is after adding the values in that form the values in the User defined table form are not loaded in the combo if i close the main form and open it then only its loading in the combo. My need is when i add the value in the User defined table form the value added should be loaded in the combo. How to get it plz give me the solution.
Thanks in Advance.
Regards,
Madhavi
Hi,
I guess u can reload the combobox using a recordset or try oForm.Refresh() and oForm.Update() so that the form and its datasources will get updated.
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vasu,
I tried in all that way but it work if i close and open the main form. The code follows which i have tried.
1.Reloaded the combo box :-
If (pVal.ItemUID = "CboWCType") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) Then
' Dim Frm As SAPbouiCOM.Form
If CboWCType.Selected.Value = "Define New" Then
SBO_Application.ActivateMenuItem("51205")
BubbleEvent = False
Try
Dim rs As SAPbobsCOM.Recordset
rs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery("select Code,Name from [@PSSIT_PMWCTYPE] where code is not null and Name is not Null")
' rs.DoQuery("select Code,U_desc from [@Sample]")
rs.MoveFirst()
If CboWCType.ValidValues.Count > 0 Then
For i As Int16 = CboWCType.ValidValues.Count - 1 To 0 Step -1
CboWCType.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index)
Next
End If
For i As Int16 = 0 To rs.RecordCount - 1
CboWCType.ValidValues.Add(rs.Fields.Item(1).Value, rs.Fields.Item(0).Value)
rs.MoveNext()
Next
CboWCType.ValidValues.Add("Define New", "")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
in the place of combo reload i tried Form.Refresh and Form. Update() but both are not working well. Plz tell me where i go wrong here.
Regards,
Madhavi
Hi..
try this one
If (pVal.ItemUID = "CboWCType") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) Then
' Dim Frm As SAPbouiCOM.Form
If CboWCType.Selected.Value = "Define New" Then
SBO_Application.ActivateMenuItem("51205")
BubbleEvent = False
Try
Dim rs As SAPbobsCOM.Recordset
rs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery("select Code,Name from @PSSIT_PMWCTYPE where code is not null and Name is not Null")
' rs.DoQuery("select Code,U_desc from @Sample")
rs.MoveFirst()
If CboWCType.ValidValues.Count > 0 Then
For i As Int16 = CboWCType.ValidValues.Count - 1 To 0 Step -1
CboWCType.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index)
Next
End If
Try
If RS.EoF = False Then
For i = 1 To RS.RecordCount
CboWCType.ValidValues.Add(RS.Fields.Item("0").Value, i,
rs.MoveNext()
Next
' CboWCType.ValidValues.Add("-9", "Define New")
End If
CboWCType.ValidValues.Add("-9", "Define New")
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Regards...
Billa 2007
Hi...
Normally i am doing i design new form(Define New) that form i give in put and Add. that one store in user defined table that table i retrieve the select query.
use this code menu event
LoadFromXmlshiftmain("Ur Main form.srf")
oForm = SBO_Application.Forms.Item("Ur Form-ID")
Try
ocombo = oForm.Items.Item("Ur-ID").Specific
RS = Nothing
RS = OCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RS.DoQuery("Select Ur table")
Try
If RS.EoF = False Then
For i = 1 To RS.RecordCount
ocombo.ValidValues.Add(RS.Fields.Item("Ur-Field").Value, i)
RS.MoveNext()
Next
'ocombo.ValidValues.Add("-9", "Define New")
End If
ocombo.ValidValues.Add("-9", "Define New")
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
************************
Private Sub LoadFromXmlshiftmain(ByVal fileName As String)
Dim XmlDoc As Xml.XmlDocument
Dim Xmlstr As String
XmlDoc = New Xml.XmlDocument
Dim SPath As String
Try
SPath = IO.Directory.GetParent(Application.StartupPath).ToString
XmlDoc.Load("C:\Program Files\SAP\SAP Business One\AddOns\Ur srf folder" & "\" & fileName)
SBO_Application.LoadBatchActions(XmlDoc.InnerXml)
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End Sub
******************************
Item Event
If pVal.FormUID = "xxx" And pVal.ItemUID = "yyy" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT Then
Try
ocombo = FormS.Items.Item("5").Specific
If ocombo.Selected.Value = "-9" Then
LoadFromXmlShift("Ur-definenew.srf")
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
Regards...
Billa 2007
Hi Vasu,
I reloaded the combo in the et_Form_Activate but still not working. Please tell me where i go wrong in the code. The Code follows:-
If (pVal.ItemUID = "CboWCType") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE) Then
Try
Dim rs As SAPbobsCOM.Recordset
rs = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
rs.DoQuery("select Code,Name from @PSSIT_PMWCTYPE where code is not null and Name is not Null")
rs.MoveFirst()
If CboWCType.ValidValues.Count > 0 Then
For i As Int16 = CboWCType.ValidValues.Count - 1 To 0 Step -1
CboWCType.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index)
Next
End If
For i As Int16 = 0 To rs.RecordCount - 1
CboWCType.ValidValues.Add(rs.Fields.Item(1).Value, rs.Fields.Item(0).Value)
rs.MoveNext()
Next
CboWCType.ValidValues.Add("Define New", "")
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End If
Madhavi
hi,
madhavi
try to reload combo after adding new one from define new using...
If pVal.FormUID = "DefineNew FormUID" And pVal.ActionSuccess = True And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.ItemUID = "1" And pVal.FormMode = 3 Then
Try
RS1 = Nothing
RS1 = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RS1.DoQuery("select U_DefineNew from [@Table] ")
Dim oCombo As SAPbouiCOM.ComboBox = oForm.Items.Item("ItemUID").Specific
For j = oCombo.ValidValues.Count - 1 To 0 Step -1
oCombo.ValidValues.Remove(j, SAPbouiCOM.BoSearchKey.psk_Index)
Next
For i = 1 To RS1.RecordCount
If RS1.EoF = False Then
oCombo.ValidValues.Add(RS1.Fields.Item("U_DefineNew").Value, i)
End If
RS1.MoveNext()
Next
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
End Try
End If
above code helps you
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.