01-17-2009 12:02 PM
Hi friends,
I am making a MPP program, here i want to disable a particular text box once a value is entered.
please provide the code to disable the text field in MPP.
Thanks,
Kamal
01-17-2009 1:18 PM
hi you have to group your fields first .
when 'FUN_CODE'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZTAB-FIELD'. "field which u want to make active
SCREEN-ACTIVE = 1. "1 - ENABLE , 0- DISABLE
SCREEN-INPUT = 1.
SCREEN-OUTPUT = 1.
MODIFY SCREEN.
ENDIF.
like wise modify as per your requirement .
regards
chinnaiya
01-17-2009 1:18 PM
hi you have to group your fields first .
when 'FUN_CODE'.
LOOP AT SCREEN.
IF SCREEN-NAME = 'ZTAB-FIELD'. "field which u want to make active
SCREEN-ACTIVE = 1. "1 - ENABLE , 0- DISABLE
SCREEN-INPUT = 1.
SCREEN-OUTPUT = 1.
MODIFY SCREEN.
ENDIF.
like wise modify as per your requirement .
regards
chinnaiya
01-18-2009 5:41 AM
Hi Kamal,
Use this code, its working:-
Take the group1 for the textbox as 'ABC' in the attributes, which you want to disable based on a condition.
" disable textbox on a condition
if <condition>.
if ( screen-group1 = 'ABC' ).
loop at screen.
screen-input = 0. "disable for input
screen-active = 0.
endloop.
modify screen. "apply attributes to screen
endif.
endif.
" enable textbox on a condition
if <condition>.
if ( screen-group1 = 'ABC' ).
loop at screen.
screen-input = 1. "enable for input
screen-active = 1.
endloop.
modify screen. "apply attributes to screen
endif.
endif.
Now this code can be included either in PBO or PAI, based on your requirement.
Hope this helps you out.
Thanks & Regards,
Tarun Gambhir
01-19-2009 4:18 AM
HI Kamal,
First double click on the field you need to disable in design mode and that would open the properties of the textbox where you define the name the datatype etc. there is an option which says group and has 4 input boxes. In the first input box enter say 111. This is group1 in your screen internal table. Now in the PBO of your flow logic double click on the module to open the abap editor. Inside the module .. endmodule statement write the following code.
If <condition on which you want the input box to be disabled>.
loop at screen.
if screen-group1 = '111'.
screen-active = 1.
screen-input = 0.
else.
screen-input = 1.
endif.
modify screen.
endloop.
endif.
You may also use screen-name instead of screen-group1 where you pass the name of the textbox (in capitals letters enclosed within ' '.) and the rest code as the same.
I hope this solves your query.
Regards,
Sachin