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: 

How to enable and disable a push button in module pool ?

Former Member
0 Kudos

In my screen one input field and one push button is there , when i am execute a program in the screen the push button was disable mode . when i am enter data in the input that time the push button was enable mode . how to write a code please help me ?

1 ACCEPTED SOLUTION

sandroramos
Active Participant
0 Kudos

LOOP AT SCREEN.

  IF SCREEN-NAME EQ 'COMP_NAME' AND INPUT_FIELD IS NOT INITIAL.

    SCREEN-ACTIVE   = '1' OR '0'.

    MODIFY SCREEN.  <<< Don't forget this one.

  ENDIF.

ENDLOOP.

5 REPLIES 5

sandroramos
Active Participant
0 Kudos

LOOP AT SCREEN.

  IF SCREEN-NAME EQ 'COMP_NAME' AND INPUT_FIELD IS NOT INITIAL.

    SCREEN-ACTIVE   = '1' OR '0'.

    MODIFY SCREEN.  <<< Don't forget this one.

  ENDIF.

ENDLOOP.

0 Kudos

Hi Sandro Ramos

Thanks for giving reply..........

THIS IS THE CODE WHICH I HAVE DEVELOPED,BUT AFTER PROVIDING INPUT AND I CLICK (ENTER) THEN THE PUSH BUTTON IS GETTING ENABLED BUT THE REQUIREMENT IS WHEN WE PROVIDE INPUT THE PUSH BUTTON SHOULD BECOME ENABLE AUTOMATICALLY WITHOUT PRESSING ENTER KEY....

loop at screen.

if INPUT1 is initial.

if screen-name = 'INSERT'.

screen-input = 0.

endif.

elseif input1 is not initial.

screen-input = 1.

endif.

modify screen.

endloop.

0 Kudos

If I understand you correctly, you want the button to become enabled simply by keying data into a field and without pressing a function key of any kind.  This is not possible for a simple entry field on a standard dynpro screen.  Your only option is to make your screen field a list box, check box, or part of a radio button group and then assign a function code to the field.

Plus this might be a better way to write your code:

LOOP AT SCREEN.

CASE SCREEN-NAME.

     WHEN 'PUSHBTN'.

          IF INPUT_FIELD IS NOT INITIAL.

               SCREEN-INPUT = '1'.

          ELSE.

               SCREEN-INPUT = '0'.

          ENDIF.

          MODIFY SCREEN.

  ENDCASE.

ENDLOOP.

But keep in mind for this to work some sort of function code must be fired(such as pressing enter).  It will work the way you want only if you convert your input field to a list box AND assign a function code to the field.  When you select an entry in the list box the function will fire.  This will cause PAI to fire and then PBO will follow.

I would say that if you cannot convert your field to a list box, you will not be able to do what you want.

0 Kudos

I agree to Larry, just in case the user delete the value of the input field when the button is enabled and then click on button, put a check at PAI to treat the user command.

0 Kudos

Let me know how to work with disable enable otions for button