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: 

Disabling the text feild in MPP

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

3 REPLIES 3

Former Member
0 Kudos

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

I355602
Advisor
Advisor
0 Kudos

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. &quot;disable for input
      screen-active = 0.
    endloop.
    modify screen. &quot;apply attributes to screen
  endif.
endif.


" enable textbox on a condition
if <condition>.
  if ( screen-group1 = 'ABC' ).
    loop at screen.
      screen-input = 1. &quot;enable for input
      screen-active = 1.
    endloop.
    modify screen. &quot;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 &#38; Regards,

Tarun Gambhir

Former Member
0 Kudos

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