Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Enable a field on selection screen based on a condition

Former Member
0 Likes
4,561

Hello All,

I have a requirement that on a selection screen i have one check box (PARAMETER) and one input field

(Select-option) .Now i need to enable the input field only if the checkbox is checked on the selection screen.

Enabling and disabling of the input field is based on the checkbox being checked or not checked on the selection screen itself.

Is this possible to achieve ? please suggest how to do this?

Thanks in advance,

Swati

8 REPLIES 8
Read only

Former Member
0 Likes
2,120

Yes it is possible. Try using:

AT SELECTION-SCREEN OUTPUT.

Read only

0 Likes
2,120

Where should i write this "AT SELECTION - SCREEN OUTPUT?

Can u give me some example please.

Thanks,

Swati

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,120

Hi,

>

> Where should i write this "AT SELECTION - SCREEN OUTPUT?

>

> Can u give me some example please.

>

> Thanks,

> Swati

Refer the code provided by me in above reply, it will definitely help you.

Regards,

Tarun

Read only

0 Likes
2,120

Thanks you to all for the quick and useful inputs.

Read only

Former Member
0 Likes
2,120

Use AT selection-screen output.

IF p_pres EQ c_x.

  • Disable application server path, if presentation server radio button

  • is selected

CLEAR p_afile.

LOOP AT SCREEN.

IF screen-group1 EQ c_sb2.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Read only

former_member222860
Active Contributor
0 Likes
2,120

Check this

PARAMETERS : p_chk AS CHECKBOX USER-COMMAND abcd.

PARAMETERS : p_param(10) TYPE c MODIF ID gp1.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF p_chk = 'X'.
      IF screen-group1 = 'GP1'.
        screen-input = 1.
      ENDIF.
    ELSE.
      IF screen-group1 = 'GP1'.
        screen-input = 0.
      ENDIF.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,120

Hi,

Refer:


PARAMETERS : p_chk AS CHECKBOX USER-COMMAND cmd,
             p_matnr TYPE matnr MODIF ID abc.

AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    IF p_chk = 'X'. "<--enable field for input
      IF screen-group1  = 'ABC'.
        screen-input = 1. "<--edit
      ENDIF.
    ELSE. "<--disable field for input
      IF screen-group1  = 'ABC'.
        screen-input = 0. "<--greyed out
      ENDIF.
    ENDIF.
    MODIFY SCREEN.
  ENDLOOP.

If user selects the checkbox, parameter for material is editable for input else it is disabled for input.

Hope this helps you.

Regards,

Tarun

Read only

Former Member
0 Likes
2,120

hi refer this code :

*PARAMETERS : R1 RADIOBUTTON GROUP G1.

*PARAMETERS : R2 RADIOBUTTON GROUP G1.

*

*

*SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

*SELECT-OPTIONS : SO_KUNNR FOR VBAK-KUNNR MODIF ID A ,

  • SO_DAT1 FOR VBAK-ERDAT MODIF ID A.

*SELECTION-SCREEN END OF BLOCK b1.

*

*

*SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

*SELECT-OPTIONS : SO_MATNR FOR AFPO-MATNR MODIF ID B ,

  • SO_DAT2 FOR VBAK-ERDAT MODIF ID B.

*SELECTION-SCREEN END OF BLOCK b2.

then

AT SELECTION-SCREEN OUTPUT.

  • loop at screen.

**

      • IF R1 = 'X'.

      • if screen-name = SO_KUNNR.

      • SCREEN-INVISIBLE = 1.

      • screen-active = 0.

      • endif.

      • modify screen.

      • if screen-name = SO_DAT1.

      • SCREEN-INVISIBLE = 1.

      • screen-active = 0.

      • endif.

      • modify screen.

      • ENDIF.

      • IF R2 = 'X'.

      • if screen-name = SO_MATNR.

      • SCREEN-INVISIBLE = 1.

      • screen-active = 0.

      • endif.

      • modify screen.

      • if screen-name = SO_DAT2.

      • SCREEN-INVISIBLE = 1.

      • screen-active = 0.

      • endif.

      • modify screen.

      • ENDIF.

**

**

*

  • IF R1 = 'X'.

  • if screen-GROUP1 = 'B' .

  • SCREEN-INVISIBLE = 1.

  • screen-active = 0.

  • endif.

  • modify screen.

  • ENDIF.

  • IF R2 = 'X'.

  • if screen-GROUP1 = 'A'.

  • screen-active = 0.

  • endif.

  • modify screen.

  • ENDIF.

  • endloop.