07-27-2012 3:43 PM
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 ?
07-27-2012 4:18 PM
Hi Prasad,
I did not understand your problem exactly, but it seems you're having problems to enable/disable components at Screen.
Try to put your logic on PBO event and inside a LOOT AT SCREEN you can check screen-name and change the screen-active value.
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.
Regards,
Sandro Ramos
07-27-2012 4:18 PM
Hi Prasad,
I did not understand your problem exactly, but it seems you're having problems to enable/disable components at Screen.
Try to put your logic on PBO event and inside a LOOT AT SCREEN you can check screen-name and change the screen-active value.
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.
Regards,
Sandro Ramos
07-27-2012 5:40 PM
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.
07-27-2012 5:52 PM
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.
07-27-2012 6:08 PM
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.
Regards,
Sandro Ramos
12-17-2019 6:56 AM