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

validating select-options entries

Former Member
0 Likes
4,389

hi

i need to check whether all entries in SELECT-OPTIONS range are valid or not.

*my select-options field is s-pernr as below.

SELECT-OPTIONS: s_pernr FOR pernr-pernr.

*all valid entries from PA0000 table will be selected into pernr_table.

SELECT DISTINCT pernr

FROM pa0000

INTO TABLE pernr_table

WHERE pernr IN s_pernr.

now i have to check all invalid pernr's in s_pernr.

s_pernr contains: 1, 5, 6, 7, 8, 9, 10.

PA0000 contains: 1, 2, 5, 8, 10, 11, 13, 15...

then pernr_table = 1, 5, 8, 10 only.

that means pernr 6, 7, 9 in s_pernr were invalid.

How to fetch these values as s_pernr is SELECT-OPTIONS field and it may have any combination of values.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,054

Hi,

Change the select-options as No-Extension/No-Intervals or else change it to parameter.

Otherwise we cannot validate all values as select options also involved exclusion or ranges.

Regards

Karthik D

9 REPLIES 9
Read only

Former Member
0 Likes
2,054

u have define the select-option.

U know it is struture with SIGN OPTION,HIGH and LOW FIELD.

use FOR ALL ENTRIES for that selction structure.

Read only

Former Member
0 Likes
2,054

Hi Manjari Agrawal,

Use



AT SELECTION-SCREEN.

SELECT DISTINCT pernr
FROM pa0000
INTO TABLE pernr_table
WHERE pernr IN s_pernr.

Compare the value of internal table pernr_table and select-option range..

if not matching then give error message..

Here pernr_table table contains only valid PERNRs... so whatever PERNRs are not matching this criteria will be invalid..

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7

ilesh Nandaniya

Read only

0 Likes
2,054

no.

i have to compare the value of select-option range with those in internal table pernr_table.

and not the vice versa

Read only

0 Likes
2,054

Hi,

You can try either of these.

1. Copy your internal table data into some temporary internal table and try


DELETE it_temp WHERE field NOT IN s_selopt 

This will delete all those data that are not present in s_selopt.

2. Alternatively, write a logic to convert all the data in your select options to some internal table.

Please be mindful of 'I', 'E', 'BT', 'EQ', 'CP'.

Read only

Former Member
0 Likes
2,054

AT SELECTION-SCREEN ON SO_PROM().

perfrom validate_promo.

write ur code in this perform.

hope it solves your problem.

regards,

Abhijit

Read only

Former Member
0 Likes
2,054

Hi,

As far as what i get from your question is, user put multiple values in the LOW field of the select-option and you have to

check all the values entered in the select-option-LOW field.

If this is the case, you can loop at select-option as show :-

1) create an internal table of type


BEGIN OF ty_pernr ,
   sign(1)   TYPE c,
   option(2) TYPE c,
   low       TYPE pa0000-pernr,
   high      TYPE pa0000-pernr,
 END   OF ty_pernr.

2) create workarea of type ty_pernr.


data wa_pernr type ty_pernr.

3) loop at the select-option.


loop at s_pernr into wa_pernr.
    SELECT single pernr
   FROM pa0000
    INTO TABLE pernr_table
    WHERE pernr eq wa_pernr-low.

  if sy-subrc ne 0.
     "give error message.
  endif.
endloop.

Hope this solves ur problem.

Regards,

Bhavesh.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,054

Hello,

Your idea of validating a SELECT-OPTION is flawed if you can maintain ranges i.e., HIGH & LOW values.

You have to restrict the SELECT-OPTION so that user cannot input range values, else i cannot think of any fullproof solution for this

BR,

Suhas

Read only

Former Member
0 Likes
2,055

Hi,

Change the select-options as No-Extension/No-Intervals or else change it to parameter.

Otherwise we cannot validate all values as select options also involved exclusion or ranges.

Regards

Karthik D

Read only

0 Likes
2,054

Instead of using the select statement in loop better to use for all entries and then compare the retrieved data with the input data (selection screen).