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

Syntax

Former Member
0 Likes
562

Hi Gurus,

I have a condition where I need to check if V_lowv_high < v_lowv_med then don't proceed else

write " we can proceed"

else

we need to stop processing

Can you please help me how to write the "else" part

Tahnks

Rajeev Gupta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
535

data : lv_value1 type i,

lv_value2 type i.

lv_value1 = v_low + v_high.

lv_value2 = v_low + v_med.

if lv_value1 < lv_value2.

proceed.

else.

<b>stop.</b> " this will take you out or program

endif.

3 REPLIES 3
Read only

Former Member
0 Likes
536

data : lv_value1 type i,

lv_value2 type i.

lv_value1 = v_low + v_high.

lv_value2 = v_low + v_med.

if lv_value1 < lv_value2.

proceed.

else.

<b>stop.</b> " this will take you out or program

endif.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
535
 if V_low+v_high < v_low+v_med.
  message e001(00) with 'Hey, you can't proceed'.
 else.
  write:/ 'You can proceed'.
 endif.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
535

Hi Rajeev,

You can't use expressions in the conditions for IF...ENDIF. It only allows values to compare rather than expressions, so you need to get the value of expression and the have condition among values.

DATA:

VALUE1 TYPE I,

VALUE2 TYPE I.

VALUE1 = V_LOW + V_HIGH.

VALUE2 = V_LOW + V_MED.

write " we can proceed".

IF VALUE1 < VALUE2.

write " we can not proceed".

ELSE.

ENDIF.

In your case as you are adding V_LOW to both left hand and right hand, so you can this and write a simple conidtion as

IF V_HIGH < V_MED.

write " we can proceed".

ELSE.

write " we can not proceed".

ENDIF.

Thanks,

Vinay