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

Range value check

former_member194669
Active Contributor
0 Kudos
685

Hi,

I have range (R_SEQUENCE) like the following

SIGN OPTION LOW HIGH

I BT 01 99

I BT 1A 9Z

I BT A1 Z9

I BT AA ZZ

I am using the following code to check the number is within the range.

wa_hts-htser = '0A'

if wa_hts-htser in r_sequence.

append wa_hts to i_hts.

endif.

Here i am getting sub-subrc eq 0.

Actually it should give sy-subrc ne 0 , can please give some info what i am doing wrong?

Thanks

aRs

11 REPLIES 11
Read only

Former Member
0 Kudos
647

is it like this.....

wa_hts-htser = '0A' 
if wa_hts-htser in r_sequence. 
IF SY-SUBRC NE 0.
append wa_hts to i_hts. 
ENDIF.
endif.

Read only

former_member194669
Active Contributor
0 Kudos
647

Hi,

My question is OA number is not in the range . In that case how it is giving me sy-subrc eq 0?

Thanks

aRs

Read only

0 Kudos
647

I think it is considering OA in ur last option i.e AA to ZZ,

OA will be in that range , AA AB AC ..... OA OB OC.......ZA ZB....

Read only

0 Kudos
647

The 'IF' statement doesn't set sy-subrc. It remains as it was before the statement.

Rob

Read only

Former Member
0 Kudos
647

'0A' is probabily between '01' AND '99'

You have to redefine your range :

SIGN OPTION LOW HIGH

I BT 01 09

I BT 10 9Z

I BT A1 ZZ

I'm not sure of what you want to do, but this may help.

Regards,

Mathieu

Read only

former_member194669
Active Contributor
0 Kudos
647

Rob,

Can you please how to check a number is within the range?

Thanks

aRs

Read only

0 Kudos
647

Your original 'IF' statement does that correctly. If it doesn't behave the way you expect, it's probably because you are mixing nunbers and characters. Try to avoid that.

Rob

Read only

former_member194669
Active Contributor
0 Kudos
647

Chandra,

The number mentioned here is 0A (it zero A and not OA)

Thanks

aRs

Read only

Former Member
0 Kudos
647

Correct me, but you are trying to detect 0 ...

FIND '0' IN wa_hts-htser.

If sy-subrc = 0.

....

endif.

Mathieu

Read only

ferry_lianto
Active Contributor
0 Kudos
647

Hi,

'0A' is between '01' and '99'. Therefore SY-SUBRC = 0.

How do you define the range? Is it CHAR02 or NUM02?

Please check this.

REPORT ZZFL_TEST07.
                                                                        
TABLES: FIMSG.
                                                                        
RANGES: R_CHAR FOR FIMSG-MSGPR.
                                                                        
DATA: WA_CHAR LIKE FIMSG-MSGPR.
                                                                        
R_CHAR-SIGN = 'I'.
R_CHAR-OPTION = 'BT'.
R_CHAR-LOW = '01'.
R_CHAR-HIGH = '99'.
APPEND R_CHAR.
                                                                        
WA_CHAR = '0A'.
                                                                        
IF WA_CHAR IN R_CHAR.
  WRITE: / 'True'.
ELSE.
  WRITE: / 'False'.
ENDIF.

Regards,

Ferry Lianto

Read only

former_member194669
Active Contributor
0 Kudos
647

Hi,

I have mentioned the field as CHAR 02

I think it is considering 0A within the range of 01 to 99. But in SE11 for that table field i have enterd 01 to 99 it is not given me the values of 0A to 0Z

This looking strange to me.

Thanks

aRs