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

Disable or Enable a button in Screen(dialog) Programming

Former Member
0 Likes
7,327

Hi Experts,

Actually, in screen programming I am developing a program. I want to disable a button and later on enable it in run-time .

I searched and found this statement to apply ' screen-active = '0' for disabling and later on change 0 to 1 to enable the button.

I used that but in my program when I apply this code on the button via another button, the button gets invisible instead of getting disabled.

I am puzzled because I used  ' screen-invisible = '1' ' for getting visible and invisible the button and it worked.

I have added my code at the end of my writing.

Can anyone help me on if  screen-active = '0' is correct statement for enabling/disabling a button or advice my in possible mistake or giving me some tips to follow and check.

Thanks in advance.

Regards

Richard

_____________________________________________

my code in PBO is as :

MODULE modify_screen OUTPUT.

   IF stat1 = '1'.  ' To disable the button

     LOOP AT SCREEN

       IF screen-name = 'PUSH2'.

         screen-active = '0'.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ENDIF.

   IF stat1 = '2'.  ' To enable the button

     LOOP AT SCREEN .

       IF screen-name = 'PUSH2'.

         screen-active = '1'.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ENDIF.

ENDMODULE.                 " MODIFY_SCREEN  OUTPUT

4 REPLIES 4
Read only

Former Member
0 Likes
2,525

Hi Richard,

Use Screen-input. That should solve the problem.

if screen-input = 0, the button is disabled else enabled.

Thanks,

Venkat.

Read only

Former Member
0 Likes
2,525

Hi,

you are right with your code change being done in PBO and

Loop at screen.

..

Modify screen.

..

Endloop.

you can use,

invisible - To suppress a field, output - for display only fields, active - makes a field active

you can try it this way also..

LOOP AT SCREEN.

    IF screen-name = 'PUSH2'.

      IF stat1 = '1'.

        screen-input = '0'.

      ELSEIF stat1 = '2'.

        screen-input = '1'.

      ENDIF.

      MODIFY SCREEN.

    ENDIF.

  ENDLOOP.

Read only

Former Member
0 Likes
2,525

Hi Richard,

    what you have done will not make the buttons get disabled at run time instead .

in PBO, create a module and write this code when the condition invokes.

MODULE disable_button OUTPUT.

   DATA : fcode TYPE TABLE OF sy-ucomm.

   IF mode = con_show.

     APPEND 'SRCH' TO fcode.

     APPEND 'SAVE' TO fcode.

     SET PF-STATUS 'TSS_MENU' EXCLUDING fcode.

   ENDIF.

ENDMODULE.

Regards, if you have any doubt just reply .

Read only

Former Member
0 Likes
2,525

Hi,

First understand what is the difference between Active = 0 or 1 and Input = 0 or 1.

Active = 0 - Means the screen element will not be shown while run-time.

Input = 0   - Means the Screen element will be shown but it will not accept any input. i.e. it is the element will be shown in grey mode.

So, If you want the screen element will be shown to the user but no action will be done on that then use :

Loop at Screen.

If screen-name eq 'xyz'.

     screen-input = 0.

endif.

endloop.

If you want the screen element will not be shown to the user i.e. no display of that element then use:

Loop at Screen.

If screen-name eq 'xyz'.

     screen-active = 0.

endif.

endloop.

Note: you must write this code in PBO only.

hope this will help you.

Regards,

Rajesh Sadula.