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: 

To call EXE file and retrieve the return data

Former Member
0 Kudos

Hello Experts,

I have a requirement, where in I need to call an EXE file from the front end and get the return values in to SAP.

My application server is working on UNIX and my front end is on Windows.

when I tried using SM49, I can only call Unix commands i.e., triggering my application server.

when I am tring to call command by using GUI_EXEC, I can not retrieve any return parameters.

Please help me in this regard.

Thanks & Regards,

Naresh.

7 REPLIES 7

Former Member
0 Kudos

Hello Experts,

Is this requirement feasible??

Please help me.

Thanks & Regards,

Naresh.

0 Kudos

Hi,

Check this function module WS_EXECUTE it will help you to get the data from EXE files from non-SAP systems to SAP Systems.

Regards

Thiru

0 Kudos

HI,

I tried this FM, by using we can Execute a EXE file, but there are no return parameters to capture the values.

Thanks & Regards,

Naresh.

0 Kudos

HI,

Based on the return value of SY-SUBRC only you need to consider whethere successful or not..

kesavadas_thekkillath
Active Contributor
0 Kudos

You can try fm GUI_RUN

It has a return parameter.

Former Member
0 Kudos

Hi Naresh,

I suspect that you're talking about capturing standard output/error of the command you've executed on the frontend? If so, then I'm not aware of a default way of doing that in SAP. However, the following workaround should do the trick if you don't have a better way: Simply redirect the output into a file, e.g. something like command > c:\temp\out.txt 2> c:\temp\err.txt. This will redirect the standard output into the file c:\temp\out.txt and the standard error into the file c:\temp\err.txt.

You can then retrieve the output data from the presentation server by utilizing method gui_upload of class cl_gui_frontend_services.

Cheers, harald

0 Kudos

Hi Harald,

My external application is developed on .net. My client is using this application to capture some data in the front end. My requirement is in my SAP application when some button is pressed, I need to call this EXE file and get the return values in to two input fields of my SAP program.

I will try your trick as a last option.

Thanks for the reply.

Regards,

Naresh.