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: 

Print Excel to Spool

Former Member
0 Kudos
653

Hi Everybody,

I am printing Excel Sheet using the code below.

CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.

SET PROPERTY OF H_EXCEL 'Visible' = 0.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

TEXT = TEXT-008

EXCEPTIONS

OTHERS = 1.

CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.

CALL METHOD OF H_MAPL 'OPEN' EXPORTING #1 = PATH.

CALL METHOD OF H_EXCEL 'ActiveSheet' = H_MAP.

CALL METHOD OF H_MAP 'PrintOut' .

FREE OBJECT H_EXCEL.

FREE : H_EXCEL,H_MAPL,H_MAP,H_ACT.

This directly print the excel on the printer.

But my requirement is to send it to the spool and print it form there.

Can someone tell me how to do that?Please help.

Thanks,

Sneha Singh

1 ACCEPTED SOLUTION

Former Member
0 Kudos
197

Hi,

Instead of using API method for printout use method 'SaveAs' and save the excel document in

local drive path and upload the file and send it spool using function module.

3 REPLIES 3

former_member223537
Active Contributor
0 Kudos
197

HI Sneha,

Why not create a smartform or simply use WRITE statement.

1. Smartform should be created & pass PRINT IMMEDIATELY = 'X'

2. Create WRITE Statements inside NEW-PAGE PRINT ON.. & NEW-PAGE PRINT OFF.

Best regards,

Prashant

Former Member
0 Kudos
198

Hi,

Instead of using API method for printout use method 'SaveAs' and save the excel document in

local drive path and upload the file and send it spool using function module.

0 Kudos
197

Suresh,

Can you tell me how to do that?

Please help me.

Thanks,

Sneha Singh.

Edited by: Sneha Singh on Jun 17, 2008 10:33 PM