Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to kill a Windows Process using ABAP

Former Member
0 Kudos

Hi All,

I have to kill a process while i am executing my Ecatt Script.

For example.

I would like to open a procees using Ecatt and Kill the process with some ABAP statements.

I am working in Windows Environment.

Thanks and Regards,

Naveen

1 ACCEPTED SOLUTION

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Well, find the command that kill the process in windows and use 'EXECUTE' from CL_GUI_FRONTEND_SERVICES class.

Best regards,

Guillaume

6 REPLIES 6

guillaume-hrc
Active Contributor
0 Kudos

Hi,

Well, find the command that kill the process in windows and use 'EXECUTE' from CL_GUI_FRONTEND_SERVICES class.

Best regards,

Guillaume

0 Kudos

For Windows XP, a simple command is :

taskkill /IM <name_of_the_process>

For instance: taskkill /IM notepad.exe

Check out this URL:

http://www.tech-recipes.com/windows_tips446.html

Best regards,

Guillaume

0 Kudos

Hi ,

Can you please provide me the code.

I want to Execute a .vbs file,which in turn kills that process

Regards,

naveen

0 Kudos

Hi ,

It is working fine.

But i want to execute the same using ABAP statement.

Regards,

Naveen

0 Kudos

Well, the most ABAP I can think of is this :

CALL METHOD cl_gui_frontend_services=>execute
  EXPORTING
    application            = 'taskkill'
    parameter              = '/IM notepad.exe'
  EXCEPTIONS
    cntl_error             = 1
    error_no_gui           = 2
    bad_parameter          = 3
    file_not_found         = 4
    path_not_found         = 5
    file_extension_unknown = 6
    error_execute_failed   = 7
    synchronous_failed     = 8
    not_supported_by_gui   = 9
    OTHERS                 = 10.

Honestly, I don't SAP has developed this kind of tool because :

- it depends from Windows version to another

- it deals with low-level aspects (process management should be devoted to OS alone)

Best regards,

Guillaume

0 Kudos

Hi,

Thanks a lot it solved my problem.

Thanks and Regards,

Naveen