07-05-2006 6:30 AM
Hi all,
I am using Spell_amount, in which i am getting the value as 356,586.00.
I need to convert it as 356586.00
Expecting ur reply.
ravi.
07-05-2006 7:18 AM
Hello Ravi,
Consider this code. Just copy and execute it.
REPORT abc.
DATA : spell_amt(15).
spell_amt = '356,586.00'.
WRITE : 'Before Conversion :' ,spell_amt.
TRANSLATE spell_amt USING ', '.
CONDENSE spell_amt NO-GAPS.
WRITE : 'After Conversion :' ,spell_amt.
Regards,
Arun S.
07-05-2006 6:33 AM
Hi Ravi,
Take a characrer variable and replace , with space.
Try as follows.
DATA V_AMOUNT(18).
V_AMOUNT = '356,586.00'.
REPLACE ',' WITH SPACE IN V_AMOUNT.
CONDENSE V_AMOUNT.
Thanks,
Vinay
07-05-2006 6:35 AM
if u want to display it in sap script (form)
than in from write this way..
<b>ex....
&EKPO-MENGE& -
>1,234.560
&EKPO-MENGE(T)& -
>1234.560</b>
andSPELL_AMOUNT is used to convert amounts in words
07-05-2006 6:34 AM
Hi,
SPELL_AMOUNT is used to convert amounts in words, not for omiting commas.
Regards,
Wasim Ahmed
07-05-2006 6:37 AM
Hi,
1. REPLACE ',' WITH SPACE IN <LV_AMT>
2. CONDENSE <LV_AMT>.
Regs,
Venkat Ramanan
07-05-2006 6:42 AM
My field is komk-fkwrt.
In which i need to send the value like 12323.56, without coma to spell_amount.
07-05-2006 6:52 AM
Hi Ravi,
First take a character field of length 18 and move komk-fkwrt value into character field and then replace comma with space and do condense and reassign
Try with this code.
DATA V_AMOUNT(18).
DATA V_FKWRT TYPE KOMK-FKWRT.
V_AMOUNT = KOMK-FKWRT.
REPLACE ',' WITH SPACE IN V_AMOUNT.
CONDENSE V_AMOUNT.
CATCH SYSTEM-EXCEPTIONS ARITHMETIC_ERRORS = 4
OTHERS = 8.
V_FKWRT = V_AMOUNT.
ENDCATCH.
Thanks,
Vinay
07-05-2006 7:06 AM
Hi vinay
Thanks for ur response.
Bur WITH SPACE is showing syntax error.
07-05-2006 7:09 AM
Hi Ravi,
Then try as follows.
REPLACE ',' WITH <b>''</b> IN V_AMOUNT. -->Dont give any space between single quotes.
*CONDENSE V_AMOUNT. --> Comment this statement.
Note: Plz award points to all helpful answers and Close the thread if it is solved.
Thanks,
Vinay
07-05-2006 7:10 AM
07-05-2006 7:31 AM
Ex. Input is 123,232.56
if i convert into type N of 10 , it becoms 0012323256.
how to suppress leading zeros.
07-05-2006 7:37 AM
Hi ravi,
check it its working perfect.
REPORT ZTEST.
DATA: ALPHABET(15) VALUE '0000EFGHIJ'.
SHIFT ALPHABET LEFT DELETING LEADING '0'.
write : alphabet.
07-05-2006 7:38 AM
Hi,
Use FM CONVERSION_EXIT_ALPHA_OUTPUT to remove the leading zero
e.g.
CONVERSION_EXIT_ALPHA_OUTPUT
import
input = 00123
export
output = lv_without_zero.
result lv_without_zero = 123.
Regards,
Sameena
07-05-2006 6:43 AM
Function module SPELL_AMOUNT converts an amount or number into words. It can be used as follows:
1. Convert a number into words
To do this, the transfer parameters LANGUAGE and AMOUNT have to be entered.
2. Convert an amount into words
To do this, the fields LANGUAGE, CURRENCY, and AMOUNT have to be entered.
3. Set the number of places before and after the decimal point for an amount
To do this, the parameters CURRENCY and AMOUNT have to be entered. The LANGUAGE field must be transferred with the value SPACE! This option optimizes the runtime of the function module.
The structure SPELL transfers the converted amounts. The FB enters the number of places before and after the decimal point in the NUMBER and DECIMAL fields, the amount in words in the WORD and DECWORD fields, and the figure in words in the DIGnn fields. The numbers converted into words can be protected by a star or some other FILLER.
07-05-2006 7:18 AM
Hello Ravi,
Consider this code. Just copy and execute it.
REPORT abc.
DATA : spell_amt(15).
spell_amt = '356,586.00'.
WRITE : 'Before Conversion :' ,spell_amt.
TRANSLATE spell_amt USING ', '.
CONDENSE spell_amt NO-GAPS.
WRITE : 'After Conversion :' ,spell_amt.
Regards,
Arun S.
07-05-2006 7:41 AM
Hi Ravi,
Consider this code.
REPORT abc.
DATA : spell_amt(10) TYPE n.
spell_amt = '123,232.56'.
WRITE : 'Before Conversion :' ,spell_amt.
TRANSLATE spell_amt USING ', '.
WRITE spell_amt NO-ZERO NO-GAP TO spell_amt.
WRITE : 'After Conversion :' ,spell_amt.
Regards,
Arun S.