03-21-2007 8:55 AM
Hello ,
i want to remove trailing zeros for a prticular value.Following is my code :
DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
V_CHAR(25) ,
P10_4(10) TYPE P DECIMALS 4.
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
FLOAT_IMP = V_FLOAT
FORMAT_IMP = P10_4
ROUND_IMP = ' '
IMPORTING
CHAR_EXP = V_CHAR.
SHIFT V_CHAR RIGHT DELETING TRAILING '0'.
WRITE : V_CHAR ."NO-ZERO.
<u><b>Output:</b></u>
if we pass the value '1.3000000000000000E+01' it should be 13.0
ex2: '1.3400000000000000E+01' it should be 13.4
ex3:'4.8240000000000000E+03' it should be 4824
is there any way to get the solution without functional module. If so Please tell me with code.
03-21-2007 9:02 AM
Hi Vikram,
I can suggest you a method of using the FM given below.
Please use FM
CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal
CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external
Hope this resolves your query.
Reward all the helpful answers.
Regards
03-21-2007 9:02 AM
Hi Vikram,
I can suggest you a method of using the FM given below.
Please use FM
CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal
CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external
Hope this resolves your query.
Reward all the helpful answers.
Regards
03-21-2007 9:03 AM
CONVERSION_EXIT_ALPHA_OUTPUT - converts any number with zeroes-right into a simple integer
example:
input = 00000000000123
output = 123
09-23-2010 5:16 AM
This FM does not work. It only works on Integer types and if you want to remove the padding or leading zeros in case of vendor number etc.
03-21-2007 9:04 AM
hi
u can do it in number of ways.
Use TCODE SU3
Select default tab and select radio button 123467.89 in decimal notation and save it.
or u can try :
if you want to do this through ABAP program.
1. to delete trailing spaces.
SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.
to delete leading zeroes,
SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.
only for one abap program, u can use set country command
for all programs :
sap menu>system->go to user profil->own data>default --> and choose ur format.
hope this helps u.
Regards,
Prasanth
Reward all hepful replies
03-21-2007 9:08 AM
Hi Vikram,
This code will meet your requirement
data:
w_char(45) type c ,
w_float type f ,
w_int type i .
w_char = '4.8240000000000000E+03'.
w_float = w_char .
w_int = w_float .
write :
w_float ,
/ w_int .
03-21-2007 9:15 AM
TAKE TRHIS FLOAT VALUE TO TYPE P DECIMALS 1 VARIABLE...
DATA : VARP TYPE P DECIMALS 1.
VARP = <YOUR FLOAT>.
WRITE : / VARP.
REGARDS
SHIBA DUTTA
03-21-2007 9:15 AM
Hi,
You can use as below.
WRITE: V_FLOAT EXPONENT 0 DECIMALS 0 TO V_FLOAT.
It will get you the desired output.
Regards,
Ram
Pls reward points if helpful
03-21-2007 9:16 AM
hi vikram,
try this..
REPORT YCHATEST.
DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
V_CHAR type p decimals 2
.
V_CHAR = V_FLOAT.
WRITE : V_CHAR.
09-24-2010 7:47 AM
DATA: V_FLOAT TYPE F VALUE '1.3400000000000000E+01',
V_CHAR(25) ,
P10_4(10) TYPE P DECIMALS 1.
CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
EXPORTING
FLOAT_IMP = V_FLOAT
FORMAT_IMP = P10_4
ROUND_IMP = ' '
IMPORTING
CHAR_EXP = V_CHAR.
shift V_CHAR right deleting trailing ' '.
shift V_CHAR right deleting trailing '0'.
shift V_CHAR right deleting trailing ','.
WRITE : V_CHAR ."NO-ZERO.
06-27-2022 2:34 PM