Disable a parameter input at selection screen

家住魔仙堡 提交于 2020-06-23 06:53:08

问题


I have screen filter at selection screen like this

SELECTION-SCREEN BEGIN OF BLOCK a WITH FRAME.
PARAMETERS s_werks like resb-werks DEFAULT 'X' .

SELECT-OPTIONS: s_aufnr FOR in_param-aufnr,
                s_matnr FOR in_param-matnr,
                s_bldat FOR in_param-bldat.
SELECTION-SCREEN END OF BLOCK a.

and I want to disable just s_werks parameter but SELECT-OPTIONS.

I want to disable it because it'll be exact value which is filled from table depends on the sy-uname :)

How to achieve that?


回答1:


You can use the OUTPUT selection screen event for this. Add the following code:

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF screen-name = 'S_WERKS'.
      screen-input = 0.
      MODIFY SCREEN.
    ENDIF.
  ENDLOOP.

Changing the input value to 0 for this screen element will disable input and makes the input field appear as grayed out.




回答2:


You may define the parameter non-vivible with no-display.

parameters:
  s_visib like resb-werks default 'X',
  s_werks like resb-werks default 'X' no-display.

René's solution is usefull, when you want to define the visibility dynamic.



来源:https://stackoverflow.com/questions/8162152/disable-a-parameter-input-at-selection-screen

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!