Skip to Content
author's profile photo Former Member
Former Member

Default value

Hello experts, I'm struggling with this error. Every time I run my program my combobox value is always NULL and my screen painter will freeze and you need to exit SAP to use it again. Please check my code.

Sub AddItemCodeCombo()

        Dim oCompany As SAPbobsCOM.Company = SBO_Application.Company.GetDICompany
        Dim RS As SAPbobsCOM.Recordset
        Dim oCombo As SAPbouiCOM.ComboBox = oForm.Items.Item("cFrom").Specific

           If oCombo.ValidValues.Count > 0 Then
                For i As Integer = 0 To oCombo.ValidValues.Count - 1
                    oCombo.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index)
            End If

            RS = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
            RS.DoQuery("SELECT dbName, cmpName FROM [SBO-COMMON].dbo.SRGC")

            'If RS.RecordCount > 0 Then

            Do While Not RS.EoF

                oCombo.ValidValues.Add(RS.Fields.Item(0).Value.ToString, RS.Fields.Item(1).Value.ToString)


            'End If
            oCombo.Select(0, SAPbouiCOM.BoSearchKey.psk_Index)

        Catch ex As Exception



            RS = Nothing

        End Try

    End Sub

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Dec 13, 2011 at 06:24 AM


    you know the output so simply define this

    Sample Code

    oComboBox.Select("INR", SAPbouiCOM.BoSearchKey.psk_ByValue)

    thanks & regards

    B.lakshmi narayanan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.