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

Negative sign to type P variable

Former Member
0 Likes
2,943

I have a variable with type P

I need to prefix a negative sign to the variable, how can this be done.

1 ACCEPTED SOLUTION
Read only

Former Member
1,702

Hi,

Do like this,,,


data ll type p decimals 2.

ll = '222.33'.
ll = - ll.

           .
 write ll.

and to get this '-' sign in front try like this..


data : ll type p decimals 2,
       l(20) .

ll = '222.33'.
ll = - ll.
l = ll.
 CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
   CHANGING
     value         = l
           .
 write l.

Regards

Debarshi

I have a variable with type P

I need to prefix a negative sign to the variable, how can this be done.

5 REPLIES 5
Read only

Former Member
0 Likes
1,702

Hi,

This can be done if you transfer the variable to a character type variable and concatenate '-' sign before it.

Regards

sandipan

Read only

Former Member
0 Likes
1,702

Hi,

Please refer the below thread(s),

Best Regards.

Read only

Former Member
0 Likes
1,702

Hi,

Please refer the below thread:

Regards,

Nitin.

Read only

Former Member
1,703

Hi,

Do like this,,,


data ll type p decimals 2.

ll = '222.33'.
ll = - ll.

           .
 write ll.

and to get this '-' sign in front try like this..


data : ll type p decimals 2,
       l(20) .

ll = '222.33'.
ll = - ll.
l = ll.
 CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
   CHANGING
     value         = l
           .
 write l.

Regards

Debarshi

Read only

Former Member
0 Likes
1,702

REPORT ZSRK_074 .

DATA : L_AMT(16) TYPE P DECIMALS 2,

L_AMTC(16).

L_AMT = '-18.50'.

MOVE L_AMT TO L_AMTC.

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'

CHANGING

VALUE = L_AMTC.

WRITE : / L_AMTC.