Skip to Content

How to set if condition based on combobox value in SAP B1 SDK?

Hi all,

I write codes of to hide field (UDF) on Activity form in SAP B1, but I want to set condition based on value of Activity field, for example When I select in combobox Task then that UDF shows if I select Phone Call then UDF hides.

The following is my code

Dim oform As SAPbouiCOM.Form = SBO_Application.Forms.Item(FormUID) 

oform.Items.Item("U_ModTrav").Visible = False
oform.Items.Item("1000001").Visible = False

How can I set this condition in SAP B1 SDK?

Please anyone can help me

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 02 at 01:50 PM

    Hi Rurangwa Schadrack,

    1. Use the Event et_COMBO_SELECT for 'Activity' ComboBox on Activity Form.

    2. Get the value which is selected by the User.

    3. Enable/Disable the fields as per the value selected in the ComboBox.

    This can be done something like this: (Please make the necessary amendments as per your needs.)

    case BoEventTypes.et_COMBO_SELECT:
    {
        if (pVal.ItemUID == "67" && pVal.FormType == 651)
        {
            SAPbouiCOM.ComboBox oComboActivity = (SAPbouiCOM.ComboBox)this.m_SBO_Form.Items.Item("67").Specific;
            string SelectedValue = oComboActivity.Selected.Value.Trim();
    
    
            if (SelectedValue == "Task")
            {
                //Do your process.
            }
    
    
            else if (SelectedValue == "Phone")
            {
                //Do your process.
            }
        }
    
    
    }break;
    

    Hope it helps!

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded