Skip to Content
0

Event hander, getting caller Form

Nov 14, 2016 at 01:01 PM

52

avatar image

I am trying to add some extra validation (using DI api) to certain System Forms with C# API and SAP 9.2.

I subscribed to the `Application.FormDataEvent` so I can catch any data modification on the desired form which I checked with

if (BusinessObjectInfo.BeforeAction == true && BusinessObjectInfo.Type == ObjectTypes.OBJECT_SALESQUATATION)

So far I had no problems, but getting the Form object now is a problem, because there is only the ActiveForm reference I could use, but that could get changed.

So I call it like this:

Form oForm = SBOApp.Forms.ActiveForm;

And If the calling form had a popup after the submit (like a warning where you can continue If you press Yes), the ActiveForm is changed to the pop's form object, not the System Form I would like to read data from. Also, I cannot get the form with `Application..Forms.GetForm()`, because I have no idea about the count.

Even If I subscribe to the submit button on the System Form directly, it will be still interrupted by the popup confirmation form and change the ActiveForm, leaving me hanging without a calling form reference.

How can I solve this?

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

2 Answers

Best Answer
DIEGO LOTHER Nov 14, 2016 at 01:11 PM
0

Hi Szabolcs,

Use this, to get your form:

Form oForm = SBOApp.Forms.Item(BusinessObjectInfo.FormUID);

Kind Regards,

Diego Lother

Share
10 |10000 characters needed characters left characters exceeded
Szabolcs Kelemen Nov 14, 2016 at 01:08 PM
0

Okay, so I just realized the event handler's BusinessObjectInfo has a FormUID like this:

BusinessObjectInfo.FormUID

So I can create a form with

Form oForm = SBOApp.Forms.Item(BusinessObjectInfo.FormUID);

Am I right?

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hi Szabolcs,

Yes, you are right.

Kind Regards,

Diego Lother

0