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: 

negative value

Former Member
0 Kudos

If i declare a variable with type p, is it can store a negative value? Thanks!

5 REPLIES 5

Former Member
0 Kudos

Hi,

Yes.

data v_num type p decimals 2 value '-234.00'.

data v_char(20).

move v_num to v_char.

write:/ v_num.

condense v_char.

write:/ v_char.

  • To put the negative sign before the value use the below function module.

call function 'CLOI_PUT_SIGN_IN_FRONT'

changing

value = v_char.

write:/ v_char.

Message was edited by:

Velangini Showry Maria Kumar Bandanadham

Former Member
0 Kudos

Hi,

Yes, it will store the negative values also.

Thanks,

Sri.

Former Member
0 Kudos

Hi,

It can hold negative values.

Ex :

data : temp type p decimals 2 value '-38.00',

temp1 type i value '12'.

temp1 = temp + temp1.

write : temp, temp1.

Thanks,

Rewards If Helpful.

Former Member
0 Kudos

But i need to display in sapscript. In my sapscript, i use internal-value(C), it can't display the negative value. Thanks

0 Kudos

Hi,

In SAP SCRIPT, we have a special way to print the Signs ...

Left side --> &FIELD(<)&

right side --> &FIELD(>)&

and also check the length of the field.

Thanks,

Reward If Helpful.