3 Eylül 2008 Çarşamba

Run an Executable Program with Parameters

If you wish to run an executable program from SAP it can be done by using the following Function Module.

GUI_RUN

These function modules are useful when you want to create an interface with SAP. Many a times it may be required to call an executable program from SAP and pass some Parameters to it. The called user program can then process the data and return back parameters to SAP. Function modules similar to GUI_RUN can be used to build such interfaces.

We will see a simple example of opening a Notepad file from SAP and another example by opening a website through a browser.

Example 1

REPORT ZEX_GUIRUN .


CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'NOTEPAD.EXE'
PARAMETER = 'c:\TEST.TXT'
* CD = '
* IMPORTING
* RETURNCODE = .

Example 2

REPORT ZEX_GUIRUN .


CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'FIREFOX.EXE'
PARAMETER = 'GOOGLE.COM'
* CD = '
* IMPORTING
* RETURNCODE = .

Hiç yorum yok: