Skip to Content

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

Get the selected item from a combo box

Hi, everybody

I have created a grid in a folder.

One column of the grid is called TransferTo. I made this column into a column of combo boxes.

The combo box works well, but when I select an item, it does not go into the TransferTo field on the grid.

Please help me write the correct code.

How to bind?


Leon Lai


My relevant code is as below:




        oGrid.Columns.Item("TransferTo").Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox

        Dim oCombo As SAPbouiCOM.ComboBoxColumn

        oCombo = oGrid.Columns.Item("TransferTo")

        Dim oRecordSet As SAPbobsCOM.Recordset

        Dim StrQuery As String

        oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

        StrQuery = "Select T0.CardCode,T0.CardName FROM OCRD T0 ORDER BY T0.CardCode  "



        While Not oRecordSet.EoF

            oCombo.ValidValues.Add(oRecordSet.Fields.Item("CardCode").Value.ToString, oRecordSet.Fields.Item("CardName").Value.ToString)


        End While


Hi Leon,

When you populate a grid from a query the column character size is taken from the largest value.

Since you have '' as [TransferTo] your length for that column will be 1 I believe.

Try changing to CAST('' AS NVARCHAR(254)) this will get you 254 characters length and the combobox should start working.

Best regards,

Pedro Magueija

View Pedro Magueija's profile on LinkedIn

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