2005 Nov 02 8:26 PM
I want to convert the amount to its equivalent internal format..
For example, my amount may 200,000.000USD.. I want to get its equivalent internal format.. Is there a FM to do this?
i GUESS i can use this FM , CURRENCY_AMOUNT_DISPLAY_TO_SAP..but this FM requires my input in DEC11_4 format.. how do I handle the amount that i have in character format or with decimal places more than 4 ?
Please confirm
I want to convert the amount to its equivalent internal format..
For example, my amount may 200,000.000USD.. I want to get its equivalent internal format.. Is there a FM to do this?
i GUESS i can use this FM , CURRENCY_AMOUNT_DISPLAY_TO_SAP..but this FM requires my input in DEC11_4 format.. how do I handle the amount that i have in character format or with decimal places more than 4 ?
Please confirm
2005 Nov 02 8:35 PM
2005 Nov 02 8:42 PM
I had thought of replace, but was hoping SAP would have something more fancy!!!
2005 Nov 02 8:48 PM
2005 Nov 02 8:49 PM
Srini, Rich Thanx.. How does it handle the '-' sign?
Do we need to do anything special?
Also what is the easiest way to validate if my 'character number field' is actually a valid number (i am allowing -,' ', ',', '.')..
2005 Nov 02 8:53 PM
2005 Nov 02 9:02 PM
You can do something like this.
report zrich_0001.
data: amount(50) type c value '200,abc,123.000'.
data: length type i.
shift amount left deleting leading space.
length = strlen( amount ).
if amount+0(length) co '1234567890,.'.
write:/ 'Looks ok to me'.
else.
write:/ 'Hey, this is not a number'.
endif.
Regards,
Rich Heilman
2005 Nov 02 9:06 PM
Rich, my primary concern is that ',' or '.' can be used interchangeably in display mode... So how do i convert my truely display format to internal format?
For example, a user may have a display notation of 1.234.567,89 ... How can I convert that to the internal format? If my input amount is 1.234.567,89, when I send it to SAP, it should go as 1234567.89 right? Now if i do string manipulation, then I have to know the user's display property..
2005 Nov 02 9:17 PM
You can do something like this.
report zrich_0001.
data: amount(15) type c value '200,000,000.000'.
data: xusr01 type usr01.
select single * from usr01 into xusr01
where bname = sy-uname.
case xusr01-dcpfm.
when 'X'.
translate amount using ', '.
when ' '.
translate amount using '. '.
translate amount using ',.'.
when 'Y'.
translate amount using ',.'.
endcase.
condense amount no-gaps.
write:/ amount.
Regards,
Rich Heilman
2005 Nov 02 8:40 PM
Amounts are controlled by the currency key for the number of decimal places. In the table itself they may be stored with any number of decimal places, but once you select them, they will have the right number of decimals. So always select both the amount and the currency key fields.
Now if you are asking about just removing the formatting characters from an amount that is in a character field, then you can do as follows
SHIFT mycharfield LEFT DELETING LEADING SPACE.
TRANSLATE mycharfield USING ', '.
CONDENSE mycharfield NO-GAPS.
Srinivas
2007 Jul 26 1:05 PM
try Set Country command after assigning values.
e.g.: SET COUNTRY 'US'.
Reward if helpful