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: 

how to code this

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi,

maybe like this

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

Regards Rudi

4 REPLIES 4

Former Member
0 Kudos

Hi,

maybe like this

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

Regards Rudi

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

Former Member
0 Kudos

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.