‎2007 Apr 15 9:48 AM
I have the following numbers say for eg.
66.66666667
68.72000000
80.00000000
80.00000000
75.19055000
I want to output them like
66.66666667
68.72
80
80
75.19055
Is there a way to achieve this.
Kind help is much appreciated.
Thanks & regards
‎2007 Apr 16 7:12 AM
first take the no to a char field..here i am taking text as an example.
data : bef(7),
aft(7),
text(14) type c value '66.66666667'.
split text at '.' into bef aft.
shift aft right deleting trailing '0'.
shift aft left deleting leading space.
clear text.
concatenate bef aft into text separated by '.'.
regards
shiba dutta
‎2007 Apr 15 10:26 AM
Hello ,
Try the following funtion modules provided by SAP
BKK_DELETE_LEADING_ZERO
FTR_CORR_SWIFT_DELETE_ENDZERO
Or make use of the following code :
SHIFT <Variable name> RIGHT DELETING TRAILING '00'.
Regards,
Sowmya.
‎2007 Apr 16 6:44 AM
There is a number of ways to do this.
report zrich_0001.
data: matnr type mara-matnr value '000000000000001111'.
This is one way
shift matnr left deleting leading '0'.
Here is another
matnr = '000000000000001111'.
call function 'CONVERSION_EXIT_MATN1_OUTPUT'
exporting
input = matnr
importing
output = matnr.
check sy-subrc = 0.
‎2007 Apr 16 6:45 AM
Hi Sam,
To remove leading zeros and leading blanks
Please use FM
CONVERSION_EXIT_ALPHA_INPUT Conversion exit ALPHA, external->internal
CONVERSION_EXIT_ALPHA_OUTPUT Conversion exit ALPHA, internal->external
For ex :
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = wf_version
IMPORTING
output = wf_version.
Example:
input = 123
output = 0000000000000...000000000000123
Hope this resolves your query.
Reward all the helpful answers.
Regards
‎2007 Apr 16 7:05 AM
hi
<b>WRITE <variable having value with zeros> DECIMALS 0.</b>
hope this will solve ur problem
regards
ravish
<b>plz reward points if helpful</b>
‎2007 Apr 16 7:12 AM
first take the no to a char field..here i am taking text as an example.
data : bef(7),
aft(7),
text(14) type c value '66.66666667'.
split text at '.' into bef aft.
shift aft right deleting trailing '0'.
shift aft left deleting leading space.
clear text.
concatenate bef aft into text separated by '.'.
regards
shiba dutta
‎2007 Apr 16 8:03 AM
Thanks all for your support.
I want to share my experience.
there are two ways to achieve the above.
1.
data mipcnt1(12).
mipcnt1 = 75.19055000
CONDENSE mipcnt1.
CALL FUNCTION 'FTR_CORR_SWIFT_DELETE_ENDZERO'
CHANGING
c_value = mipcnt1.
CLEAR: f1, f2.
SPLIT mipcnt1 AT '.' INTO f1 f2.
IF f2 IS INITIAL.
mipcnt1 = f1.
ENDIF.
2.
mipcnt1 = 75.19055000
mipcnt1 = abs( mipcnt1 ).
hope it helps others.