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

Selection screen fields Disable when a check box is checked

Former Member
0 Likes
9,627

If the check box (non MRP) is selected, I would like to grey out material, plant and selection list description in the selection screen bolck B1. If the check box is unchecked those three fields need to be available and plant, selection list description are mandatory

If the check box (non MRP) is selected, I would like to grey out material, plant and selection list description in the selection screen bolck B1. If the check box is unchecked those three fields need to be available and plant, selection list description are mandatory

5 REPLIES 5
Read only

Former Member
0 Likes
3,344

Hi,

Use

Loop at screen.

if non_mrp = 'X'.

Material-input = 0.

Plant-input = 0.

************

endif.

endloop.

Try this.

Reward it if it is usefull.

Regards

Srimanta

Read only

former_member386202
Active Contributor
0 Likes
3,344

Hi,

Refer this code.

----


  • PARAMETERS & SELECT-OPTIONS *

----


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

PARAMETERS : p_pay1 RADIOBUTTON GROUP grp USER-COMMAND fc DEFAULT 'X',

p_pay2 RADIOBUTTON GROUP grp.

SELECTION-SCREEN END OF BLOCK b1.

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

SELECT-OPTIONS : s_pernr FOR pa0000-pernr. "Personnel Number

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT (31) text-018.

PARAMETERS : p_begda LIKE pa0000-begda OBLIGATORY. "Start Date

SELECTION-SCREEN COMMENT 52(05) text-019.

PARAMETERS : p_endda LIKE pa0000-endda OBLIGATORY. "End Date

SELECTION-SCREEN END OF LINE.

SELECT-OPTIONS : s_stat2 FOR pa0000-stat2, "Status

s_werks FOR pa0001-werks, "Personnel Area

s_raufnr FOR catsdb-raufnr MODIF ID md1. "Internal Order Number

SELECTION-SCREEN END OF BLOCK b2.

----


  • AT SELECTION-SCREEN *

----


AT SELECTION-SCREEN OUTPUT.

IF p_pay1 EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'MD1'.

screen-active = '1'.

screen-input = '0'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSEIF p_pay2 EQ 'X'.

LOOP AT SCREEN.

IF screen-group1 = 'MD1'.

screen-active = '1'.

screen-input = '1'.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Regards,

Prashant

Read only

Former Member
0 Likes
3,344

Hi,

try this..


PARAMETERS: P_MATNR TYPE MATNR MODIF ID M1,     " material
                         P_WERKS TYPE WERKS_D MODIF ID M1,  " plant
                        P_SELLIS(10)  MODIF ID M1,                        " sel list des
                        P_NONMRP AS CHECKBOX USER-COMMAND USR.


AT SELECTION-SCREEN OUTPUT.

IF P_NONMRP = 'X'.

  LOOP AT SCREEN.

    IF SCREEN-GROUP1 = 'M1'.

       SCREEN-INPUT = 0.    " DIsable material , plant and selection list.
        MODIFY SCREEN.

    ENDIF.

  ENDLOOP.


ENDIF.


AT SELECTION-SCREEN.

IF P_NONMRP = ' '.


  IF P_MATNR IS INITIAL OR P_WERKS IS INITIAL OR P_SELLIS IS INITIAL.

       MESSAGE E208(00) WITH 'Material, plant, selection list is mandatory'.

  ENDIF.


ENDIF.


Thanks

naren

Read only

Former Member
0 Likes
3,344

Hi,

Refer this code.

&----


*& Report ZHAR_DYN_SELSCR.

&----


*& This program demonstrates how easy it is to set selection screen

*& element properties dynamically

*&

*& The program uses 3 radio buttons to set the display and input

*& properties of selection screen fields dynamically

&----


*& URL: http://allaboutsap.blogspot.com

&----


REPORT ZHAR_DYN_SELSCR.

----


  • DATABASE TABLES

----


tables : mara.

----


  • SELECTION SCREEN

----


selection-screen begin of block b1 with frame.

*--- Radio buttons to set properties

PARAMETERS:

rad1 RADIOBUTTON GROUP rad default 'X' USER-COMMAND radio,

rad2 RADIOBUTTON GROUP rad,

rad3 RADIOBUTTON GROUP rad.

*--- Selection Screen fields

SELECT-OPTIONS:

s_matnr FOR mara-matnr MODIF ID MI1,

s_mtart FOR mara-mtart MODIF ID MI1,

s_mbrsh FOR mara-mbrsh MODIF ID MI2,

s_matkl FOR mara-matkl MODIF ID MI2.

selection-screen end of block b1.

----


  • AT SELECTION SCREEN

----


at selection-screen output.

loop at screen.

*--- If Radio Button 1 is checked

IF rad1 = 'X'.

IF screen-group1 = 'MI2'.

*--- Fields with MODIF ID MI2 disappear from the screen

screen-input = 0.

screen-invisible = 1.

ENDIF.

*--- If Radio Button 2 is checked

ELSEIF rad2 = 'X'.

IF screen-group1 = 'MI1'.

*--- Fields with MODIF ID MI1 are input-disabled

screen-input = 0.

ENDIF.

*--- If Radio Button 3 is checked

ELSEIF rad3 = 'X'.

IF screen-group1 = 'MI1' or screen-group1 = 'MI2'.

*--- All fields will appear input-enabled

screen-input = 1.

ENDIF.

ENDIF.

*--- MODIFY SCREEN mandatory addition to apply changes to the screen

Modify screen.

endloop.

Reward if helpful.

Regards,

Harini.S

Read only

Former Member
0 Likes
3,344

Hi,

Check the below code.

selection-screen begin of block blk1 with frame.

PARAMETERS: ONE as checkbox default 'X' user-command rusr.

selection-screen end of block blk1.

selection-screen begin of block blk2 with frame.

parameters : USER1 LIKE USR02-BNAME DEFAULT SY-UNAME modif id Z1.

parameters : USER2 LIKE USR02-BNAME DEFAULT SY-UNAME modif id Z1.

selection-screen end of block blk2.

AT SELECTION-SCREEN output.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'Z1'. "Name field

IF one = 'X'.

SCREEN-INPUT = 1.

ELSE.

SCREEN-INPUT = 0.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.