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

Validate the range values

former_member194669
Active Contributor
0 Likes
2,046

Hi All,

I have a internal table with the following fields

VAL_LOW , VAL_HIGH

and contains the following values

01 10

25 35

A1 A10

A25 A35

I have selection screen field with value 09 I need to validate this value with above the internal table that the value 09 is in VAL_LOW and VAL_HIGH.

Thanks

aRs.

5 REPLIES 5
Read only

Former Member
0 Likes
1,027

try this...

loop at itab.
 if  p_field ge itab-val_low and
    p_field ge itab-val_high.

  * field is within range
   exit.
 endif.
endloop.

Read only

Former Member
0 Likes
1,027

Dear aRs,

You want to validate --> Event :

AT SELECTION-SCREEN.

  • Populate the Internal Table IT_TAB with the values (01,10), (25,35) ....

  • Validate whether the Selection Screen field (P_FIELD) contains any values in

the IT_TAB.

LOOP AT IT_TAB INTO WA_TAB.

IF P_FIELD GE WA_TAB-VAL_LOW AND

P_FIELD LE WA_TAB-VAL_HIGH.

Message ---> "Present".

ELSE.

Message --> " Not Present ".

ENDIF.

ENDLOOP.

Regards,

Abir

***********************************

  • Don't forget to award Points *

Read only

former_member194669
Active Contributor
0 Likes
1,027

Hi,

Thanks for your replies.

The internal table contains 1.7 million reocrds .

I feel by using loop will have impact in the performance.Is there any way to validate this by not using LOOP statement?

Thanks

aRs

Read only

Former Member
0 Likes
1,027

TYPES: BEGIN OF ty_range,

val_low type i,

val_high type i,

END OF ty_range.

DATA: gt_range type table of ty_range,

wa_range type ty_range.

PARAMETERS: p_num TYPE <....>.

AT-SELECTION-SCREEN.

LOOP AT gt_range INTO wa_range.

IF p_num GT wa_range-val_low AND p_num LT wa_range-val_high.

WRITE: 'Present in Range'.

ELSE.

WRITE: 'Not Present in Range'.

ENDIF.

  • Reward Points if HELPFUL.

Read only

former_member194669
Active Contributor
0 Likes
1,027

Hi Vijay,

Due to bulk volume of data in the internal table I could not able to use LOOP statement for validation purpose.

Thanks

aRs