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: 

Disable a field in selection screen

Former Member
0 Kudos

Hi,

I have a field in the selection screen and currently i am disabling in the code like:

loop at screen.

if screen-name = 'V_GROUP'.

screen-input = 0.

modify screen.

endif.

endloop.

my problem is that if i choose a variant and if it has a value for group then it

overwrites it.

is there any way where i can avoid it?

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, I believe that you can check for the variant, then clear it out. Check against sy-slset. This will hold the variant name if one is being used.

report zrich_0003 .



parameters: p_check type c.
parameters: p_group type c.



at selection-screen output.

  loop at screen.
    if screen-name = 'P_GROUP'.
     screen-input = '0'.
      modify screen.
    endif.
  endloop.

start-of-selection.

  if sy-slset <> space.
    clear p_group.
  endif.

Regards,

Rich Heilman

6 REPLIES 6

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, I believe that you can check for the variant, then clear it out. Check against sy-slset. This will hold the variant name if one is being used.

report zrich_0003 .



parameters: p_check type c.
parameters: p_group type c.



at selection-screen output.

  loop at screen.
    if screen-name = 'P_GROUP'.
     screen-input = '0'.
      modify screen.
    endif.
  endloop.

start-of-selection.

  if sy-slset <> space.
    clear p_group.
  endif.

Regards,

Rich Heilman

0 Kudos

Hi Rich,

But i might have some multiples of Variants.They can create any variants .

0 Kudos

Yea, you problem is that you never want V_GROUP to have a value when a variant is chosen, right? So, if not, then you can clear it out if a variant is chosen. I am a little confused as to your requirement, since the field is output only and you don't want a variant to overwrite it, then what is the point in having it as a parameters. Please explain further so that we can help you.

Regards,

Rich Heilman

Former Member
0 Kudos

If you don't want to enter anything into this parameter, but you still want it, then why don't you use the option 'NO-DISPLAY' ?

Srinivas

Former Member
0 Kudos

Seems your variant were existing and later you changed the program as you cannot put a value in a variant in an input disabled field.

The solution is to recreate the variant or first change the variant and then change the program.

Cheers

0 Kudos

Hi Rich,

Thanks for the solution. I did use at selection screen output. It works now.

Thanks to Srinivas and Sanjay also.

I did award the points.

Thanks.