Weird question isn’t it ? The main purpose of this article is not to discuss about Web Dynpro ABAP but just to show you how to use NOT pattern in your context binding 🙂
Let me show you with an example: when you use boolean attributes, often we want to have the opposite value depending on how you think : isActivated or isDisable ?
The easiest way to do this NOT operation is using the wizard when you bind context attribute to graphical element property. On the bottom of the wizard you will appear an option called : INVERT. Select it and that’s it !
Thus, each TRUE value will be FALSE for the property element, and each FALSE will be TRUE for that element.
Now, how to do the same thing but in dynamic context, such as in ALV element?
The key of the problem is: “:NOT“
Here is an easy example in ALV context to add button and bind the enabled property to the context and invert the value.
CREATE OBJECT lo_button. lo_button->set_enabled_fieldname( 'ALV_MD__SAVED_ACTION:NOT' ).
It is easy to use the NOT operator in the context binding so do not hesitate to use it. I would like to thanks a friend of my Guillaume G. who ask me the question and bring me the ALV example.