Skip to Content
0

Add and Update using the same button c# UI API

Nov 07, 2017 at 09:45 AM

77

avatar image
Former Member

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
DIEGO LOTHER Nov 07, 2017 at 11:28 AM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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"

errorform.png (52.3 kB)
0

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

1
Former Member

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. :)

0