Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable a parameter input at selection screen

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?

like image 392
yukou Avatar asked Nov 17 '11 04:11

yukou


People also ask

How do I turn off parameter fields in SAP?

screen-input = 0. MODIFY SCREEN. ENDIF. ENDLOOP.

How do you hide a selection screen parameter in SAP ABAP?

parameters : R1 radiobutton group g1 default 'X' user-command AA. select-options : s_bukrs for skb1-bukrs MODIF ID AA. parameters : p_GJAHR type bseg-GJAHR MODIF ID AA. parameters : p_MONAT type bkpf-MONAT MODIF ID AA.

How do you gray out a field in the selection screen in ABAP?

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

How do you make selection screen parameters Mandatory?

You can use the addition 'OBLIGATORY' to make a selection screen field mandatory while declaring the same. Eg. PARAMETERS: p_carr TYPE spfli-carrid OBLIGATORY. SELECT-OPTIONS : s_carr for spfli-carrid OBLIGATORY.


2 Answers

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.

like image 58
René Avatar answered Nov 15 '22 09:11

René


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.

like image 41
knut Avatar answered Nov 15 '22 10:11

knut