Skip to Content
avatar image
Former Member

Disable Button in System Form

Dear SAP experts,

I have a rather interesting problem disabling a button from a system form.

I am trying to disable the 'Copy To' button from marketing documents (ID = "10000329");

I disable it using the following instruction:

oForm.Items.Item("10000329").Enabled = false;

It seems to work and in fact the button is grayed out as expected.

However, when I resize the form, the button becomes enabled by itself, even though I didn't change it. The problem also appears when I set it to Visible = false, and also when I set those two properties at the same time.

Surprisingly enough, other buttons don't show this behavior, for example the 'Add' Button (ID = "1").

Does anyone know why? How can I prevent this to happen?

I also tried to change the position of the button outside the form using negative coordinates (so it won't be visible), but it is fairly difficult to locate it in the original coordinates to make it visible again because after resizing, the system refuses to put it back in its place.

Best regards and thanks in advance.

N

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 28, 2015 at 08:53 AM

    Hi Nicolas,

    In systems forms that is tricky. B1 client will "reset" items status based on it's internal logic (admittedly I have no idea what that is).

    One way which is common to achieve the blocking of a button is to simply catch the pressing event and check there if the button can execute its operation. If not, set the bubbleEvent to false and SAP will not process the event.

    Also note that when you're status depends only on the mode of the form you can use the AutoManagedAttribute method to manipulate the items status, but this does not seem to be your case.

    Good luck.


    Best regards,

    Pedro Magueija


    View Pedro Magueija's profile on LinkedIn

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 27, 2015 at 12:48 AM

    Hi,

         You can capture the form resize by:

    SAPbouiCOM.BoEventTypes.et_FORM_RESIZE

    '" Put your

    1. oForm.Items.Item("10000329").Enabled = false; 

    Regards,

    Bry

    Blog: http://www.sap-tips-tricks.com/

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Bryan,

      There are a couple of issues with that solution.

      The first one is that the visibility of that button depends on certain calculations that may be computationally expensive. Ideally I should avoid to perform those calculations as much as I can.

      The second issue is that the visibility of the button is reset after processing the resize event. In other words, the button is still invisible when the logic in that event finishes, but it becomes visible again when the event bubbles up.

      Many thanks for your contribution anyway.

      Best regards.

      Nicolas.

  • avatar image
    Former Member
    Oct 28, 2015 at 12:51 PM

    I think This is not possible.

    Add comment
    10|10000 characters needed characters exceeded