Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Leading zeros are removed when uploading excel

Former Member
0 Kudos

Hi All,

I have created a program to send an email with an excel attachment but the leading zero's in excel are removed. can anybody suggest what can be done other than replace since that exceeds 255chars so i cant concatenate.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi

Try adding the character ' (single quote) before the actual value. Excel then treats the value as-is whithout conversion

  • character type for columns

data: h_columns TYPE ole2_object,

h_cell TYPE ole2_object.

CALL METHOD OF excel 'Columns' = h_columns

EXPORTING

#1 = 'F:K'.

set property of h_columns 'NumberFormat' = '@'.

CALL METHOD OF excel 'Cells' = h_cell

EXPORTING

#1 = 14

#2 = 7.

SET PROPERTY OF h_cell 'Value' = '0001'.

3 REPLIES 3

Former Member
0 Kudos

Hi Shruthi,

Use FM CONVERSION_EXIT_<Conversion Routine>_INPUT & CONVERSION_EXIT_<Conversion Routine>_OUTPUT on that field.

Coversion Routine can be found at domain level of the field.

Regards,

Satish

0 Kudos

Hi Satish,

I tried with CONVERSION_EXIT_ALPHA_INPUT FM but the zeros are removed in the excel sheet, in the program the zeros are present.

Former Member
0 Kudos

Hi

Try adding the character ' (single quote) before the actual value. Excel then treats the value as-is whithout conversion

  • character type for columns

data: h_columns TYPE ole2_object,

h_cell TYPE ole2_object.

CALL METHOD OF excel 'Columns' = h_columns

EXPORTING

#1 = 'F:K'.

set property of h_columns 'NumberFormat' = '@'.

CALL METHOD OF excel 'Cells' = h_cell

EXPORTING

#1 = 14

#2 = 7.

SET PROPERTY OF h_cell 'Value' = '0001'.