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 format a currency value

Former Member
0 Kudos

Hi,

I have an internal table with a field of type cosp-wtg001 (data type CURR length 15). Field works fine (it stores well the value and this sort of things) but when I store internal table into a file (with GUI_DOWNLOAD function) negative values appears with the minus operator at the end of the number. For example:

3400- instead of -3400.

But I need that the operator appears before the value (I need -3400 instead of 3400-).

How can I do this?

thanks in advance

3 REPLIES 3

Former Member
0 Kudos

I answer to myself,

you can use CLOI_PUT_SIGN_IN_FRONT to move sign to the front. But before you must transfer value from a curr type variable to a char variable

best regards

former_member184569
Active Contributor
0 Kudos

Hi Javier,

Use this formatting for your internal table.

data : ws_temp type p decimals 2,

data : begin of i_t_amount1 occurs 0,

- - -

qsshb like bseg-qsshb,

end of i_t_amount1.

data : begin of i_t_amount2 occurs 0,

- - -

qsshb(15) like c,

end of i_t_amount1.

loop at i_t_amount1.

move corresponding it_amount1 to it_amount2.

IF it_amount2-qsshb+15(1) = '-'.

ws_temp = it_amount2-qsshb

ws_temp = ws_temp * -1.

it_amount2-qsshb = ws_temp.

ENDIF.

append i_t_amount2.

endloop.

Download the second internal table.

Check this post if required.

http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649baf17411d2b486006094192fe3/frameset.htm

Hope that helped.

Thanks,

Susmitha

Former Member
0 Kudos

Hi,

Do like this ..

IF (your currency fields) CA '-'.

v_var = your currency field * ( -1 ).

ENDIF.

Cheers,

Bujji