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

Execute Exe Program from SAP

Former Member
0 Likes
608

Hi SAP gurus,

I have a requirement where in we have a DOS exe Program but Dont have source code of it. The Program takes some input values, Calculates and Gives the output result. We need that Program to be called from SAP so that we can pass the input values from SAP and get the results back into SAP.

It would be great if you can help me out in this. Answers will be rewarded.

Thanks,

3 REPLIES 3
Read only

Former Member
0 Likes
547

Check FM WS_EXECUTE.

REPORT ZEXAMPLE.

DATA: V_PGM(100) VALUE 'C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\WINWORD.EXE',

V_FNAME LIKE RLGRAP-FILENAME VALUE 'C:\DOCUMENT.DOC'.

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

COMMANDLINE = V_FNAME

PROGRAM = V_PGM

EXCEPTIONS

FRONTEND_ERROR = 1

NO_BATCH = 2

PROG_NOT_FOUND = 3

ILLEGAL_OPTION = 4

GUI_REFUSE_EXECUTE = 5

OTHERS = 6.

IF SY-SUBRC NE 0.

WRITE:/ V_FNAME, 'NOT OPENED WITH', V_PGM.

ELSE.

WRITE:/ 'EXTERNAL APPLICATION CALLED SUCCESSFULLY'.

ENDIF.

Read only

markus_doehr2
Active Contributor
0 Likes
547

Should that program be executed on the server or on the workstation (the SAPGUI)?

Markus

Read only

0 Likes
547

The Program should run in the workstation, but we need to retrive bcak the results back into SAP. And also we need to send the input values for the program from SAP.

One point is we do not have the source code of the DOS Program so we cannot modify that.