Skip to Content

proper way to add to a system form a combobox with values from user defined table

hello all,

i'm facing some difficulties in adding a combobox to a system form.

i've created a user defined table called @TABLENAME with only CODE and NAME fields

i'm trying to add to ITEMS form ( 150 ) a combobox showing values stored in @TABLENAME.

combobox selected value has to be bound to a user defined field (U_USERDEFINEDFIELD ) created in table OITM.

i've succesfully added a combobox to OITG form ( 63 ) showing values from OITB table and putting selected value in a user defined field OITG.U_CUSTOMFIELD.

so the issue is about using system tables vs user defined tables as source for valid values.

my custom combo box is added to an existing panel, here is my code

          string cmbId = "cmb";
          tmpItem = form.Items.Add(cmbId, SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX);
          tmpItem.FromPane = 0;
          tmpItem.ToPane = 0;
          tmpItem.Left = 212;
          tmpItem.Top = 200;
          tmpItem.Width = 200;
          tmpItem.Height = 19;
          SAPbouiCOM.ComboBox cmb = (SAPbouiCOM.ComboBox)tmpItem.Specific;
          tmpItem.DisplayDesc = true;
          tmpItem.Enabled = true;
          tmpItem.AffectsFormMode = true;
          cmb.DataBind.SetBound(true, "@TABLENAME", "U_USERDEFINEDFIELD");
          cmb.ExpandType = SAPbouiCOM.BoExpandType.et_ValueDescription;

i face "table not found [131-183]" error.

if i bind my combobox to OITM.U_USERDEFINEDFIELD and fill the valid values with a query everything works. eg.

cmb.DataBind.SetBound(true, "OITM", "U_USERDEFINEDFIELD");
        cmb.LoadValidValues(" SELECT CODE, NAME FROM [@TABLENAME]");
        cmb.ExpandType = SAPbouiCOM.BoExpandType.et_ValueDescription;


i'm puzzled. what is the OFFICIAL and PROPER way to add to a system form a combobox with values from user defined table?

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 09, 2015 at 10:17 AM

    Hi Christian,

    I think this is quite good for me, If I would have a requirement like this, I will happy to do the same.

    Best Regards,
    J S L Geeganage

    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.