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

how to disable fields on selection screen?

Former Member
0 Likes
1,245

hi,

i have two fields f1 and f2 on selection screen and two radio buttons r1 and r2.

if i select r1, f1 should be input enable and f2 shuld be disabled.

and if i select r2, f2 should be input enable and f1 shuld be disabled.

i hav code like this

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

PARAMETERS: p_Pfile TYPE rlgrap-filename, "presentation server input file

p_afile TYPE rlgrap-filename. "application server input file

  • p_efile TYPE rlgrap-filename. "error file

SELECTION-SCREEN END OF BLOCK blk1.

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

PARAMETERS: R_ps TYPE c RADIOBUTTON GROUP rd default 'X', "radio button for presentation server

R_as TYPE c RADIOBUTTON GROUP rd . "radio button for application server

SELECTION-SCREEN END OF BLOCK blk2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF R_PS = C_X.

IF SCREEN-NAME = P_PFILE.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ELSE. "IF SCREEN-NAME = P_AFILE.

SCREEN-ACTIVE = 1.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ELSEIF R_AS = C_X.

IF SCREEN-NAME = P_PFILE.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ELSE. "IF SCREEN-NAME = P_AFILE.

SCREEN-ACTIVE = 1.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

but i could not get that .

plz help me

hi,

i have two fields f1 and f2 on selection screen and two radio buttons r1 and r2.

if i select r1, f1 should be input enable and f2 shuld be disabled.

and if i select r2, f2 should be input enable and f1 shuld be disabled.

i hav code like this

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

PARAMETERS: p_Pfile TYPE rlgrap-filename, "presentation server input file

p_afile TYPE rlgrap-filename. "application server input file

  • p_efile TYPE rlgrap-filename. "error file

SELECTION-SCREEN END OF BLOCK blk1.

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

PARAMETERS: R_ps TYPE c RADIOBUTTON GROUP rd default 'X', "radio button for presentation server

R_as TYPE c RADIOBUTTON GROUP rd . "radio button for application server

SELECTION-SCREEN END OF BLOCK blk2.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF R_PS = C_X.

IF SCREEN-NAME = P_PFILE.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ELSE. "IF SCREEN-NAME = P_AFILE.

SCREEN-ACTIVE = 1.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ELSEIF R_AS = C_X.

IF SCREEN-NAME = P_PFILE.

SCREEN-ACTIVE = 0.

MODIFY SCREEN.

ELSE. "IF SCREEN-NAME = P_AFILE.

SCREEN-ACTIVE = 1.

SCREEN-INPUT = 1.

MODIFY SCREEN.

ENDIF.

ENDIF.

ENDLOOP.

but i could not get that .

plz help me

7 REPLIES 7
Read only

former_member404244
Active Contributor
0 Likes
1,094

Hi ,

Try like this

IF R_PS IS INITIAL.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_AFILE'.

screen-input = 1.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

else.

LOOP AT SCREEN.

CASE screen-name.

WHEN 'P_PFILE'.

screen-input = 1.

MODIFY SCREEN.

ENDCASE.

ENDLOOP.

ENDIF.

ENDLOOP.

Regards,

Nagaraj

Read only

0 Likes
1,094

Try using as below:


parameters: p_pfile type xxx-abc modif id pfile,
                  p_afile type xxx-abc modif id afile.

also while doing the loop at screen statement check for the modif id by the statement


check screen-group1 = 'AFILE'.[or PFILE as per your req]
screen-input = 1. [or 0 as per your req]

And the rest the same.

Rgds,

Narendra

Edited by: Narendra Daka on Dec 24, 2008 7:06 PM

Read only

former_member585060
Active Contributor
0 Likes
1,094

Hi,

Try the below code

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
PARAMETERS: r_ps TYPE c RADIOBUTTON GROUP rd DEFAULT 'X' USER-COMMAND abcd, "radio button for presentation server
            r_as TYPE c RADIOBUTTON GROUP rd . "radio button for application server
SELECTION-SCREEN END OF BLOCK blk2.


SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_pfile TYPE rlgrap-filename MODIF ID ccc, "presentation server input file
            p_afile TYPE rlgrap-filename MODIF ID aaa. "application server input file

* p_efile TYPE rlgrap-filename. "error file
SELECTION-SCREEN END OF BLOCK blk1.




*
AT SELECTION-SCREEN OUTPUT.

  IF r_ps = 'X' .

    LOOP AT SCREEN.
      CASE screen-group1.
        WHEN 'CCC'.
          screen-input = 1.
          screen-invisible = 0.
          MODIFY SCREEN.
      WHEN 'AAA'.
          screen-input = 0.
          screen-invisible = 1.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.

  ELSE.
    IF r_as = 'X'.
      LOOP AT SCREEN.
      CASE screen-group1.
        WHEN 'CCC'.
          screen-input = 0.
          screen-invisible = 1.
          MODIFY SCREEN.
      WHEN 'AAA'.
          screen-input = 1.
          screen-invisible = 0.
          MODIFY SCREEN.
      ENDCASE.
    ENDLOOP.

    ENDIF.
  ENDIF.

