on 09-24-2008 9:32 AM
Hi ,
in my addon SRF Form i have two Edit text box(item Group, Item)
with respect to item group(CFL) selection , i will change the CFL condition of item selection CFL. dyanmically.
first time its working fine. second time item CFL is Empty.
tihs is my sample code:
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
If pVal.ItemUID = "item edit txt" And pVal.FormUID.StartsWith("FormUid") Then
Dim val As String = oForm.Items.Item("GrpEditid").Specific.value
Dim RsGrp As SAPbobsCOM.Recordset = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RsGrp.DoQuery("Select ItmsGrpCod From .[OITB] ItmsGrpNam = '" & val & "'")
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
oCFL = oCFLs.Item("CFL_3")
oCons = oForm.ChooseFromLists.Item("CFL_3").GetConditions
' oCons = oCFL.GetConditions()
oCon = oCons.Add()
oCon.Alias = "ItmsGrpCod"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = Integer.Parse(RsGrp.Fields.Item(0).Value)
oForm.ChooseFromLists.Item("CFL_3").SetConditions(oCons)
End if
am getting oCon.CondVal correctly every time..
But CFL is empty..
Any Suggestion??
regards,
Ganesh k
I can suggest you this:
- Use breackpoints to see oCon.CondVal.
- Try to set conditions to nothing.
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
If pVal.ItemUID = "item edit txt" And pVal.FormUID.StartsWith("FormUid") Then
Dim val As String = oForm.Items.Item("GrpEditid").Specific.value
Dim RsGrp As SAPbobsCOM.Recordset = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
RsGrp.DoQuery("Select ItmsGrpCod From .OITB ItmsGrpNam = '" & val & "'")
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
oCFL = oCFLs.Item("CFL_3")
'
' +++++++++++++++++++++++++++++++++++++++++++++
oCFL.SetConditions(Nothing)
' +++++++++++++++++++++++++++++++++++++++++++++
'
oCons = oForm.ChooseFromLists.Item("CFL_3").GetConditions
' oCons = oCFL.GetConditions()
oCon = oCons.Add()
oCon.Alias = "ItmsGrpCod"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = Integer.Parse(RsGrp.Fields.Item(0).Value)
oForm.ChooseFromLists.Item("CFL_3").SetConditions(oCons)
End if
End if
An working example.
Here I update CFL conditions in base on combobox choise.
Private Sub CFL_UpdateConditions(ByRef oForm As SAPbouiCOM.Form)
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
Dim oCons As SAPbouiCOM.Conditions
Dim oCon As SAPbouiCOM.Condition
Dim oCombo As SAPbouiCOM.ComboBox
Dim sType As String = ""
Try
oCombo = oForm.Items.Item("eType").Specific
If Not oCombo.Selected.Value Is Nothing Then
sType = oCombo.Selected.Value
End If
Catch ex As Exception
' log exception
End Try
Try
oCFLs = oForm.ChooseFromLists
For Each oCFL As SAPbouiCOM.ChooseFromList In oCFLs
If oCFL.UniqueID.Equals("1") Or oCFL.UniqueID.Equals("0") Then
' +++++
oCFL.SetConditions(Nothing)
' +++++
' Adding Conditions to CFL1
oCons = oCFL.GetConditions()
' Condition 1: CardType = "C"
oCon = oCons.Add()
oCon.Alias = "CardType"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "S"
' ... AND ...
oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
' Condition 2: U_Type IS NULL or EQUAL to sType
oCon = oCons.Add
oCon.Alias = "U_Type"
'oCon.Operation = SAPbouiCOM.BoConditionOperation.co_IS_NULL
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = sType.Trim
' Set conditions for CFL
oCFL.SetConditions(oCons)
End If
Next
Catch ex As Exception
' log exception
Finally
oCon = Nothing
oCons = Nothing
oCFLs = Nothing
End Try
End Sub
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 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.