Application Development and Automation 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: 
Read only

How to kill a Windows Process using ABAP

Former Member
0 Likes
1,111

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
Read only

guillaume-hrc
Active Contributor
0 Likes
929

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
Read only

guillaume-hrc
Active Contributor
0 Likes
930

Hi,

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

Best regards,

Guillaume

Read only

0 Likes
929

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

Read only

0 Likes
929

Hi ,

Can you please provide me the code.

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

Regards,

naveen

Read only

0 Likes
929

Hi ,

It is working fine.

But i want to execute the same using ABAP statement.

Regards,

Naveen

Read only

0 Likes
929

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

Read only

0 Likes
929

Hi,

Thanks a lot it solved my problem.

Thanks and Regards,

Naveen