How to prevent Excel from deleting leading zeros

Hi Experts,
I’m using ABAP2XLSX for a project and mostly it’s working fine, but I’m trying to find a way how to display leading zeros in my xlsx file when it comes to display floating numbers.

So far I tried every number_format available in the ABAP2XLSX package. 

For example it looks like this:

lo_style_numbers->number_format->format_code = zcl_excel_style_number_format=>c_format_number_comma_sep2.

the datatype Im using in my structure is abap.fltp and Im using the fieldcatalog to fill the table:

LOOP AT lt_field_catalog ASSIGNING <fs_field_catalog>.

CASE <fs_field_catalog>fieldname.

WHEN ‘ZAHL’.

<fs_field_catalog>position = 6.

<fs_field_catalog>dynpfld = abap_true.

<fs_field_catalog>style = lo_style_numbers->get_guid( ).

<fs_field_catalog>scrtext_s = ‘Fließkommazahl’.

<fs_field_catalog>scrtext_m = ‘Fließkommazahl’.

<fs_field_catalog>scrtext_l = ‘Fließkommazahl’.

<fs_field_catalog>totals_function = zcl_excel_table=>totals_function_sum.

WHEN OTHERS.

<fs_field_catalog>dynpfld = abap_false.

ENDCASE.

ENDLOOP.

 Now, when I create the file with “gs_test-zahl = ‘09.20’.” for example, it always cuts the first zero.

Since I could’nt find any hints via research my hope lies in your hands now 🙂 
Thanks a lot so far and please let me know if you need more information to provide any help!

I-i-I-i

Scroll to Top