Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Export to Excel - leading zeros problem

Hello,

I wrote an application, which exports the data from an internal table into an excel file.

I defined a variable as char20. The variable contains the value '000256'.

When I generate the excel file, the leading zeros are cut and so only the value 256 is stored into the cell.

Is it possible to prevent the cut of the zeros?

Best regards & Thanks in advance

Here is a part of may code:

conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).

CALL FUNCTION 'SCMS_STRING_TO_XSTRING'

EXPORTING

text = gv_content

IMPORTING

buffer = gv_xtext.

  • attach the first file

conv_out->convert( exporting data = gv_xtext ).

cl_wd_runtime_services=>attach_file_to_response(

i_filename = 'file1.XLS'

i_content = gv_xtext

i_mime_type = 'application/msexcel'

i_in_new_window = abap_true

i_inplace = abap_true ).

Former Member
Not what you were looking for? View more on this topic or Ask a question