cancel
Showing results for 
Search instead for 
Did you mean: 

Format fields in ALV grid

0 Kudos

I have a Web Dynpro application with an ALV Grid. One of the fields has a dictionary object with three decimals. I want to display this field only with 2 decimals. How can I format this field?

Another field is NUMC(10). When there is no code entered you will see all zeroes '0000000000' in the cells. Can I format this to display nothing. I want to surpress (leading) zeroes.

Accepted Solutions (1)

Accepted Solutions (1)

Yashpal
Active Contributor
0 Kudos

Hi ,

for suppressing the zeroes u can use this method in wddoinit of view or comp for the node attribute....

DATA: lo_nd_name TYPE REF TO if_wd_context_node,

lo_nd_info type ref to if_wd_context_node_info

.

DATA : ls_properties TYPE wdy_attribute_format_prop.

lo_nd_name = wd_context->get_child_node( name = 'node name' ).

lo_node_info = lo_nd_name->get_node_info( ).

ls_properties-null_as_blank = 'X'.

ls_properties-sign_pos = if_wd_context_node_info=>c_format_signpos_left .

lr_node_info->set_attribute_format_props( EXPORTING name = 'attribute name' format_properties = ls_properties ).

for suppressing the trailing zeroes there is no way in wd-abap

workaround is to use datatype of 2 decimal.

Regards

Yash

0 Kudos

Thank you. The most important one is fixed. The one with the number of decimals can be fixed with the other datatype. However I would like to fix this with cell formatting. For now I will change status to 'Answered'. May I post another message for the other problem again.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

to supress the leading zeros u can use this "convertion exit"

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

INPUT = lv_max_no_hits

IMPORTING

OUTPUT = lv_max_no_hits.

first u read the attribut, pass it to convertion exit.

and thn u set the returned value back to attribute.

hope this helps

regards

chythanya