It would be straightforward to use actions to select A, B and blank when leaving the tab, and clear selections in that field when entering the tab. However, I'm guessing you still want the users to be able to select values in that field and not have them cleared when switching tabs. One answer is to build something like this:
LOAD * INLINE [
When switching out of the special tab, select 'Y' and lock ExcludeO. When switching to the special tab, unlock ExcludeO and clear it. The users should still be able to make selections in S_flag. It will clear the S_flag, though, if the only selected value is O, and you go to a tab that excludes O. But if you've selected A and O, for instance, the O selection would still be preserved, waiting for you when you went back to that tab.
You wouldn't actually display the ExcludeO field anywhere, but I did in the attached example so that you can better see what's going on.
I'm doing it all automatically rather than using a button, but if you want a button, that's simple enough. Instead of executing the action when activating the special tab, execute the action when they press a button on the special tab. Then, until they pressed the button, O would still be excluded, even on the special tab.
Oops. I was wrong. If you select only O on the tab that allows it, then switch tabs, it fails to exclude it. I guess the selection search string isn't quite the same as saying "select this value", but is just "select this value, but only if it isn't excluded". I modified my example to use a macro instead for additional control, and selected the mode that should have included excluded values in the search, but it still didn't work. I'm not sure if that's a bug or if I'm just confused. Anyway, here's the example that I expected would fix the problem, but didn't. Maybe someone else can see how to fix it.