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: 

Change the view of button on basis of value selected from dropdown

Former Member
0 Kudos

Hi all,

i have one dropdown and one button called download. for example if  i select value '1' from dropdown, button should visible or enabled.

If i select value '3' from dropdown, then button should be invisible or disabled.

So how to do it,as selecting value from dropdown its not triggering any code unless i press any execute button.

5 REPLIES 5

former_member197916
Active Participant
0 Kudos

hi,

give a function code to your dropdown and make the button visible/in visisble on its basis.

in pai

if sy-ucomm = 'DROP'.

your logic for making button visible invisible.

endif.

you can also try placing your button in a subscreen and calling it to make it visible and a blank subscreen to make it invisible.

hope it helps

0 Kudos

Can we do any other way, because there are lot many fileds on screen, so it will loop so many times.

Can we do it by creating any event, and trigger event.I am not sure how to use it.

0 Kudos

May be you can find any events, but to modify screen at run-time you have to use LOOP AT SCREEN. as mentioned here.

And as i know there is no performance issue of this, so be free to use LOOP AT SCREEN.

Hope this helps.

prajeshdesai
Contributor
0 Kudos

Try below,


DATA: gd_ucomm type sy-ucomm.

AT SELECTION-SCREEN.

  gd_ucomm = sy-ucomm.

AT SELECTION-SCREEN OUTPUT.

  case gd_ucomm.

    when 'UPD'. "dropdown selection made

      LOOP at screen.

        if screen-name cs 'P_BTN'.

          screen-active = 0. "remove field from screen

*          screen-input = 0. "set field as display only

          modify screen.

        endif.

      ENDLOOP.

  ENDCASE.

Hope this helps.

thanga_prakash
Active Contributor
0 Kudos

Code it under event AT SELECTION SCREEN OUTPUT. based on the values you can set the button to active or inactive.

Refer to the below link for details.

Dynamic Selection Screens based on user inputs - Code Gallery - SCN Wiki