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

OR condition

Former Member
0 Likes
547

Hi all there.

I am writing the

if vbfa_tab-vbtyp_n = 'M' OR 'R' OR '8' OR 'A'.

..........

.....

giving error in OR

pl suggest

Regards

Shashi

4 REPLIES 4
Read only

Former Member
0 Likes
526

Hi

Whats the error.

Anyway by looking at your code , it is in wrong syntax.

Try this.

if vbfa_tab-vbtyp_n = 'M' or if vbfa_tab-vbtyp_n = 'R' OR if vbfa_tab-vbtyp_n = '8 '.

Reward points if helpful

Regards,

Raghu

Read only

Former Member
0 Likes
526

do a

case vbfa_tab-vbtyp_n.

when 'M' OR 'R' OR '8' OR 'A'.

....

endcase.

Read only

Former Member
0 Likes
526

hi sashi !

write like this..,

if vbfa_tab-vbtyp_n = 'M' OR

vbfa_tab-vbtyp_n = 'R' OR

vbfa_tab-vbtyp_n = '8' OR

vbfa_tab-vbtyp_n = 'A'.

or

if this does'nt work out.

then go for elseif

if vbfa_tab-vbtyp_n = 'M' .

.......

.......

elseif vbfa_tab-vbtyp_n = 'R'.

.......

.......

elseif vbfa_tab-vbtyp_n = '8'.

.......

.......

elseif vbfa_tab-vbtyp_n = 'A'.

.......

.......

endif.

if this works ...

rewrd me..!

Thanks & regards,

Rajesh.,

Read only

vinod_vemuru2
Active Contributor
0 Likes
526

Hi shashikanth,

Ur If statement is syntactically wrong. Replace it like below.

IF ( vbfa_tab-vbtyp_n = 'M'

OR vbfa_tab-vbtyp_n = 'R'

OR vbfa_tab-vbtyp_n = '8'

OR vbfa_tab-vbtyp_n = 'A' ).

do some thing.

ENDIF.

Also If u have if elseif elseif else endif. then replace it with case statement.

eg: If u have like below.

IF ( vbfa_tab-vbtyp_n = 'M'

OR vbfa_tab-vbtyp_n = 'R'

OR vbfa_tab-vbtyp_n = '8'

OR vbfa_tab-vbtyp_n = 'A' ).

do some thing.

ELSEIF ( vbfa_tab-vbtyp_n = 'X'

OR vbfa_tab-vbtyp_n = 'Y'

OR vbfa_tab-vbtyp_n = 'Z' ).

do some thing

ELSEIF (vbfa_tab-vbtyp_n = 'C'

OR vbfa_tab-vbtyp_n = 'D'

OR vbfa_tab-vbtyp_n = 'E' )

Do some thing

ELSE.

Do some thing

ENDIF.

Above code can be replaced by CASE statement like below.

Case vbfa-vbtyp_n.

WHEN 'M' OR 'R' OR '8' OR 'A'.

Do some thing.

WHEN 'X' OR 'Y' OR 'Z'.

Do some thing.

WHEN 'C' OR 'D' OR 'E'.

Do some thing.

WHEN OTHERS.

Do some thing.

ENDCASE.

Thanks,

Vinod.