Ruzna Rizvi
Ruzna Rizvi

Reputation: 47

How to disable a button inside a screen

I have a requirement where I should disable the conditions tab's delete row to avoid user from deleting the condition in VA22. I've tried almost all the buttons available while debugging USEREXIT_FIELD_MODIFICATION in Include LV69AFZZ.

enter image description here

Is anyone able to help me with this?

Thanks.

Upvotes: 0

Views: 507

Answers (1)

Sandra Rossi
Sandra Rossi

Reputation: 13656

First of all, you must determine the screen where the field is located.

  • /H and Enter twice to start the debugger
  • Replace tool > Special tools > Screen analysis
  • Deduce which screen can hold the button or try all screens
  • Click "Navigate to source code" to display the screen data
  • Press "Screen layout" to confirm it's the screen you're looking for
  • Press "Attribute" on a button to know its screen field name

Then you must find a position in the ABAP code which runs during the execution of the screen modules of "PROCESS BEFORE OUTPUT" where you can add this code:

LOOP AT SCREEN INTO DATA(ls_screen).
  IF ls_screen-name = 'screen field name of the button, in upper case'.
    ls_screen-input = '0'.  " gray out
    ls_screen-active = '0'. " hide
    MODIFY SCREEN FROM ls_screen.
  ENDIF.
ENDLOOP.

If the screen is in the standard code and there's no dedicated user exit, you may use the Enhancement Framework to add code at the beginning or at the end of any subroutine, method, function module (but NOT screen modules for instance).


NB: another solution is to use Transaction and Screen Variants, but this tool is usually less preferred because it's more difficult to configure (like defining conditions).

Upvotes: 0

Related Questions