on 04-05-2017 10:26 AM
we have to execute a external command from SAP server to trigger a batch file placed in remote desktop.
Our basis consultant successfully created a RFC TCP\IP connection in SM59 by the standalone gateway in the remote desktop.
setup
SAP server running in Linux OS
Batch file placed in Windows OS as a Remote Desktop.
Now the question is how to frame the external command in SM69 to trigger the batch file in the windows machine by using the RFC connection ?
As we tried external commands is runnnig at OS level accepting only Linux commands
if we give a directory path as the external command and executing using the RFC connection it is always failing ... do we need to enable anything or write windows compatible shell command . Please suggest if this is workable ..
To connect the external command to an RFC proceed as follows:
1. Create an RFC (Type T) with the following options:
a. Program: sapxpg
b.Target Host: <your remote OS (e.g. IP)>
c. Gateway Host: <your remote OS (e.g. IP)>
d. Gateway service: <the gateway service of the installed SAP Gateway on the remote host>
2. Create the external command in SM69/SM49 ==> Press Save and Press Execute ==> You will see another screen where you can specify the target destination (Target Dest.), created at point 1 ==> Execute the command in Dialog or create a Background job.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I remember doing things like this many years ago... here is a little brain dump of what I remember...
1) The program being executed on the remote system needs to implement an RFC connection back to SAP in order to let SAP know the call was successful
2) The program could work without #1 above, but SAP wouldn't know
3) The permissions to execute the program on the remote system were always tricky to setup - If everything else looked ok, I would bet this is your problem
4) I think Matthew's WSDL idea would be easier to manage in the long run.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for the reply. If you could recollect provide the #1 steps . RFC connection created using the option Start on expicit host. this solution is half the way, sap is running under Unix OS and the external created to execute batch file in remote desktop is not working, sm21 log shows unable to execute the external command
Sorry, it's been close to 20 years ago that I was involved with that. What I do remember was that we had a program written in C++ that established the connection back to SAP. Check out this document, maybe it will help https://assets.cdn.sap.com/sapcom/docs/2016/09/faa21fe1-8a7c-0010-82c7-eda71af511fa.pdf
Also do a Google Search for "SAP RFC SDK" or "SAP NW RFC SDK", you should get information about newer ways of connecting to SAP that I believe are much easier to use than the old methods.
Thanks matthew and Robert, In my case Windows machine is a remote desktop and we installed stand alone gateway for communication. Is this sufficient to create a webservice ? I will create a webservice with the help document and get back
Meanwhile trying to understand what is the issue in the windows connect RFC connection, Can it not support to execute external commands or in other words just wanted to try that option if there is any workaround available as we already tried with this approach.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For a similar scenario, we created a web service on the windows server, that could be consumed from an ABAP program. The webservice ran a batch file with supplied parameters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure. Create a web service on windows that runs your batch job with supplied parameters. You can use C++, C#, Java or whole host of languages for this. Make sure that the web service starts when the service starts. From this web service, get the WSDL file. (This is all standard stuff that anyone who develops on Windows can do).
On the SAP side, generate a consumer proxy from the WSDL file, and write a program that uses the generated proxy classes to call the web service. (This is also standard stuff,. and documented in help.sap.com, and blogs/wiki entries on this site).
Using web services to manage communications between two computer systems is an industry wide technology.
Hi.
My suggest is trying to use simple different command as "ls" for unix or "dir" for windows and see what happens. If your problem is your actual working directory you should launch before an other command to change it. What do you mean with "RFC is always failing", what's the message?
Hope to help
Bye
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
already tried with ls , ls is listing the files in the working directory and i could see the output in sm69 .
RFC connection is the connection created for connecting to Remote desktop through standalone gateway. if we execute this connection in sm59 to connect to RDP, it is successful
Target dest option is used to execute the external commands by choosing the RFC connection.
and the external command i m executing is \\sharepathid\test\test.bat ( share path of the Windows RDP ) it looks like the below
Error when executing external commands pl refer the screen print of SM21
You mean commands in test.bat?
In that case I'm agree with Matthew, once you'll have a webservice on windows server that could be consumed, you can get an XML reply in ABAP.
I put here some screen to show how could be a web-service call from ABAP to Windows System.
For a windows web service implementation there are lot of documentation on internet.
Hope to help
Bye
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.