Application Development and Automation 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: 
Read only

Downloading different internal table data in a single excel with diff tabs.

Former Member
0 Likes
1,764

Hi gurs,

I have 4 internal tables with me i can able to display in 4 different excel sheets using CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

But my requirement is i want to download 4 internal table in single excel sheets with different tabs. please send the code if u have.

Thanks and regards.

Hi gurs,

I have 4 internal tables with me i can able to display in 4 different excel sheets using CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'

But my requirement is i want to download 4 internal table in single excel sheets with different tabs. please send the code if u have.

Thanks and regards.

4 REPLIES 4
Read only

Former Member
0 Likes
1,043

Hi,

Provide a button DOWNLOAD on the toolbar/menubar.

Handle the DOWNLOAD button event.

USe GUI_DOWNLOAD for 4 times & pass different internal tables . Ensure that for the last 3 GUI_DOWNLOAD you pass APPEND = 'X'.

CALL FUNCTION 'GUI_DOWNLOAD'
FILE = l_filename
FILE_TYPE = 'ASC'
TABLES
tab = i_tab1.


CALL FUNCTION 'GUI_DOWNLOAD'
FILE = l_filename
FILE_TYPE = 'ASC'
APPEND = 'X' " To append to same file
TABLES
tab = i_tab2.

CALL FUNCTION 'GUI_DOWNLOAD'
FILE = l_filename
FILE_TYPE = 'ASC'
APPEND = 'X'  " To append to same file
TABLES
tab = i_tab3.

CALL FUNCTION 'GUI_DOWNLOAD'
FILE = l_filename
FILE_TYPE = 'ASC'
APPEND = 'X'  " To append to same file
TABLES
tab = i_tab4.

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,043

hi Pavan,

I had the same questions yesterday and gor valuable replies, pls. have a look:

ec

Read only

Former Member
0 Likes
1,043

Hi,

If you want to display the content of 4 internal table in different sheets of same workbook then go through below code,

DATA : EXCEL TYPE OLE2_OBJECT,

WORKBOOKS TYPE OLE2_OBJECT,

WORKBOOK TYPE OLE2_OBJECT,

CELLS TYPE OLE2_OBJECT,

SHEET TYPE OLE2_OBJECT,

FONT TYPE OLE2_OBJECT,

H_COM1 TYPE OLE2_OBJECT,

F TYPE RLGRAP-FILENAME,

FILEP TYPE DRAW-FILEP,

G_FILE_DEST TYPE STRING,

G_FILE_TEMP TYPE STRING,

G_SYSUBRC TYPE SY-SUBRC,

G_FILE_SRC TYPE DRAW-FILEP.

  • START THE EXCEL APPLICATION

CREATE OBJECT excel 'EXCEL.APPLICATION'.

CALL METHOD OF excel 'WORKBOOKS' = workbooks.

SET PROPERTY OF excel 'VISIBLE' = 0.

CALL METHOD OF workbooks 'OPEN' EXPORTING

#1 = filep.

  • For Sheet1

CALL METHOD OF excel 'Worksheets' = sheet

EXPORTING #1 = 1.

CALL METHOD OF sheet 'Activate'.

FREE OBJECT sheet.

CALL METHOD OF excel 'CELLS' = cells

EXPORTING #1 = 1

#2 = 15.

SET PROPERTY OF cells 'VALUE' = <value>

  • CALL METHOD OF cells 'FONT' = font.

  • SET PROPERTY OF font 'SIZE' = '20'.

FREE OBJECT cells.

  • For Sheet2

CALL METHOD OF excel 'Worksheets' = sheet

EXPORTING #1 = 2.

CALL METHOD OF sheet 'Activate'.

FREE OBJECT sheet.

CALL METHOD OF excel 'CELLS' = cells

EXPORTING #1 = 1

#2 = 6.

SET PROPERTY OF cells 'VALUE' = 'XYZ'.

CALL METHOD OF cells 'FONT' = font.

SET PROPERTY OF font 'SIZE' = '20'.

GET PROPERTY OF excel 'ACTIVESHEET' = sheet.

CALL METHOD OF sheet 'SAVEAS' EXPORTING

#1 = <destination file path where you want to store>

#2 = 1.

CALL METHOD OF workbooks 'CLOSE'.

CALL METHOD OF excel 'QUIT'.

FREE OBJECT excel.

Thanks!

Brunda

'Reward if useful'.

Read only

0 Likes
1,043

Hi Brunda

Will this program work in background too???