Skip to Content

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

Downloading data into excel

Hi,

I would like to download data into excel and would like to prompt the user to save the file into a location of their choice. How can I achieve this

CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.

PERFORM ERR_HDL.

SET PROPERTY OF H_EXCEL 'Visible' = 1.

CALL METHOD OF H_WORK 'ADD'.

PERFORM ERR_HDL.

  • Get the created worksheet

CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 1.

PERFORM ERR_HDL.

  • Activate (select) the first sheet

CALL METHOD OF H_SHEET 'ACTIVATE'.

PERFORM ERR_HDL.

LOOP AT ITAB.

V_COL = SY-TABIX.

PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.

PERFORM FILL_CELL USING 3 V_COL ITAB-posnr.

ENDLOOP.

The above code creates an excel file and writes the code in intercative fashion i.e the excel opens and we can view the downloading of data directly. But instead I would like this process to happen in the background and then be prompted to save the file in some location.

Please help.

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