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: 

Ranges Table

Former Member
0 Kudos
135

Hi,

Can i use range table in IF logical expression.

Example,

data: r_persk for p0001-persk.

intialization.

r_persk-sign = 'I'.

r_persk-option = 'EQ'.

r_persk-low = 'DU'.

APPEND r_persk.

r_persk-low = 'DS'.

APPEND r_persk.

r_persk-low = 'DT'.

APPEND r_persk.

Start-of-selection.

If p0001-persk in r_persk.

......

.......

.......

endif.

<b>Is the above logic is equal to the logic below</b>

If p0001-persk = 'DU' or p0001-persk = 'DS' or p0001-persk = 'DT'

.....

.....

.....

Endif.

I have checked but both are not giving same results, the first logic is not working.

Kindly help

Regards,

Kasi S

4 REPLIES 4

Former Member
0 Kudos
78

Hi Kasi,

check this one,

<b>If p0001-persk in ('DU' , 'DS' , 'DT').</b>

Former Member
0 Kudos
78

Hi kasi,

1. Minor mistake

2. Ur code only (slightly modified)

Just copy paste.

3.

REPORT ABC.

TABLES : P0001.

<b>RANGES</b> : R_PERSK FOR P0001-PERSK.

INITIALIZATION.

R_PERSK-SIGN = 'I'.

R_PERSK-OPTION = 'EQ'.

R_PERSK-LOW = 'DU'.

APPEND R_PERSK.

R_PERSK-LOW = 'DS'.

APPEND R_PERSK.

R_PERSK-LOW = 'DT'.

APPEND R_PERSK.

START-OF-SELECTION.

P0001-PERSK = 'DU'.

IF P0001-PERSK IN R_PERSK.

WRITE 😕 '1ST IF OK.'.

ENDIF.

<b> If 'DU' IN R_PERSK OR 'DS' IN R_PERSK OR 'DT' IN R_PERSK.</b> WRITE 😕 '2ND IF OK.'.

ENDIF.

regards,

amit m.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
78

Yes, you can use ranges like that and it should work. THere must be another reason why it is not working. Can you post the complete code?

And yes, as Amit as suggested, it should be a RANGE statement, not a DATA statement.

Regards,

Rich Heilman

0 Kudos
78

Hi Rich,

This is the actual condition check,

<b> If i use this method condition is not satisfied</b>

rp-provide-from-last p0001 space begin_date end_date.

IF p0001-persk IN r_persk AND p0007-schkz = 'NORM' AND p0007-empct GE 100 AND p0007-wostd GE '37.5'.

it_emps-wostd = 35.

ELSEIF p0001-persk IN r_persk AND p0007-schkz = 'NORM' AND p0007-empct < 100 AND p0007-wostd < '37.5'.

it_emps-wostd = p0007-wostd * '0.93333'.

ELSE.

it_emps-wostd = p0007-wostd.

ENDIF.

<b>If i use this method the condition is satisfied and logic is working fine</b>

rp-provide-from-last p0001 space begin_date end_date.

IF p0001-persk = 'DU' or p0001-persk = 'DS' or p0001-persk = 'DT' AND p0007-schkz = 'NORM' AND p0007-empct GE 100 AND p0007-wostd GE '37.5'.

it_emps-wostd = 35.

ELSEIF p0001-persk = 'DU' or p0001-persk = 'DS' or p0001-persk = 'DT' AND p0007-schkz = 'NORM' AND p0007-empct < 100 AND p0007-wostd < '37.5'.

it_emps-wostd = p0007-wostd * '0.93333'.

ELSE.

it_emps-wostd = p0007-wostd.

ENDIF.

Regards,

Kasi S