Copyright 2024 - BV TallVision IT

If you would like to trigger Excel or any other presentation server program, with parameters... There is a utility class available to help you, along with a few older function modules.

Frontend services with CL_GUI_FRONTEND_SERVICES

There is a very elaborate class available for presentation matters / frontend services. If it is presentation server files you need to process, it is good to know that there is quite a lot of detail about this frontend available to you. Would you like to know whether a file exists ? Method FILE_EXIST can be used to check. There is also a FILE_COPY, FILE_DELETE, FILE_GET_ATTRIBUTES / FILE_SET_ATTRIBUTES, FILE_GET_SIZE and FILE_GET_VERSION. But wait - there is more:

  • Storage: method GET_DESKTOP_DIRECTORY, GET_DRIVE_FREE_SPACE_MEGABYTE, GET_DRIVE_TYPE
  • Directories: DIRECTORY_BROWSE, DIRECTORY_CREATE, DIRECTORY_DELETE, DIRECTORY_EXIST, DIRECTORY_GET_CURRENT, DIRECTORY_LIST_FILES, GET_SYSTEM_DIRECTORY, GET_TEMP_DIRECTORY, GET_SAPGUI_DIRECTORY, GET_UPLOAD_DOWNLOAD_PATH and DIRECTORY_SET_CURRENT.
  • Environment variables and registry: methods ENVIRONMENT_GET_VARIABLE, ENVIRONMENT_SET_VARIABLE, REGISTRY_DELETE_KEY, REGISTRY_DELETE_VALUE, REGISTRY_GET_DWORD_VALUE, REGISTRY_GET_VALUE, REGISTRY_SET_DWORD_VALUE and REGISTRY_SET_VALUE
  • Scripting: check out method IS_SCRIPTING_ACTIVE
  • Clipboard: methods CLIPBOARD_EXPORT and CLIPBOARD_IMPORT

Start a DOS-shell with GUI_RUN

there's a function module that does the trick. Function module GUI_RUN is all you need. It takes parameters COMMAND which holds the (full) program name you would like to execute (including the path it can be located on, unless you want to use the optional CD parameter for this) and the PARAMETER field which holds (program) parameter values.

CALL FUNCTION 'GUI_RUN'
   EXPORTING
     COMMAND          = 'C:\WINDOWS\system32\command.com'
     PARAMETER        = 'dir C:\*.*'
   IMPORTING
     RETURNCODE       = returncode

OLE communication with OLE2 (type pool)

If you need a bit more control than this, do check out what the function module actually does. It's all derived from an external object 'SAPINFO' which presents a wide variety of controlling options. Just a little more detail: with statement CREATE OBJECT object class, an external class instance can be created. Do check out SAP's online help on this - which shows (trigger the Excell application on the presentation server):

TYPE-POOLS OLE2.

DATA EXCEL TYPE OLE2_OBJECT.
CREATE OBJECT EXCEL 'Excel.Application'.

Use Excel - via direct module call

An alternative to the way described above would be the use of function module RH_START_EXCEL_WITH_DATA, which takes a file name and a data table and opens it in Excel.