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: 

Negaive Amount

adnanmaqbool
Contributor
0 Kudos

Dear All

I am facing a strange issue first time. I have data type

like

DATA: AMT LIKE BSEG-NETWR.

AMT = 232323.233-

Figure in variable AMT is in negative.

But when i use Write statement to print it on list negative sign is not appearing.

Write:\ AMT.

I also tried AMT = AMT * -1.

But not working.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Please try this ..

DATA :v_data TYPE p DECIMALS 2,

l_str TYPE string,

l_str1 TYPE string,

l_str2 TYPE string.

v_data = '-300'.

l_str = v_data.

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'

CHANGING

value = l_str.

MOVE l_str to v_data.

SPLIT l_str at '.' INTO l_str1 l_str2.

WRITE: / l_str1.

Regards,

Murali

7 REPLIES 7

Former Member
0 Kudos

change the logic so that by using CONCATENATE statement u can populate -ve sign for the particular value in the output.

adnanmaqbool
Contributor
0 Kudos

Yes that is possible but my question is whats wrong with write statement. Because Write prints a negative amount in negative there is no need for any further logic.

I don't know whats wrong in my case.

former_member585060
Active Contributor
0 Kudos

Change the sign to front and see,

DATA : amt LIKE bseg-netwr.

amt = -232323.233.

WRITE 😕 amt.

Refer this document

http://help.sap.com/saphelp_nw04/Helpdata/EN/9f/db9e2335c111d1829f0000e829fbfe/content.htm

Former Member
0 Kudos

hi ,

try with any other fields of BSEG , like WRBTR.

regards

Prabhu

Former Member
0 Kudos

u can try it out with changing the data type ..

Try this ..

data : dmbtr type wertv8.

wertv8 data type can have +/- sign also .

Hope this will help u to solve ur problem .

Former Member
0 Kudos

Hi,

check your variable length.

if it is sufficient...then try to concatenate the value into that variable and display it. it will solve your problem.

Regards,

venkat.

Former Member
0 Kudos

Hi,

Please try this ..

DATA :v_data TYPE p DECIMALS 2,

l_str TYPE string,

l_str1 TYPE string,

l_str2 TYPE string.

v_data = '-300'.

l_str = v_data.

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'

CHANGING

value = l_str.

MOVE l_str to v_data.

SPLIT l_str at '.' INTO l_str1 l_str2.

WRITE: / l_str1.

Regards,

Murali