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

how to code this

Former Member
0 Likes
746

Hi Friends:

I've to put a check like this:

if komvd-kbetr is a negative value.

then I've to convert it to a positive value.

Plz suggest me. Points will be rewarded.

REgards:

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
694

Hi,

maybe like this

IF komvd-kbetr < 0.
komvd-kbetr = komvd-kbetr * ( -1 ).
ENDIF.

Regards Rudi

4 REPLIES 4
Read only

Former Member
0 Likes
695

Hi,

maybe like this

IF komvd-kbetr < 0.
komvd-kbetr = komvd-kbetr * ( -1 ).
ENDIF.

Regards Rudi

Read only

Former Member
0 Likes
694

Hi

U can always convert to absolute (so positive) value, in this way u don't need any control:

komvd-kbetr = abs( komvd-kbetr ).

Or u can check if it's negative and so moltiply for -1:

if komvd-kbetr < 0.
  komvd-kbetr  = - komvd-kbetr.
endif. 

Max

Edited by: max bianchi on Jun 6, 2008 5:22 PM

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
694

Try using the ABS

data: lv_value type i value '-10'.

write:/ lv_value.

lv_value = abs( lv_value ).

write:/ lv_value.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
694

hi check this..

parameters:P_int type i.

if p_int lt 0.

p_int = p_int * ( - 1 ).

write:/ p_int .

else.

write:/ p_int.

endif.