START-OF-SELECTION.

Regards

Bala Krishna

Read only

Former Member
0 Likes
1,094

Hi,

Try like this,

CONSTANTS : c_pre(3) TYPE c VALUE 'PRE',

c_app(3) TYPE c VALUE 'APP'.

SELECTION-SCREEN : BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.

PARAMETERS : p_app RADIOBUTTON GROUP rg1 DEFAULT 'X'

USER-COMMAND pc,

p_pre RADIOBUTTON GROUP rg1.

SELECTION-SCREEN : END OF BLOCK blk2.

AT SELECTION-SCREEN OUTPUT.

IF p_app EQ c_x.

LOOP AT SCREEN.

IF screen-group1 EQ c_pre.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 EQ c_app.

screen-active = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

Read only

Former Member
0 Likes
1,094

Hi ,

This is my test code look at "at selection screen output" part you will get it.

data: g_user_has_auth(1) TYPE c,

v_key LIKE sy-pfkey,

it_ucomm TYPE TABLE OF sy-ucomm.

CONSTANTS : c_yes TYPE c VALUE '1' ,

c_no TYPE c VALUE '0' .

INITIALIZATION.

  • Code to remove standard execute button from selection screen.

v_key = sy-pfkey.

APPEND : 'ONLI' TO it_ucomm.

CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'

EXPORTING

p_status = v_key

p_program = ' '

TABLES

p_exclude = it_ucomm.

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

SELECTION-SCREEN SKIP 1.

PARAMETERS: r_iobj RADIOBUTTON GROUP rb1 USER-COMMAND OP1.

PARAMETERS: r_ods RADIOBUTTON GROUP rb1.

PARAMETERS: r_cubes RADIOBUTTON GROUP rb1.

SELECTION-SCREEN END OF BLOCK b1.

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

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN: BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(20) text-t02 FOR FIELD p_info MODIF ID OP1.

PARAMETERS: p_info TYPE string MODIF ID OP1.

SELECTION-SCREEN: PUSHBUTTON 68(10) but1 USER-COMMAND cli1 MODIF ID OP1.

SELECTION-SCREEN : END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t04.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN: BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(20) text-t02 FOR FIELD p_ods MODIF ID OP2.

PARAMETERS: p_ods TYPE string MODIF ID OP2.

SELECTION-SCREEN: PUSHBUTTON 68(10) ods1 USER-COMMAND cli3 MODIF ID OP2.

SELECTION-SCREEN : END OF LINE.

*SELECTION-SCREEN SKIP 1.

*PARAMETERS: r_exe RADIOBUTTON GROUP rb2.

*PARAMETERS: r_st1 RADIOBUTTON GROUP rb2.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN: PUSHBUTTON /1(20) ods_cr USER-COMMAND cli4 MODIF ID OP2.

SELECTION-SCREEN END OF BLOCK b3.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

IF SCREEN-GROUP1 = 'OP1'.

IF R_IOBJ = 'X'.

SCREEN-INVISIBLE = C_NO.

SCREEN-ACTIVE = C_YES.

ELSE.

SCREEN-INVISIBLE = C_YES.

SCREEN-ACTIVE = C_NO.

ENDIF.

MODIFY SCREEN.

ENDIF.

IF SCREEN-GROUP1 = 'OP2'.

IF R_ODS = 'X'.

SCREEN-INVISIBLE = C_NO.

SCREEN-ACTIVE = C_YES.

ELSE.

SCREEN-INVISIBLE = C_YES.

SCREEN-ACTIVE = C_NO.

ENDIF.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
1,094

hi ,

See the following Pseudo Code

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
PARAMETERS: p_pfile TYPE rlgrap-filename , "presentation server input file
            p_afile TYPE rlgrap-filename . "application server input file
SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
PARAMETERS: r_ps RADIOBUTTON GROUP rd DEFAULT 'X' USER-COMMAND umd, "radio button for presentation server
            r_as RADIOBUTTON GROUP rd . "radio button for application server
SELECTION-SCREEN END OF BLOCK blk2.

AT SELECTION-SCREEN OUTPUT.

  IF r_ps = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'P_PFILE'.
        screen-input = 1.
        MODIFY SCREEN.
      ELSEIF screen-name ='P_AFILE'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSEIF r_as = 'X'.
    LOOP AT SCREEN.
      IF screen-name = 'P_AFILE'.
        screen-input = 1.
        MODIFY SCREEN.
      ELSEIF screen-name ='P_PFILE'.
        screen-input = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Thanks & REgards

Read only

Former Member
0 Likes
1,094

SEE THE FOLLOWING EXAMPLE

LOOP AT SCREEN.

IF screen-name = 'ITEM-SALES_UNIT'. " FIELD NAME

item-sales_unit = itab_item-sales_unit.

screen-input = 0.

screen-invisible = 1 .

or

screen-invisible = 0.

MODIFY SCREEN .

ENDIF.

ENDLOOP.