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: 

Output report to Excel format

Former Member
0 Kudos

Hi Techis ,

I am getting my output thru classical report and nw at output i want to copy it on excel format ,

Will anybody pls explain hw to do it?

Rewards for helpful ans..

5 REPLIES 5

Former Member
0 Kudos

Hi Santosh,

At the output screen there will be a button(LOCAL FILE) or (CtrlShiftF9)

From this you can copy the output to your required format

Former Member
0 Kudos

Former Member
0 Kudos

Check the following code:



REPORT ZCREATEEXCEL.

TYPE-POOLS OLE2.
DATA: EXCEL     TYPE OLE2_OBJECT,
      WORKBOOKS TYPE OLE2_OBJECT,
      WORKBOOK  TYPE OLE2_OBJECT.

DATA: FILENAME LIKE RLGRAP-FILENAME.

* START THE EXCEL APPLICATION
  CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
  PERFORM ERR_HDL.

* PUT EXCEL IN FRONT
  SET PROPERTY OF EXCEL  'VISIBLE' = 1.
  PERFORM ERR_HDL.

* INFORM USER OF THE CURRENT STATUS
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
       EXPORTING
            PERCENTAGE = 0
            TEXT       = TEXT-I08
       EXCEPTIONS
            OTHERS     = 1.

* CREATE AN EXCEL WORKBOOK OBJECT
  CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOKS.
  PERFORM ERR_HDL.

  CALL METHOD OF WORKBOOKS 'ADD' = WORKBOOK.
  PERFORM ERR_HDL.

* EXCEL FILENAME
  CONCATENATE SY-REPID '_' SY-DATUM+6(2) '_' SY-DATUM+4(2) '_'
              SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.

  CALL METHOD OF WORKBOOK 'SAVEAS' EXPORTING #1 = FILENAME.

  FORM ERR_HDL.

  IF SY-SUBRC <> 0.
    WRITE: / 'OLE ERROR: RETURN CODE ='(I10), SY-SUBRC.
    STOP.
  ENDIF.

ENDFORM.

*-- End of Program

Former Member
0 Kudos

After Getting the ouput in internal table use this FM

WS_Excel

Reward points helpful

Former Member
0 Kudos

Hi

at ouput..in menu bar there is a option called list

LIST---SAVE/SEND---FILE.

now after that select the radio button spread sheet and give the path u will get the output in excel sheet.