Calling an Executable Program Using ABAP

Today I want to teach you how to call an executable program using ABAP, the function that we will be using is “GUI_RUN”. This function has 2 main parameters, COMMAND and PARAMETER. The COMMAND is used to pass the executable program’s name and the PARAMETER can be used to pass the file name (if any)

If you only supply the COMMAND parameter then it will only call the executable program, but if you want to call a specific file e.g. BOOK1.XLS then you should supply the PARAMETER with the file name.



Here’s the ABAP sample code to call an EXCEL workbook.

REPORT Z_Calling_EXE_Program.

CALL FUNCTION 'GUI_RUN'
EXPORTING
COMMAND = 'EXCEL.EXE'
PARAMETER = 'C:UsersUserDocumentsBOOK1.XLS'.
* CD = '
* IMPORTING
* RETURNCODE = .

When you run the program, make sure that you already created the Excel workbook in the destinated folder. You can also change the COMMAND parameter into another type of executable program, e.g. NOTEPAD.EXE, WORD.EXE, etc.

You can also call a web browser, e.g. FIREFOX and immediately open certain website. e.g. www.google.com.

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

Subscribe in a reader

Comments

0 Responses to "Calling an Executable Program Using ABAP"

Post a Comment

Stay Updated