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 and range

Former Member
0 Likes
1,116

hy expert,

the module is MM,

i have a select option: sobkz for mseg-sobkz.

but i want to check that the value the user enter is only

'V', or

'W' or,

'E' or,

'K' or,

'M' or,

'Q' or.

how can i check that the sobkz is in those 6 value (or range of value)?

thank you.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,056

This is a little tricky when checking a range of values, but for single values. You can just loop the select-option and check it in the AT SELECTION-SCREEN event.

AT selection-screen.

 loop at sobkz.
  if sobkz-sign = 'I'  
  and sobkz-option = 'EQ'
  and ( sobkz-low ne  'V'
       or sobkz-low ne  'W'
       or sobkz-low ne  'E
        or sobkz-low ne  'K'
        or sobkz-low ne 'M'
        or sobkz-low ne 'Q' ).

* Give message   .


 endif.
Endloop.

Again, checking the range is tricky, cuz the user could enter 'A' for the low value and 'Z' for the high value, so how would you check it then, right?

Regards,

Rich Heilman

Edited by: Rich Heilman on Jun 8, 2009 12:54 PM

Edited by: Rich Heilman on Jun 8, 2009 12:58 PM

10 REPLIES 10
Read only

former_member194669
Active Contributor
0 Likes
1,056

Please search in this forum with key word

SELECT_OPTIONS_RESTRICT

a®

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,057

This is a little tricky when checking a range of values, but for single values. You can just loop the select-option and check it in the AT SELECTION-SCREEN event.

AT selection-screen.

 loop at sobkz.
  if sobkz-sign = 'I'  
  and sobkz-option = 'EQ'
  and ( sobkz-low ne  'V'
       or sobkz-low ne  'W'
       or sobkz-low ne  'E
        or sobkz-low ne  'K'
        or sobkz-low ne 'M'
        or sobkz-low ne 'Q' ).

* Give message   .


 endif.
Endloop.

Again, checking the range is tricky, cuz the user could enter 'A' for the low value and 'Z' for the high value, so how would you check it then, right?

Regards,

Rich Heilman

Edited by: Rich Heilman on Jun 8, 2009 12:54 PM

Edited by: Rich Heilman on Jun 8, 2009 12:58 PM

Read only

Former Member
0 Likes
1,056

Any way you are referring mseg-sobkz then user will get values which you mentioned only..

Or

you can write your own logic to check entered value


SELECT-OPTIONS: sobkz FOR mseg-sobkz.

AT SELECTION-SCREEN ON sobkz.

  "Here you check values

  IF sobkz NE 'V' OR 
     sobkz NE 'W' OR 
     sobkz NE 'E' OR 
     sobkz NE 'K' OR  
     sobkz NE 'M' OR 
     sobkz NE 'Q' .
    MESSAGE 'Enter valid value' TYPE 'S'.
    LEAVE LIST-PROCESSING.
  ENDIF.

Read only

Former Member
0 Likes
1,056

Hi ,

try this way...


select option: sobkz for mseg-sobkz.


at selction-screen on sobkz.
loop at sobkz.
if sobkz-low   eq 'V'   or
    sobkz-low eq  'W' or
    sobkz-low eq  'E'  or
   sobkz-low  eq  'K'  or
    sobkz-low eq   'M' or
    sobkz-low eq   'Q' .
Else.
  message 'Invalid Entry' type 'E'.
endif.
endloop.

Prabhudas

Read only

SujeetMishra
Active Contributor
0 Likes
1,056

Hello Mr. Andre,

You can try below logic also

IF sobkz CA 'VWEKMQ'.

write your code further

ENDIF.

Have a Nice Day,

Regards,

Sujeet

Read only

Former Member
0 Likes
1,056

Hi,

My suggestion is to create a Z domain with Values V,W,E,K,M,Q and attach that to a Z data element and use that instead of SOBKZ. in select options.

This will solve your problem.

Regards

Karthik D

Read only

0 Likes
1,056

thankx! by using the zdomain i solved my problem.

Read only

Former Member
0 Likes
1,056

Hi,

You can use AT SELECTION SCREEN event will be triggered when the focus is on any of the fields on the selection screen.

Else you can use AT SELECTION SCREEN ON FIELD which will be triggered only when the focus is on that particular field mentioned in field.

Hope this helps..

Regards,

Jayanth G

Read only

Former Member
0 Likes
1,056

You should use check Table T148 of field SOBKZ for validation.

Check the code below...


tables: mseg,T148.

select-options: s_sobkz for mseg-sobkz.


start-of-selection.
  select * from T148
  where sobkz in s_sobkz.
    if not ( T148-sobkz eq 'V' or
       T148-sobkz eq 'W' or
       T148-sobkz eq 'E' or
       T148-sobkz eq 'K' or
       T148-sobkz eq 'M' or
       T148-sobkz eq 'Q' ).
       Message E999(FG) with
       'Please do not give-' T148-sobkz ' in your selection.'.
     endif.
  endselect.

***Write your remaining code here

Read only

Former Member
0 Likes
1,056

thank yall. i've learned a lot!