I want to grey out a field "REQUIREMENT QUANTITY" in an enhancement of COR1 and COR2. I have made a Z-table so that the IDs maintained in that Z-Table should not be able to make any changes and the field should be greyed out for those particular IDs. Please guide.
Thank you.
I wrote the following code. Please check if this works for the above condition:
IF sy-tcode EQ 'COR1' or sy-tcode EQ 'COR2'.
SELECT SINGLE *
FROM zita_pp_cor1
INTO @DATA(wa_zita)
WHERE z_user = @sy-uname.
ENDIF.
IF wa_zita IS NOT INITIAL.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'BDMNG'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Theoretically, clearing INPUT will make the input field grey, so that shouldn't be a problem. Check in Debug mode to see if you can get to that point and pass 0.
I think the problem will be that you are using the AT SELECTION-SCREEN OUTPUT section in the wrong place. Since SELECT is not part of this section either, it will contain empty values.
This is how I would modify your code:
Make sure the screen name is correct. I use the group to define the exact fields on the select screen.