Application Development 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: 

LOOP AT SCREEN

Former Member
0 Kudos
210

Hi guys,

i have one requirement like .

In selection screen i have 5 parameter.

one para meter as list box.

when i entered '1' in listbox ,i need to disacle another parameter.

if '2' entered ,i want disable another field.

How can i do.

i written like

AT SELECTION-SCREEN OUTPUT.

IF p_ftype = '1'.

LOOP AT SCREEN.

IF screen-group1 = 'M2'.

screen-input = 0.

ENDIF.

ENDLOOP.

ENDIF.

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
129

Make sure to MODIFY the SCREEN.




AT SELECTION-SCREEN OUTPUT.
IF p_ftype = '1'.
LOOP AT SCREEN.
IF screen-group1 = 'M2'.
screen-input = 0.
<b>MODIFY SCREEN.</b>
ENDIF.
ENDLOOP.

ENDIF.



Regards,

Rich Heilman

0 Kudos
129

Hi Heilman,

If i give default value as 1 ,it is working.

0 Kudos
129

i want when i select as 1 then only display as disable.

0 Kudos
129

Can you please post all of your code.

Regards,

Rich Heilman

0 Kudos
129

Hi Heilmen,

here iam sending my code.

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

PARAMETERS: p_ftype TYPE c AS LISTBOX VISIBLE LENGTH 15 OBLIGATORY,

p_afapl TYPE afapl ,

p_gjahr TYPE gjahr,

p_dimage TYPE zfidf_imgid MODIF ID m1,

p_afabe TYPE t093-afabe1 OBLIGATORY.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(31) text-009

FOR FIELD p_versin.

PARAMETERS:

p_versin TYPE versm MODIF ID m2.

SELECTION-SCREEN END OF LINE.

SELECT-OPTIONS:s_bukrs FOR v_bukrs NO INTERVALS ,

s_ktogr FOR v_ktogr NO INTERVALS ,

s_anlkl FOR v_anlkl NO INTERVALS .

PARAMETERS:p_numyrs TYPE char2. "Number of Years

SELECTION-SCREEN END OF BLOCK b1.

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

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS: p_caa RADIOBUTTON GROUP lay DEFAULT 'X'.

SELECTION-SCREEN COMMENT 3(50) text-005

FOR FIELD p_caa.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

PARAMETERS p_aca RADIOBUTTON GROUP lay.

SELECTION-SCREEN COMMENT 4(50) text-006

FOR FIELD p_caa.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(21) text-004

FOR FIELD p_curper.

PARAMETERS: p_curper AS CHECKBOX DEFAULT c_true.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(21) text-007

FOR FIELD p_sst.

PARAMETERS: p_sst AS CHECKBOX DEFAULT c_true.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 1(21) text-008

FOR FIELD p_sgt.

PARAMETERS: p_sgt AS CHECKBOX DEFAULT c_true.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b2.

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

PARAMETERS: p_awo AS CHECKBOX,

p_ipmr AS CHECKBOX MODIF ID m2,

p_ret AS CHECKBOX MODIF ID m2,

p_impact AS CHECKBOX MODIF ID m2.

SELECTION-SCREEN END OF BLOCK b3.

INITIALIZATION.

vw_vrm-key = '1'.

vw_vrm-text = '1.Unconditional'.

APPEND vw_vrm TO v_vrm.

vw_vrm-key = '2'.

vw_vrm-text = '2.Conditonal'.

APPEND vw_vrm TO v_vrm.

CALL FUNCTION 'VRM_SET_VALUES'

EXPORTING

id = 'P_FTYPE'

values = v_vrm

EXCEPTIONS

id_illegal_name = 1

OTHERS = 2.

AT SELECTION-SCREEN OUTPUT.

IF p_ftype = '1'.

LOOP AT SCREEN.

IF screen-name = P_FTYPE and screen-group1 = 'M2'.

screen-intensified = 0.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

ENDIF.

0 Kudos
129

Try this.

Make sure that you wrap with single quotes.



AT SELECTION-SCREEN OUTPUT.
IF p_ftype = '1'.
LOOP AT SCREEN.
IF screen-name = <b>'P_FTYPE'</b> and screen-group1 = 'M2'.
screen-intensified = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.

ENDIF.


Regards,

Rich Heilman

0 Kudos
129

Here is my test program which is working good for me. Drop down to listbox for value 1 and hit enter, notice that the second field is disable, drop listbox to 2 and hit enter, notice that the first field is disabled.



report zrich_0001 .

type-pools: vrm.

parameters: p_list type i as listbox visible length 5.
parameters: p_parm1 type c modif id pm1,
            p_parm2 type c modif id pm2.

initialization.

  perform build_drop_down_list.

at selection-screen output.

  loop at screen.
    if ( p_list = '1'
      and screen-group1 = 'PM2' )
      or ( p_list = '2'
      and screen-group1 = 'PM1' ).
      screen-input = 0.
      modify screen.
    endif.
  endloop.


start-of-selection.

write:/ p_list.


************************************************************************
* build drop_down_list
************************************************************************
form build_drop_down_list.

  data: name type vrm_id,
        list type vrm_values,
        value like line of list.

  clear list. refresh list.
  name = 'P_LIST'.

  clear value.
  value-key = 1.
  value-text = 1.
  append value to list.


  clear value.
  value-key = 2.
  value-text = 2.
  append value to list.

* Set the values
  call function 'VRM_SET_VALUES'
       exporting
            id     = name
            values = list.

endform.

Regards,

Rich Heilman

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
129

Please make sure to mark your post as solved if solved completely. Thanks.

Regards,

Rich Heilman