04-25-2011 3:26 PM
Hi.
I'd like to know how to format fields of a dynamic ALV grid.
Today, in this column is coming values like:
599998900.00-
1000.00-
2000.00-
I'd like to format it like (Brazil's region number format):
599.998.900,00-
1.000,00-
2.000,00-
In fieldcat logic I'm using ls_fieldcat-datatype = 'CURR'.
I tryied to use these fields in fieldcat, but as this ALV is dynamic, I haven't any table to put as reference:
lt_fieldcat-fieldname = 'WAERS'.
lt_fieldcat-ref_tabname = 'BKPF'.
thanks.
Glauco
Edited by: Glauco Kubrusly on Apr 25, 2011 11:28 AM
04-25-2011 3:53 PM
just use a refence in the fieldcatalog...
lt_fieldcat-cfieldname = 'WAERS'. " fieldname for currency
or directly
lt_fieldcat-currency = 'BRL'.
regards, sebastian
04-25-2011 3:44 PM
Hi,
Check the defaults in the SU01 transaction ,check defualts tab-->Decimal Notation change it to your requirement.
Automatically in the alv it will display according to decimal notation.
Prabhud@s
04-25-2011 3:53 PM
just use a refence in the fieldcatalog...
lt_fieldcat-cfieldname = 'WAERS'. " fieldname for currency
or directly
lt_fieldcat-currency = 'BRL'.
regards, sebastian
04-25-2011 4:15 PM
Hi friends.
PrabhuD@s: About your hint: SU01 is all right.
Sebastisn: Your hint didn't work. I've tryied both of them.
I haven't much experience yet in dynamic ALV and always need to give reference table until today.
Do you think there is another parameter to use ? If all them don't work, how people that use dynamic get it right ?
thanks in advance.
Gauco
04-25-2011 4:38 PM
just try to complete fieldname and currency in your fieldcat witout any other reference....that sould work
lt_fieldcat-fieldname = 'YOURFIELDNAME'.
lt_fieldcat-currency = 'BRL'.
04-25-2011 5:20 PM
Hi Sebastian.
All time I fill currency=BRL, text alignment become right:
lt_fieldcat-currency = 'BRL'.
When I fill only this, at least alignment become left correctly.
lt_fieldcat-fieldname = "my_column".
lt_fieldcat-datatype = 'CURR'.
BUT, never apears thousands separators. In case of Brazil, it would be "." to separate thousands and "," to separate decimals.
Any other idea ? Why this not work ?
thanks.
Glauco
04-25-2011 5:39 PM
hi,
as u have told tht DATATYPE = 'CURR' is not working then comment it and try to use
lt_fieldcat-INTTYPE = 'P'
lt_fieldcat-INTLEN = '13'.
lt_fieldcat-DECIMALS = '2'.
hope it might solve your problem...
04-25-2011 6:18 PM
is there any posibility that the field you are trying to format is CHAR type?
how are you creating the dynamic table?
I have this field in a dynamic table and works fine:
" field for dynamic table
comp-name = 'ZFIELD'.
comp-type = cl_abap_elemdescr=>get_p( p_length = 11 p_decimals = 2 ).
APPEND comp TO comp_tab.
" field for catalog
CLEAR wa_catalog.
wa_catalog-fieldname = 'ZFIELD'.
wa_catalog-ref_table = 'ZTABLE'.
wa_catalog-cfieldname = 'WAERS'.
APPEND wa_catalog TO gt_catalog.
Regards, Sebastian
04-25-2011 6:29 PM
Hi Sebastian.
It works fine now. Tank you very much.
This tip worked very well!
" field for catalog
CLEAR wa_catalog.
wa_catalog-fieldname = 'ZFIELD'.
wa_catalog-ref_table = 'ZTABLE'.
wa_catalog-cfieldname = 'WAERS'.
APPEND wa_catalog TO gt_catalog.
Glauco
Edited by: Glauco Kubrusly on Apr 25, 2011 6:18 PM
Edited by: Glauco Kubrusly on Apr 25, 2011 6:20 PM