Thursday, May 1, 2008

SAP ABAP Function Module to Run an Executable Program with Parameters

SAP ABAP Function Module to 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       = .

So if you want to open a browser you can use the function module GUI_RUN.

Some other function modules that open a browser from within SAP are as follows.

Calling a Browser from ABAP



No comments:

Post a Comment