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 disable the text field in sap abap

Former Member
0 Kudos

Dear experts,

                        In module pool i get some fields from data dictonary .i want one field among them should enable(Display) only when Submit button press and diable before SUBMIT push button press.

I am able to disable the I/O field but not able to disable the text field  Of same field even though i assign same groupname to both fields can anyone give solution for this.

                                                 

                                                                                                                                                                                Thanks in advance.

18 REPLIES 18

nabheetscn
Active Contributor
0 Kudos

You keep the field initial in display mode only. Lets say field name is ABC.

When you press submit... in PBO of screen

if sy-ucomm eq 'SUBMIT'.

loop at screen.

if screen-name eq 'ABC'---"should be in caps

screen-input = 1.

modify screen.

endif.

endloop.

endif.

Thanks for mentioning screen name should be in caps, was helpful.

sivaganesh_krishnan
Contributor
0 Kudos

hi rajendra,

all the fields in the screen have a screen name , Use it

if sy-ucomm EQ 'SUBMIT'.

loop at screen.

If screen-name = 'textfield'.

screen-active  = 1.

modify screen.

endif.

endloop.

elseif sy-ucomm NE 'SUBMIT'.

loop at screen.

If screen-name = 'textfield'.

screen-active  = 0.

modify screen.

endif.

endloop.

endif.

sivaganesh

GirieshM
Active Contributor
0 Kudos

Hi Rajendra,

Find the name of the field and and make the screen active property as 0 after the submit button check .

Loop at screen.

if screen-name = 'XXXX'.

     screen-active = 0.

modify screen.

end screen.

Former Member
0 Kudos

if sy-ucomm EQ 'SUBMIT'.

loop at screen.

If screen-group = 'screen group name'.  "you can use screen-name also

screen-invisible  = '1'.

modify screen.

endif.

thangam_perumal
Contributor
0 Kudos

Hi Rajendra,

                Consider if Text Field Screen name is XXXX and your submit code FUNC name is SUBM.

Write the Coding in PBO of screen...

if sy-ucomm eq 'SUBM'.

loop at screen.

if screen-name = 'XXXX'.

screen-active = 1.

endif.

modify screen.

enloop.

else.

loop at screen.

if screen-name = 'XXXX'.

screen-active = 0.

endif.

modify screen.

enloop.

Please use in this logic.. it may satisfies your requirements.

Regards,

Thangam.P

Former Member
0 Kudos

hi,

if you to enable  the screen give 1 in screen-active. if u want to disable means give 0 to screen -active.

loop at screen.

if screen-name = 'SUBMIT'

screen-active = 0.

endif.

modify screen.

Regards,

gopi

Former Member
0 Kudos

Hi Rajendra,


try the below codes. It will help you surely.


if sy-ucomm EQ 'SUBMIT'.

loop at screen.

If not screen-group1 = 'scrn_grp_name'. "Include other conditions if any.

screen-input  = '0'. "use screen-invisible to hide

modify screen.

endif.

endloop.

Hope it will help you.

-Regards

Janaraja

naveen_inuganti2
Active Contributor
0 Kudos

Looks like you are using your own label to display text with help of Screen Element "Text". If that is the case then select that Text on screen layout and assign Group same as I/O field. So that you can disable entire group (Text and I/O field) with modify screen syntax.

Thanks,

Naveen

Former Member
0 Kudos

Thanks all but when i am able to diable I/O field(TEXTBOX)  but not TEXT field(LABEL) but both are under same group(ex: G11).why one disable and one canot.

0 Kudos

Hi Rajendra,

                  Please share the coding and screen shot of screen painter

0 Kudos

for text have u tried with screen-invisible  = '1' ?

0 Kudos

Can you please attach screen shot of attributes where you have define them in one group along with your sample code

0 Kudos

Can you please try by giving name instead of group for text field ?

I have used the below code and able to hide/unhide text field.

MODULE pbo OUTPUT.

   IF sy-ucomm = 'SUBMIT'.

     LOOP AT SCREEN.

       IF screen-name = 'ZT001-TEXT'.

         screen-invisible = 0.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ELSE.

     LOOP AT SCREEN.

       IF screen-name = 'ZT001-TEXT'.

         screen-invisible = 1.

         MODIFY SCREEN.

       ENDIF.

     ENDLOOP.

   ENDIF.

ENDMODULE.

BR

Sumeet

0 Kudos

Hi,

Hope this will help you if you try using name instead of group name,

 

DATA

sycomm type sy-ucomm.
sycomm
= sy-ucomm.

IF sycomm = 'SUBMIT'."FC code for push button
LOOP AT SCREEN.
if screen-name = 'TEXT_FIELD'."Name of that text field
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
else .
LOOP AT SCREEN.
if screen-name = 'TEXT_FIELD'."Name of that text field
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF

.

that text field will be disable(wont display) when you execute it, When you click on submit button that text field will be displayed.

Former Member
0 Kudos

Hi,

If you are using group make sure for both fields u give same group name, and make sure in which box you are giving group name among 4 boxes in screen field properties. in below example i have used one text field & one IO field which i grouped under GR1(in 1st box). so I have used screen-group1 = 'GR1'. whatever attributes you are grouping under that particular group will be disabled.

 

IF sycomm = 'SUBMIT'.
LOOP AT SCREEN.
if screen-group1 = 'GR1'.

screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
else .
LOOP AT SCREEN.
if screen-group1 = 'GR1'.

screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF

.

When you actually execute this code.. only you can see submit push button.. when you click on submit it will display both text field & IO field.

Hope this will solve your issue.

Former Member
0 Kudos

Thankyou all  if i take text field it is not disabling even though both group1 names are same  so i take both as I/O field and i think its working fine.

0 Kudos

Can you please  close the thread?