Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Problen in ChooseFromList & User Defined Object

Hello.

I'm trying to use a [ChooseFromList] that calls info from one User Table called @LABS this table is MasterData type.

I add a User Defined Object in runtime, called UO_Labs

Then, I add one ChooseFromList to my form (This form was made in ScreenPainter)

The user object was created fine, the ChooseFromList is added fine, the form loads fine, but, when I press tab or the button of the ChooseFromList I get this error: "Internal error (-1003) ocurred [Message 131-183]"

I try to use my ChooseFromList in one Matrix and in one EditText objects. And gives me the same error in both objects.

I'm using SAP 2007 PL 35

This is my code:

-


Adding the User Defined Object -


Dim UO As SAPbobsCOM.UserObjectsMD
UO = CompanyObj.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)

UO.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO
UO.CanCancel = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanClose = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanDelete = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanFind = SAPbobsCOM.BoYesNoEnum.tYES
UO.CanLog = SAPbobsCOM.BoYesNoEnum.tNO
UO.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tNO

UO.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tYES
UO.Code = "UO_Labs"
UO.Name = "Laboratory Info."
UO.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
UO.TableName = "LABS"

If UO.FormColumns.Count = 0 Then UO.FormColumns.Add()
UO.FormColumns.SonNumber = 0
UO.FormColumns.FormColumnAlias = "Code"
UO.FormColumns.FormColumnDescription = "Code"
UO.FormColumns.Add()
UO.FormColumns.SonNumber = 0
UO.FormColumns.FormColumnAlias = "Name"
UO.FormColumns.FormColumnDescription = "Name"

If UO.Add() <> 0 Then
      Application.MessageBox(CompanyObj.GetLastErrorDescription)
End If

-


END Adding the User Defined Object -


This code adds my UDO and it works fine, has data and do the work.

-


Adding the [ChooseFromList] Object -


'// form object is send in parameters.

Dim oCFLs As SAPbouiCOM.ChooseFromListCollection = f.ChooseFromLists
Dim oCFL As SAPbouiCOM.ChooseFromList
Dim oCFL_CP As SAPbouiCOM.ChooseFromListCreationParams

Dim matrix As SAPbouiCOM.Matrix = form.Items.Item("matrix").Specific

oCFL_CP = App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)

oCFL_CP.MultiSelection = False
oCFL_CP.ObjectType = "UO_Labs"
oCFL_CP.UniqueID = "cfl_Labs"

oCFL = oCFLs.Add(oCFL_CP)

matrix.Columns.Item("labCode").ChooseFromListUID = "cfl_Labs"
matris.Columns.Item("labCode").ChooseFromListAlias = "Code"

form.Refresh()

-


END Adding the [ChooseFromList] Object -


Thanks for your time...

Greetings

Gabriel Vasquez.

Former Member replied

Hi Gabriel,

Please check in B1 if the UDO is created correctly, specifically the CanFind option. I got that error once, with one of my addons, that somehow was created with CanFind=tNo, despite my code indication CanFind=tYes...

Also, try adding the CFL directly in the XML form.

   <column uid="C_labCod" type="116" title="Lab. Code" description="Laboratory Code" visible="1" AffectsFormMode="1" width="70" disp_desc="1" editable="1" right_just="0" val_on="Y" val_off="N" backcolor="-1" forecolor="-1" text_style="0" font_size="-1" ChooseFromListUID="cfl_Labs" ChooseFromListAlias="Code">
      <databind databound="1" table="@LABS" alias="U_labCode"></databind>
      <ExtendedObject linkedObject="" LinkedObjectType=""></ExtendedObject>
   </column>
...
...
   <ChooseFromListCollection>
      <action type="add">
         <ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"></ChooseFromList>
         <ChooseFromList UniqueID="cfl_Labs" ObjectType="UO_Labs" MultiSelection="0" IsSystem="0"></ChooseFromList>
      </action>
   </ChooseFromListCollection>

Also, it's a good practice to your SAP partner's NameSpace as prefix to UDOs, UDTs, UDFs and UDKeys, in order to avoid conflicts with other partner's add-ons.

Regards,

VĂ­tor Vieira

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question