Skip to Content

Event hander, getting caller Form

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 14, 2016 at 01:11 PM

    Hi Szabolcs,

    Use this, to get your form:

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

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 14, 2016 at 01:08 PM

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


    So I can create a form with

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

    Am I right?

    Add comment
    10|10000 characters needed characters exceeded