cancel
Showing results for 
Search instead for 
Did you mean: 

Execute Excel from ITS

Former Member
0 Kudos

I'm trying to execute Excel from a ITS transaction using the GUI_EXEC, GUI_RUN or WS_EXECUTE functions I get a 'Select Program' dialog box from windows. I then have to find and select 'excel.exe' for it to work. Is there anyway to avoid the windows dialog box? It works find from SAPGUI.

Here's my code:

data: PATHNAME LIKE SOXPC-PATH.

  • Check where the Excel is

CALL FUNCTION 'SO_PROGNAME_GET_WITH_PATH'

EXPORTING

DOCTYPE = 'XLS'

IMPORTING

PATHNAME = PATHNAME

EXCEPTIONS

OTHERS = 1.

  • Call Excel

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

PROGRAM = PATHNAME

COMMANDLINE = 'S:\0004.xls'

INFORM = 'X'

EXCEPTIONS

OTHERS = 1.

Thanks,

Jaed

Accepted Solutions (1)

Accepted Solutions (1)

former_member228142
Active Contributor
0 Kudos

Hi Jaed,

I would recommend to use the class CL_GUI_FRONTEND_SERVICES. This class provides a method EXECUTE which can be used to open any document. Just feed the parameter DOCUMENT with the name of the Excel file.

Best regards,

Klaus

Former Member
0 Kudos

Hi Klaus,

Works beautifully!! Thanks very much.

Cheers,

Jaed

0 Kudos

Klaus,

I have a similar problem in that I use ws_execute or Execute method of cl_gui_frontend_services and other methods and all of them seem to present the box asling for a file name rather that simply openning the file - as happens with the same TCODE in the gui.

Could someone please post soem code that works from the ITS.

Thanks Peter Carroll

former_member228142
Active Contributor
0 Kudos

Hi Peter,

because webgui is a browser application and therefore cross-platform, webgui don't know which document type should be displayed with which application. When you execute a document like i.e. excel, webgui asks you once for the viewer application that should be used to display the document. After selecting the viewer webgui stores this information in the file execookie.txt. Next time is uses this information to display the document. On windows this file is normally stored under \Document and Setting\<USERNAME>

You may also create this file manually as described in note 554492.

Best regards,

Klaus

Former Member
0 Kudos

If you wanted to role the execookie.txt file out to your user community, assuming they all use Internet Explorer, you could role a file which lets IE determine which application to launch. The following file worked for me:

TXT

c:\Program Files\Internet Explorer\iexplore.exe

JPG

c:\Program Files\Internet Explorer\iexplore.exe

JPEG

c:\Program Files\Internet Explorer\iexplore.exe

GIF

c:\Program Files\Internet Explorer\iexplore.exe

DOC

c:\Program Files\Internet Explorer\iexplore.exe

BMP

c:\Program Files\Internet Explorer\iexplore.exe

PDF

c:\Program Files\Internet Explorer\iexplore.exe

TIF

c:\Program Files\Internet Explorer\iexplore.exe

PPT

c:\Program Files\Internet Explorer\iexplore.exe

PPS

c:\Program Files\Internet Explorer\iexplore.exe

XLS

c:\Program Files\Internet Explorer\iexplore.exe

Answers (0)