Application Development and Automation 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: 
Read only

selection screen validation

Former Member
0 Likes
434

Hi everybody,

On selection screen i have my select-option for plant WERKS S_WERKS

this has to accept only '1100' and '1700'

both can be in low and high of the select-option

could u help me how to do this

Regards

VC

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
407

I usually don't like doing validations on select-option, but if I have to, then I would start with something like this.



report zrich_0001.

tables: marc.

ranges: r_werks for marc-werks.

select-options: s_werks for marc-werks.

initialization.

  r_werks-sign = 'I'.
  r_werks-option = 'EQ'.
  r_werks-low = '1100'.
  append r_werks.

  r_werks-low = '1700'.
  append r_werks.

at selection-screen.

  loop at s_werks.
    if not s_werks-low in r_werks
      and not s_werks-low is initial.
      message e001(00) with 'Plant not valid'.
    endif.
    if not s_werks-high in r_werks
      and not s_werks-high is initial.
      message e001(00) with 'Plant not valid'.
    endif.

  endloop.

Regards,

Rich Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
408

I usually don't like doing validations on select-option, but if I have to, then I would start with something like this.



report zrich_0001.

tables: marc.

ranges: r_werks for marc-werks.

select-options: s_werks for marc-werks.

initialization.

  r_werks-sign = 'I'.
  r_werks-option = 'EQ'.
  r_werks-low = '1100'.
  append r_werks.

  r_werks-low = '1700'.
  append r_werks.

at selection-screen.

  loop at s_werks.
    if not s_werks-low in r_werks
      and not s_werks-low is initial.
      message e001(00) with 'Plant not valid'.
    endif.
    if not s_werks-high in r_werks
      and not s_werks-high is initial.
      message e001(00) with 'Plant not valid'.
    endif.

  endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
407

Hi Venkatesh,

Use the piece of code under INITIALIZATION event of your report.

<b>INITIALIZATION.

S_WERKS-LOW = '1100'.

S_WERKS-HIGH = '1700'.

S_WERKS-SIGN = 'I'.

S_WERKS-OPTION = 'EQ'.

APPEND S_WERKS.</b>

If you execute your report then you will have 1100 as low value and 1700 as high value for your select option werks.

Thanks,

Vinay