12-21-2007 11:31 AM
Hi All,
I am facing one problem when i am displaying a negative number in output.I have a number 123,567,90.89-.They want the sign should be on left-side.I did that shifting the sign to left by passing that value into one string type variable.But when i copied the value into string symbol ',' is ommiting and the value is getting stored as '12356790.89-',But i have to display the value in such a way that sign should be in left-side and it should be in number format.i.e,
-123,567,90.89.
Please give me a solution to resolve this problem..
With Regards,
R.P.Sastry
12-21-2007 11:48 AM
try this...
DATA: amount(16) TYPE P DECIMALS 3 VALUE '345435455.45-',
c_amount(16).
WRITE amount TO c_amount NO-SIGN.
IF amount < 0.
CONCATENATE '-'
c_amount
INTO c_amount.
CONDENSE c_amount NO-GAPS.
ENDIF.
WRITE c_amount.
12-21-2007 11:38 AM
after moving the data into string you need to put the ',' manually into the string
12-21-2007 11:48 AM
try this...
DATA: amount(16) TYPE P DECIMALS 3 VALUE '345435455.45-',
c_amount(16).
WRITE amount TO c_amount NO-SIGN.
IF amount < 0.
CONCATENATE '-'
c_amount
INTO c_amount.
CONDENSE c_amount NO-GAPS.
ENDIF.
WRITE c_amount.
12-21-2007 11:54 AM
Hello,
You can try:
G_NUM_TEMP TYPE P DECIMALS 2
G_S_IMP_MOM TYPE /GEX/255 --> CHAR of 255
G_NUM_TEMP contains: 123,567,90.89-
WRITE G_NUM_TEMP TO G_S_IMP_MOM LEFT-JUSTIFIED.
"LEFT-JUSTIFIED is for respecting the final - and doing the write correctly.
"NO GROUPING is used to avoid the separation for thousands, so here it is no used.
In G_S_IMP_MOM string you should have the value separated correctly, then do the process to have the - sign at the beginning of the string.
I hope it will help you.
12-21-2007 12:52 PM
Hi Parayya,
Check this function module. It gives u some help.
CLOI_PUT_SIGN_IN_FRONT
Regards
Manoj Kumar