从用户表单的列表中进行多项选择

Multiple Choose From Lists on User Form

我有一个自定义用户表单,其中包含一个有效的“从列表中选择”,它从业务合作伙伴列表中选择 CardName 并显示在编辑文本中。

是否可以将第二个从列表中选择添加到单独的编辑文本以从 OITM 项目主文件中选择Table?

只有当表单的 ObjectType 属性 设置为 2(业务合作伙伴)时,第一个 Clf 才有效,这是否表明不可能为另一个 table 使用第二个 cfl在表格上?

当我删除 属性 时,我收到此错误:

有什么解决办法吗?

问题是缺少 DBDataSources.Add("OITM")

对于表单上所需的每个“从列表中选择”,必须将相关的 SAP table 添加为 dbDatasource

添加多个来自不同对象类型的“从列表中选择”的完整代码:

 Dim oForm As SAPbouiCOM.Form = Application.SBO_Application.Forms.Item(Me.UIAPIRawForm.UniqueID)

        oForm.DataSources.UserDataSources.Add("udsBpName", SAPbouiCOM.BoDataType.dt_SHORT_TEXT)

        Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
        Dim oCons As SAPbouiCOM.Conditions
        Dim oCon As SAPbouiCOM.Condition
        Dim oCFL As SAPbouiCOM.ChooseFromList
        Dim oCFLCreationParams As SAPbouiCOM.ChooseFromListCreationParams
        oCFLCreationParams = CType(Application.SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams), SAPbouiCOM.ChooseFromListCreationParams)
        oCFLCreationParams.MultiSelection = False
        oCFLCreationParams.ObjectType = "2"
        oCFLCreationParams.UniqueID = "CFL_Name"
        oCFL = oCFLs.Add(oCFLCreationParams)
        oCons = oCFL.GetConditions()
        oCon = oCons.Add()
        oCon.Alias = "CardType"
        oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
        oCon.CondVal = "C"
        oCFL.SetConditions(oCons)

        etBpName.DataBind.SetBound(True, "OCRD", "CardName")
        etBpName.ChooseFromListUID = "CFL_Name"
        etBpName.ChooseFromListAlias = "CardName"


        ' This Item Master dbDatasource Needs to be added to the form 
        ' Before the Cfl with matching object type (in this case 4) is added 
        oForm.DataSources.DBDataSources.Add("OITM")

        Dim oCFLs2 As SAPbouiCOM.ChooseFromListCollection = oForm.ChooseFromLists
        Dim oCons2 As SAPbouiCOM.Conditions
        Dim oCon2 As SAPbouiCOM.Condition
        Dim oCFL2 As SAPbouiCOM.ChooseFromList
        Dim oCFLCreationParams2 As SAPbouiCOM.ChooseFromListCreationParams
        oCFLCreationParams2 = CType(Application.SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams), SAPbouiCOM.ChooseFromListCreationParams)
        oCFLCreationParams2.MultiSelection = False
        oCFLCreationParams2.ObjectType = "4"
        oCFLCreationParams2.UniqueID = "CFL1"
        oCFL2 = oCFLs2.Add(oCFLCreationParams2)
        oCons2 = oCFL2.GetConditions()
        oCon2 = oCons2.Add()
        oCon2.Alias = "Validfor"
        oCon2.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
        oCon2.CondVal = "Y"
        oCFL2.SetConditions(oCons2)

        EditText0.DataBind.SetBound(True, "OITM", "ItemCode")
        EditText0.ChooseFromListUID = "CFL1"
        EditText0.ChooseFromListAlias = "ItemCode"