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: 

down load the data into EXCEL

Former Member
0 Kudos

Hi Friends,

i want down load the data into EXCEL ....

but my ztable consists of some fields having preceding

ZEROS. like 000111 , 000075555 in file.

i want download the data with these ZEROS DATA.

help me.

regards,

6 REPLIES 6

Former Member
0 Kudos

Is the data in excel is going to be processed again later?

IF not the only way of getting leading zeroes that i know is by concatenating a quote(') or Period(.) before the number( For GUI_DOWNLOAD) . This will also show up in the excel file.

eq. your field should have '000111 intead of just 000111.

The other inconvinent way is to write the output as a tab limited txt file...and then use the excel open wizard to import the txt file with the particular field as Text.

Former Member
0 Kudos

Hi,

There is one more way. This is from excel side. If you know the maximum length of the field then you can customize excel to display leading zeros from SAP. For customizing excel sheet,

1) Select all the cells in the target excel file.

2) Goto Format->Cells

3) In the Number tab, click Custom

4) In the Type , put as many zeros( like 000000000) as the maximum length of the field you are going to populate

Now save the excel sheet and try downloading data from SAP.

//Kothand

Former Member
0 Kudos

Hi,

Do the following steps:

Open your ztable. Then go to menu bar.

Select System -> List -> Save -> Local file.

Select Spreadsheet radiobutton -> select ok.

Enter file name -> select generate button.

The entire table data will be downloaded into excel sheet.

Check the program in the following link:

http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm

Regards,

Bhaskar

Former Member
0 Kudos

Hi Sreenu

I also faced the same problem.

I use concatenate for this issue.

Check the following coding

loop at it_excel.
CONCATENATE  '''' it_excel-posnr INTO it_excel-posnr.
CONCATENATE  '''' it_excel-matnr INTO it_excel-matnr.
CONCATENATE  '''' it_excel-mandt INTO it_excel-mandt.
CONCATENATE  '''' it_excel-bukrs INTO it_excel-bukrs.
CONCATENATE  '''' it_excel-time INTO it_excel-time.
MODIFY it_excel.
endloop.

Hope this will help

If you found answer pls close this thread

Regards

Anbu

Former Member
0 Kudos

Hi Sreenu,

Use FM 'WS_DOWNLOAD' or

'GUI_DOWNLOAD' OR 'DOWNLOAD'.

While declaring the data, use 'LIKE',

for example, stlkn LIKE stpo-stlkn.

Regards

Hema

Former Member
0 Kudos

hi,

You can download your data using FM 'GUI_DOWNLOAD'.

here is a sample code which not only download the data but with formulas also in excel

REPORT Z123_EXCEL.

TYPES : BEGIN OF ls_test,

line type string,

END OF ls_test.

DATA : lw_test type ls_test,

li_test TYPE STANDARD TABLE OF ls_test,

int1 TYPE C,

int2 TYPE c.

DATA : gv_tab(1) TYPE c

VALUE cl_abap_char_utilities=>horizontal_tab .

int1 = '1'.

int2 = '2'.

CONCATENATE int1 gv_tab int2 gv_tab '=SUM(A1:B1)'

INTO lw_test-line .

APPEND lw_test to li_test.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = 'E:\EXCELFORM.XLS'

FILETYPE = 'ASC'

tables

data_tab = li_test

..