‎2006 Aug 01 7:49 AM
Hi experts,
Iam working on Dialog programming.
I have one button & one text box on the screen.
My requirement is,
If i click button, the text box should <b>visible</b>.If i click again the textbox should <b>invisible</b>.
Can anyone tell me how can i do this.
thanks
kaki
‎2006 Aug 01 8:00 AM
In PAI:
CASE ok_code.
WHEN 'click'. ">>this is the ok_code for the button
IF flg_click EQ space.
flg_click = 'X'.
ELSE.
clear flg_click.
ENDIF.
ENDCASE.Now, in PBO,
LOOP AT SCREEN.
IF flg_click EQ space.
textbox-input = 0.
textbox-invisible = 1.
ELSE.
textbox-input = 1.
textbox-invisible = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.Hope this helps.
Sudha
‎2006 Aug 01 7:56 AM
Hai,
In your PBO Module, have the following module code.
LOOP AT SCREEN.
IF SCREEN-NAME = <textbox name>.
SCREEN-ACTIVE = '0'. *0 - Invisible / 1 - Visible
ENDIF.
MODIFY SCREEN.
ENDLOOP.
‎2006 Aug 01 8:04 AM
you have to create a screen group GR1 in the screen elements.
In pai module you can set a display flag when the user clicks on the button and in pbo module you can write the code like this
IF NOT v_disp_flag IS INITIAL.
LOOP AT SCREEN.
IF screen-group1 = 'GR1'.
screen-active = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
Regards,
Sangram
SAP Consultant
‎2006 Aug 01 8:00 AM
In PAI:
CASE ok_code.
WHEN 'click'. ">>this is the ok_code for the button
IF flg_click EQ space.
flg_click = 'X'.
ELSE.
clear flg_click.
ENDIF.
ENDCASE.Now, in PBO,
LOOP AT SCREEN.
IF flg_click EQ space.
textbox-input = 0.
textbox-invisible = 1.
ELSE.
textbox-input = 1.
textbox-invisible = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.Hope this helps.
Sudha
‎2006 Aug 01 8:00 AM
In you PBO module.
count = count + 1.
if count = 1.
flag = 'ON'.
endif.
Loop at screen.
if screen-name = 'BOX'.
if flag = 'ON'.
screen-active = 1.
else.
screen-active = 0.
endif.
endloop.
and in your PAI module.
case ok_code.
when 'BUT1'.
if flag = 'ON'.
flag = 'OFF'.
else.
flag = 'ON'.
endcase.
‎2006 Aug 01 8:01 AM
Hi Kaki,
It is very easy.In the screen painter, just make the field invisible by checking the invisible checkbox.
Now in the main program , you can do like this.
Create a global variable (say flag with value 0).
In PBO
-
LOOP AT SCREEN.
IF SCREEN-NAME = 'FIELD1' AND FLAG = 0. "whatever be the field name in screen painter
SCREEN-ACTIVE = 1.
ELSEIF SCREEN-NAME = 'FIELD1' AND FLAG = 1.
SCREEN-ACTIVE = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
In PAI
-
case sy-ucomm.
when 'CLICK'.
flag = 1.
endcase.
You can also do it by using INVISIBLE instead of ACTIVE also...
Regards,
Amit.
‎2006 Aug 01 8:31 AM