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: 

Hide input fields,text labels based on selection of a value in list box.

0 Kudos

Hi,

I am new to Screen programming, I have a list box with a set of values. if a user selects a value based on that the text labels & input fields need to be shown. Is there any sample program or snippet available for doing this? Also while designing screen how do i add the text labels & input fields at the same area, the reason i ask this is, they will be dynammically set to visible/not visible at run time. so they need to be shown in the same area/position in the screen, i tried adding a text label on top of the existing text field it is not allowing.

Regards,

Deepak

1 ACCEPTED SOLUTION

surajarafath
Contributor
0 Kudos

If you dont want to use screen-group

then use

IF SCREEN-NAME = 'YOUR_FIELD_NAME'.
SCREEN-INPUT = 0.
SCREEN-INVISIBLE = 1.
MODIFY SCREEN.
ENDIF

You should give INPUT = 0. if it is a screen input field

5 REPLIES 5

Former Member
0 Kudos

Hi,

First add the required text lables and input fileds in screen and assign screen groups to them. Also add Function Code to List Box.

Now Initially hide the text lables and input fields. For this in PBO,

loop at screen.

if screen-group1 = 'SC1' " SC1 is the group u assigned to text lables and input fields

if flag is initial.

screen-active = 0.

else.

screen-active = 1.

endif.

modify screen.

endloop.

Now in PAI.,

ok_code = sy-ucomm.

if ok_code = 'SEL'. " SEL is the Funtion code you assigned to List Box

" based on the valus in list box you can set the flag and based on flag you can enable the ui elements from screen group

flg = 'X'.

endif.

hope this helps u.,

Thanks & Regards,

Kiran

0 Kudos

Hi,

How do I assign the input box & text label to a Screen Group, i tried looking for it in the screen designer but did not find it there,

do we do it in the code?

Regards,

Deepak

0 Kudos

Hi,

Kiran is right. The groups can be found in the screen painter attributes panel (double click on your field to see it on the right side of the screen)...

Kr,

Manu.

surajarafath
Contributor
0 Kudos

If you dont want to use screen-group

then use

IF SCREEN-NAME = 'YOUR_FIELD_NAME'.
SCREEN-INPUT = 0.
SCREEN-INVISIBLE = 1.
MODIFY SCREEN.
ENDIF

You should give INPUT = 0. if it is a screen input field

0 Kudos

And you dont want to give text to same text field/input field...

for example: if three input field is in a box..

DOCUMENT NUMBER : [WF_DOC]

DOCUMENT TYPE : [WF_TYPE]

DOCUMENT DATE : [WF_DATE]

If you want to show only Document Number for some of your selection from list box,

you can make like

LOOP AT SCREEN.
IF SCREEN-NAME = 'WF_DOC'.
SCREEN-INPUT = 0.
SCREEN-INVISIBLE = 1.
MODIFY SCREEN.
ENDIF
ENDLOOP.

and if you want to display only the Document type you use the similar code,

the screen will adjust to show only document type, it will not be misplaced

the above code will only hide the input field "WF_DOC" but not the "DOCUMENT NUMBER' text

for that you assign the text and input field as one group in screen painter

and implement the same logic by

SCREEN-GROUP1 = 'GR1'.