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: 

PsTools from ABAP

manuelhildemaro_ramossanc
Active Participant
0 Kudos

Hi all.

I need execute a .exe (psservice.exe) in application server. This for restart a service in a remote server I tried using tx sm69, but it's not working. When i'm testing the command, system is hang.

Somebody know another way to do this ?

Regards.

17 REPLIES 17

Former Member
0 Kudos

SM69 is the correct way and the only way. When you execute the exe directly from the application server, are you facing any problems? Are there any parameters (input or output) for the exe? Are there any messages/dialog activities in the exe?

0 Kudos

Yes, i have a problem when i'm executing the command.

This is a example,

c:\pstools\psservice
xxx.xxx.1.1 -u username -p password restart service_name.

When i execute this command in MS-DOS console, it returns a message.

Do you think that it is the problem ?

0 Kudos

Yes, you will to handle all the responses coming from the exe. Also, you mentioned application server, but here you are showing it as C: (local drive).

Try writing a small ABAp program and execute your SM69 command using function module SXPG_COMMAND_EXECUTE and see what error you are getting? Sometimes the test tools have the tendency to convert the data into uppercase which may not be valid in all scenarios.

0 Kudos

[SXPG_COMMAND_EXECUTE to Execute External Commands|http://saptechno.blogspot.com/2008/07/sxpgcommandexecute-to-execute-external.html]

0 Kudos

Hi.

In this moment iI don`t know how handle responses. The .exe is located on dir C:\pstools. (application server)

I wrote a program for execute FM SXPG_COMMAND_EXECUTE, but i'm having a problem. When i marked

option TERMINATIONWAIT, the FM still waiting, and i have cancel transaction. If don't mark this option,

FM don't work.

Why happen this ?

0 Kudos

Hi all.

I checked the task manager in app server, and psservice was running. But i need program ends correctly.

Somebody know how to do resolve this ?

0 Kudos

>

>The .exe is located on dir C:\pstools. (application server)

>

C:\pstools. (presentation server)

/usr/sap/temp/ (application server)

If you have the .exe in your PC C directory.. how are u planning to have that file in a user who is in Taiwan or Mumbai or Brussels?

0 Kudos

What is the SY-SUBRC value you are getting after calling the FM?

0 Kudos

>

> >

> >The .exe is located on dir C:\pstools. (application server)

> >

>

> C:\pstools. (presentation server)

> /usr/sap/temp/ (application server)

>

> If you have the .exe in your PC C directory.. how are u planning to have that file in a user who is in Taiwan or Mumbai or Brussels?

Hi Jay!

C:\pstools is a dir located in Microsoft Server Windows 2003. In this server is installed SAP.

After could move PsTools to /usr/sap/....

Now i need finish correctly .exe, because it remains running(checking task manager of OS), and

not returns.

Regards.

0 Kudos

>

> What is the SY-SUBRC value you are getting after calling the FM?

FM not ends. I have to cancel transaction. However the .exe is being executed by FM, but program never finish.

0 Kudos

I checked ur FM is RFC enabled.. so you can do some thing to kil the task...


taskname(7) TYPE c VALUE 'EXEtest'',

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
    STARTING NEW TASK taskname
    DESTINATION 'NONE'
    PERFORMING ret ON END OF TASK
    EXPORTING
.....
.....
  IF sy-subrc EQ 0.
    WAIT UP TO 1 SECONDS.
  ENDIF.

FORM ret USING p_task TYPE clike.

write some code to kill the task..

I am hopeing this would help u..

0 Kudos

>

> I checked ur FM is RFC enabled.. so you can do some thing to kil the task...

>

>


> taskname(7) TYPE c VALUE 'EXEtest'',
> 
> CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
>     STARTING NEW TASK taskname
>     DESTINATION 'NONE'
>     PERFORMING ret ON END OF TASK
>     EXPORTING
> .....
> .....
>   IF sy-subrc EQ 0.
>     WAIT UP TO 1 SECONDS.
>   ENDIF.

>

>

FORM ret USING p_task TYPE clike.
> 
> write some code to kill the task..

> I am hopeing this would help u..

I tried this and not works. I think that is a System Operative problem, because running directly

file .bat in MS-DOS, it works.

However when i execute file .bat in sm49 ( with sap user ) it fails.

0 Kudos

I would suspect that this is some problem or restruction in the server program psservicei tself.

The name seems to imply it: It might not be intended for remote access.

When running it from DOS as a command line tool you are on the server yourself, right?

When running it remotely, you might be load balanced onto different application server instances so SAPXPG's file path is not that which your server program is expecting or not finding the program.

I am not familiar with this program, but I suspect that although you can start it remotely it is not intended for this scenario.

As already mentioned by J@y, it expects some local interface which you dont have in your ABAP.

Just a guess in the dark,

Julius

0 Kudos

>

> I would suspect that this is some problem or restruction in the server program psservicei tself.

>

> The name seems to imply it: It might not be intended for remote access.

>

> When running it from DOS as a command line tool you are on the server yourself, right?

>

> When running it remotely, you might be load balanced onto different application server instances so SAPXPG's file path is not that which your server program is expecting or not finding the program.

>

> I am not familiar with this program, but I suspect that although you can start it remotely it is not intended for this scenario.

>

> As already mentioned by J@y, it expects some local interface which you dont have in your ABAP.

>

> Just a guess in the dark,

> Julius

Hi Julius.

I run program in command line, in application server.

However, when i'm testing using SM49, program is running( checking task manager in app server), but not ends.

The program psservice can work with services, in a local or remote server.

Really i want execute a program

located in application server, for restart a service located in a remote server.

Do you know another way for do this ?

Regards,

Manuel H.

0 Kudos

Solved. Authorization problem in remote server.

Thank for your answers.

manuelhildemaro_ramossanc
Active Participant
0 Kudos

Authorization problem in remote server.

Former Member
0 Kudos

Hi Manuel ,

can you tell how you achieved.

when i run it is saying external command not executable.

can you please update me. Possible.

Thankks,

Harikiran