2006 Dec 18 10:13 AM
Hi everybody,
<b>This is the problem:</b>
I need to display quantities with 3 decimals.
This works fine, but only if there are decimal values:
(123.001) but not, if the figure is zero or doesn't have any decimals.
(123 or 0)
But the customer wants to get the figures shown as follows:
123.000
123.001
0.000
<b>REMARK:</b>
If I use FM: call function 'REUSE_ALV_GRID_DISPLAY' it works fine!
<b>These are my settings:</b>
The field <BTGEW> is defined as quantity.
LOOP AT ct_fcat INTO ls_fcat.
ls_fcat-edit = false.
CASE ls_fcat-fieldname.
WHEN 'BTGEW' .
ls_fcat-decimals_o = 3.
ls_fcat-no_zero = false.
ls_fcat-outputlen = '15'.
ls_fcat-do_sum = true.
ls_fcat-qfieldname = 'GEWEI'.
ls_fcat-tabname = 'ZWIT02_AUS_LFK_CNTRL'.
clear: ls_fcat-tabname,
ls_fcat-qfieldname.
ls_fcat-datatype = 'DEC'.
ls_fcat-edit_mask = '____________,___'.
</b>
Thanks a lot in advance for your help
Michael<b></b>
2006 Dec 18 10:41 AM
Hi,
You can create a Coversion exit of your own , an try adding that to
ls_fcat-convexit.
Regards,
2006 Dec 18 10:41 AM
Hi,
You can create a Coversion exit of your own , an try adding that to
ls_fcat-convexit.
Regards,
2006 Dec 18 11:03 AM
Hi sreejesh,
Thanks a lot for your reply.
But in fact this way was not necessary but a very good idea!
<b>Funnywise this solution works:</b>
Do not define the field as quantity, define it as DEC 15:3
And now the most important point:
Define the properties of the column as follows:
ls_fcat-decimals_o = 3.
ls_fcat-no_zero = false.
ls_fcat-datatype = 'DEC'.
ls_fcat-outputlen = '15'.
ls_fcat-do_sum = true.
*:--- This is the point! >>>
clear: ls_fcat-tabname,
ls_fcat-qfieldname.
*:--- <<<<
I have rewarded you some points
BR
Michael
2006 Dec 18 10:57 AM
Hi
Why dont you define your decimals field as type p decimals 3 and then pass the value to a field of type char when you are passing it to the ALv.
this should solve your problem.
Also check out this link
http://help.sap.com/saphelp_erp2004/helpdata/en/ff/4649baf17411d2b486006094192fe3/content.htm
2006 Dec 18 11:10 AM
Hi Dominic,
This is exactly what i have done first.
But it didn't work as i expected.
Now I found out why:
Additionally to these properties you must clear all field-references, so the parser
will take the field-Type as it is.
ls_fcat-decimals_o = 3.
ls_fcat-no_zero = false.
ls_fcat-datatype = 'DEC'.
ls_fcat-outputlen = '15'.
*:--- AND CLEAR ALL TABLE-REFERENCES!
clear: ls_fcat-tabname,
ls_fcat-qfieldname.
This is the point.
If you don't do this, it won't work.
BR
Michael
2006 Dec 18 12:45 PM
The solution is:
ls_fcat-decimals_o = 3.
ls_fcat-no_zero = false.
ls_fcat-datatype = 'DEC'.
ls_fcat-outputlen = '15'.
*:--- AND CLEAR ALL TABLE-REFERENCES!
clear: ls_fcat-tabname,
ls_fcat-qfieldname.