on 10-06-2008 7:10 AM
How to change condition in Choose from the list and pass more than 1 condition
Edited by: Pavana Punja on Oct 6, 2008 8:10 AM
Hi Pavana,
try this Following steps,
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
If pVal.ItemUID = "CFL edittxt Uid"
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
oCFL = oCFLs.Item("CFLid")
oCFL.SetConditions(Nothing)
oCons = oForm.ChooseFromLists.Item("CFLid").GetConditions
oCon = oCons.Add()
oCon.Alias = "AliasName"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
oCon.CondVal = "Conditionvalue"
'//setting multiple conditions
oCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
oCon = oCons.Add()
oCon.Alias = "AliasName"
oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL
oCon.CondVal = "Conditionvalue"
oForm.ChooseFromLists.Item("CFLid").SetConditions(oCons)
'//
you can set your needed logical operation in oCon.Relationship(And,Or) and oCon.Operation(equal,not equal,less than etc)
you can repeat the same for multiple conditions.. if your conditions change in run time means save it an array or in variables and pass that values through loop also.
Regards,
Ganesh k
Endif
End if
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
See description in code.
Also nice examples you can found in SAP SDK Help.
Hope this code help you.
Regards
Sierdna S
Adding Conditions To CFL using VB code...
Private Sub AddChooseFromList()
Try
Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
Dim oConds As SAPbouiCOM.Conditions
Dim oCon As SAPbouiCOM.Condition
oCFLs = oForm.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
oCFLCreationParams = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
' Adding 2 CFL, one for the button and one for the edit text.
oCFLCreationParams.MultiSelection = False
oCFLCreationParams.ObjectType = "2"
oCFLCreationParams.UniqueID = "CFL1"
oCFL = oCFLs.Add(oCFLCreationParams)
' Adding Conditions to CFL1
' +++++++++++++++++++++++++++++++
oConds = oCFL.GetConditions()
' +++++++++++++++++++++++++++++++++++
' Here we need to add this condition:
' CardType = 'C' AND CardCode BETWEEN 21 AND 40
'
' +++++++++++++++++++++++++++++++++++
' add 1-st condition: CardType = 'C'
' +++++++++++++++++++++++++++++++++++
oCon = oConds.Add()
oCon.Alias = "CardType"
oCon.Operation = co_EQUAL
oCon.CondVal = "C"
' Here we add AND
' +++++++++++++++++++++++++++++++
oCond.Relationship = co_AND
' Add 2-nd condition
' +++++++++++++++++++++++++++++++
oCond = oConds.Add
oCond.Alias = "CardCode"
oCond.Operation = co_BETWEEN
oCond.CondVal = 21
oCond.CondEndVal = 40
oCFL.SetConditions(oConds)
oCFLCreationParams.UniqueID = "CFL2"
oCFL = oCFLs.Add(oCFLCreationParams)
Catch
MsgBox(Err.Description)
End Try
End Sub
Adding CFL conditions using XML (my prefered)
<ChooseFromListCollection>
<action type="add">
<ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1" />
<!-- From ItemCode 1 ++++++++++++++++ -->
<ChooseFromList UniqueID="1" ObjectType="4" MultiSelection="0" IsSystem="1" />
<!-- To ItemCode 2 -->
<ChooseFromList UniqueID="3" ObjectType="4" MultiSelection="0" IsSystem="1" />
<!-- From Card Code 1 -->
<ChooseFromList UniqueID="5" ObjectType="2" MultiSelection="0" IsSystem="1">
<Conditions>
<condition bracket_open_num="0"
bracket_close_num="0" cond_end_val="" cond_value="S"
operation="1" relationship="0" compare_fields="0" alias="CardType"
compared_field_alias="" />
</Conditions>
</ChooseFromList>
<!-- To Card Code 1 -->
<ChooseFromList UniqueID="7" ObjectType="2" MultiSelection="0" IsSystem="1">
<Conditions>
<condition bracket_open_num="0"
bracket_close_num="0" cond_end_val="" cond_value="S"
operation="1" relationship="0" compare_fields="0" alias="CardType"
compared_field_alias="" />
</Conditions>
</ChooseFromList>
</action>
</ChooseFromListCollection>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
OCPack.MultiSelection = False
OCPack.UniqueID = "xxxxx"
OCPack.ObjectType = "4"
OCFL = OCFLS.Add(OCPack)
OConds = OCFL.GetConditions
OCond = OConds.Add
OCond.Alias = "abc"
OCond.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
OCond.CondVal = "z"
OCond.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND
OCond = OConds.Add
OCond.Alias = "xyz"
OCond.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
OCond.CondVal = "c"
OCFL.SetConditions(OConds)
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 |
---|---|
86 | |
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.