Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.


Former Member
Former Member replied

I was revising the code, and there are two major changes.

  1. I cached the results of the calculations mentioned above for each form type (139, 142), for each form instance and for each record displayed in that form instance. If the current record was processed before, the results of the calculations are taken from that structure in memory. If the record was processed before and is now being edited, I remove that from the cache, forcing the calculation again. I don't think that is the reason why it is working now, but could help.
  2. I initially caught the events for Form Items (SBO_Application_ItemEvent), in where the 'resize' event was processed. It looks like it wasn't enough. This is why I added an extra handler for Form Data Event (SBO_Application_FormDataEvent). That new handler also calls the function to show/hide buttons.

I think that 2) was the one that made the difference.

Hope that helps.


1 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question