‎2008 Aug 05 9:20 PM
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,
‎2008 Aug 05 9:36 PM
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.
‎2008 Aug 05 11:55 PM
Should that program be executed on the server or on the workstation (the SAPGUI)?
Markus
‎2008 Aug 06 12:35 AM
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.