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 disable UI elements

arpitgoyal
Product and Topic Expert
Product and Topic Expert
0 Likes
952

Hi All,

I searched the forum for my problem of enabling and disabling UI elements and got this thread:

Now I am not sure why in my code it is not working:


...
selection-screen begin of block b1 with frame title text-001.
select-options: swcv for p_string.
select-options: namespce for p_string.
parameters: selectal as checkbox default space user-command all.
selection-screen end of block b1.
...
at selection-screen.
  perform validate_form.
...
form validate_form.
  if sy-ucomm eq 'ALL'.
    if selectal eq 'X'.
      loop at screen.
        if screen-name CP 'SWCV*'.
          screen-active = '0'.
        elseif screen-name CP 'NAMESPCE*'.
          screen-active = '0'.
        endif.
        modify screen.
      endloop.
    elseif selectal eq space.
      loop at screen.
        if screen-name CP 'SWCV*'.
          screen-active = '1'.
        elseif screen-name CP 'NAMESPCE*'.
          screen-active = '1'.
        endif.
        modify screen.
      endloop.
    endif.
  endif.
endform.

I have tried screen-active and also screen-invisible inplace of it. Passed '0' for disabling and '1' to enabling but somehow it doens't work. In debug mode I have seen that the values are changed from 0 to 1 and 1 to 0 and modify screen is also called, but somehow the UI doesn't reflect the changes?

I want to disable two select-option field SWCV and NAMESPCE when user checks the SELECTAL checkbox.

Please let me know what am I doing wrong?

Regards,

Arpit

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
864

Trying using the the AT SELECTION-SCREEN OUTPUT event instead.

Regards,

Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
865

Trying using the the AT SELECTION-SCREEN OUTPUT event instead.

Regards,

Rich Heilman

Read only

Pawan_Kesari
Active Contributor
0 Likes
864

try this code

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: swcv FOR p_string MODIF ID a1.
SELECT-OPTIONS: namespce FOR p_string MODIF ID a1 .
PARAMETERS: selectal AS CHECKBOX DEFAULT space USER-COMMAND all.
SELECTION-SCREEN END OF BLOCK b1.

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

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
864

This is working for me. Don't need to check sy-ucomm.

selection-screen begin of block b1 with frame title text-001.
select-options: swcv for p_string.
select-options: namespce for p_string.
parameters: selectal as checkbox default space user-command all.
selection-screen end of block b1.


at selection-screen output.
  perform validate_form.

form validate_form.

    if selectal eq 'X'.
      loop at screen.
        if screen-name CP 'SWCV*'
          or screen-name CP 'NAMESPCE*'.
          screen-input = '0'.
        endif.
        modify screen.
      endloop.
    elseif selectal eq space.
      loop at screen.
        if screen-name CP 'SWCV*'
          or screen-name CP 'NAMESPCE*'.
          screen-input = '1'.
        endif.
        modify screen.
      endloop.
    endif.

endform.

Regards,

Rich Heilman

Read only

arpitgoyal
Product and Topic Expert
Product and Topic Expert
0 Likes
864

Thanks all. It is working now.

Just want to know, why the event at selection-screen didnt work and at selection-screen output worked?

Is it like the second event also makes call back to the report UI?

Thanks again for solving the problem.

Regards,

Arpit

Read only

0 Likes
864

AT SELECTION-SCREEN OUTPUT is the PBO, process before output. We always set screen attributes in the PBO. The AT SELECTION-SCREEN is the PAI, process after input. This is triggered after the user clicks something, and the control is then passed back around to the PBO, where again we set the screen attributes.

Regards,

Rich Heilman