cancel
Showing results for 
Search instead for 
Did you mean: 

Add and Update using the same button c# UI API

Former Member
0 Kudos
641

Hi Experts, I would like to use the same button to add, update and search.

I already put hte unique id in 1.
sample code or references. Will appreciate your hel

Accepted Solutions (1)

Accepted Solutions (1)

former_member185682
Active Contributor
0 Kudos

Hi Esteban,

When you receive a click on button 1, you can check what mode your form are, and then perform your action.

                    SAPbouiCOM.Form oForm = SBO_Application.Forms.ActiveForm;
                    switch(oForm.Mode)
                    {
                        case SAPbouiCOM.BoFormMode.fm_ADD_MODE:


                            break;
                        case SAPbouiCOM.BoFormMode.fm_UPDATE_MODE:


                            break;
                        case SAPbouiCOM.BoFormMode.fm_FIND_MODE:


                            break;
                    }

If you are using a UDO in your own user form, just add your UDO code on ObjectType property of your form, and SAP will handle this situations for you.

Hope it helps.

Kind Regards,

Diego Lother

Former Member
0 Kudos

thank you for your reply, it's realy useful :), But i got an error errorform.png, a null error, what could it be? thank you"

former_member185682
Active Contributor

Hi Esteban,

In this situation, your oApp could be null. Are you sure that you initialized it? If oApp is not null, maybe the problem could be on ActiveForm property, then try to change for this:

SAPbouiCOM.Form oForm = SBO_Application.Forms.Item(pVal.FormUID);

Hope it helps.

Kind Regards,

Diego Lother

Former Member
0 Kudos

yep, thank you,now it is working ...this is what I have been looking for you have no idea how much you've sorted me out. 🙂

Answers (0)