cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a choose list with UDF

Former Member
0 Kudos
350

Hi,

I want add a choose list in matrix

this choose list is a sql

"SELECT Code,Name FROM ""@SIR_COMPOSANT"" ORDER BY Name" for example

my code is



            Dim oCFLs As SAPbouiCOM.ChooseFromListCollection
            Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
            Dim oCFL As SAPbouiCOM.ChooseFromList

            oCFLs = oform.ChooseFromLists

            oCFLCreationParams = SBO_application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
            oCFLCreationParams.MultiSelection = False
            oCFLCreationParams.ObjectType = "????????"
            oCFLCreationParams.UniqueID = "CFL1"

            oCFL = oCFLs.Add(oCFLCreationParams)

            oform.Items.Item("4").Specific.ChooseFromListUID = "CFL1"

            Dim oEditText As SAPbouiCOM.EditText = oform.Items.Item("4").Specific
            oEditText.ChooseFromListUID = "CFL1"
            oEditText.ChooseFromListAlias = "????????" 

Can you help me please

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello

If your User Defined table is defined as UDO, you can do it. OtherWise not possible

IN your code you can use this:

oCFLCreationParams.ObjectType = "UDO_REGISTERED_NAME"

Regards

J

Former Member
0 Kudos

Hi janos,

thank you for your reply but how to code my order sql ?

Didier

Former Member
0 Kudos

didier,

You do not need the order. On any ChooseFromList, when you open the list itself, you can press the form settings button, and define the default fields and sorting criterias.

Example

Open Sales Orders

press tab on BP Field - this opens CFL of BP

Press Form Settings icon on toolbar

Set up the correct fields order and soring values

Click ok

You can do the same for your UDO based CFL (when you register UDO, you can define searcable filelds and list of the fields, and positions can be defined there!)

FYI:

Also DI Object SAPbobsCOM.ChooseFromList can be used for defining CFL columns and sort orders, but this is done during UDO registration

Regards

J

Former Member
0 Kudos

Janos

I use this code


oCFLCreationParams.ObjectType = "UDO_REGISTERED_NAME"

But i have a message " ChooseFromList - Invalid object type. [66000-107] "

on this code


 oCFL = oCFLs.Add(oCFLCreationParams)

Former Member
0 Kudos

Didier,

Did you registered your table as UDO (User Defined Object)? If yes, replace the UDO_REGISTERED_NAME with the technical name you give your UDO at registration.

Regards

J

Former Member
0 Kudos

Janos

Thank You very much !!!!!!!!!

Answers (1)

Answers (1)

Former Member
0 Kudos

Try this code....!!

objForm = objMain.objUtilities.GetForm(formuid)

Dim oCFLs As SAPbouiCOM.ChooseFromListCollection

Dim oCons As SAPbouiCOM.Conditions

Dim oCon As SAPbouiCOM.Condition

oCFLs = objForm.ChooseFromLists

Dim oCFL As SAPbouiCOM.ChooseFromList

Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams

oCFLCreationParams = objMain.objApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)

'Adding Conditions To Items

oCFLCreationParams.MultiSelection = False

oCFLCreationParams.ObjectType = "4"

oCFLCreationParams.UniqueID = "OCFL2"

oCFLCreationParams.MultiSelection = True

oCFL = oCFLs.Add(oCFLCreationParams)

'' Adding Conditions to CFL1

oCons = oCFL.GetConditions()

oCon = oCons.Add()

oCon.Alias = "InvntItem"

oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL

oCon.CondVal = "Y"

If Not oCons Is Nothing Then oCFL.SetConditions(oCons)

Former Member
0 Kudos

kirankv2009

this is a CFL for Items (object type 4), not for user defined tables, fields.

Regards

J