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

abap doubt

Former Member
0 Likes
325

Hi Friends,

I'm new to abap, i've a req where i need to see the sign of a particular field named receivable amt,

its values are : -100, 500, 340, -220

if its a - sign in front it should be assigned to a field named A else assigned to B. i don't need to worry about the values, just the sign. how to do it in abap.

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
310

Just check if its less than 0.



report zrich_0001.

data: a_value type i.
data: b_value type i.

parameters: the_val type i.


if the_val < 0.
  a_value = the_val.
else.
  b_value = the_val.
endif.

write:/ 'A_VALUE', a_value.
write:/ 'B_VALUE', b_value.

Regards,

Rich Heilman

2 REPLIES 2
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
311

Just check if its less than 0.



report zrich_0001.

data: a_value type i.
data: b_value type i.

parameters: the_val type i.


if the_val < 0.
  a_value = the_val.
else.
  b_value = the_val.
endif.

write:/ 'A_VALUE', a_value.
write:/ 'B_VALUE', b_value.

Regards,

Rich Heilman

Read only

0 Likes
310

thanks rich. just checking the value < 0 or not should do it.