‎2006 Jan 28 2:26 PM
Hi all,
I need to call an external program from a program.
Can u give some examples
‎2006 Jan 28 2:29 PM
Hi ,
You can use Submit key word to call external program .
Example code from SAP Help:
SUBMIT REPORT01
VIA SELECTION-SCREEN
USING SELECTION-SET 'VARIANT1'
USING SELECTION-SETS OF PROGRAM 'REPORT00'
AND RETURN.
please award points to helpful answers!
Regards,
Lanka
‎2006 Jan 28 3:25 PM
Hi Jayasree,
Have a look at url
http://www.sap-img.com/abap/ws-execute-to-call-external-program.htm
Check DEMO_LIST_SUBMIT_TO_SPOOL for calling another program within the same program.
Hope this helps.
Thanks
Lakshman
‎2006 Jan 29 2:27 AM
An SAP program?
A program on the application server?
A program on the presentation server?
All have different answers.
Rob
‎2006 Jan 29 4:58 AM
hi,
say you have report zprogram1,
and at run time you want to call report zprogram2,
then use the 'submit' statement in your zprogram1.
Report Zprogram1.
...
submit Zprogram2.
...
and if you want to return to your first program after its execution, then,
Report Zprogram1.
...
submit Zprogram2 and return.
...
cheers,
Aditya.
‎2006 Jan 29 7:06 AM
Hi... see below mantion script...this script can give you some idea,,,
and use SUBMIT keyword.....
bye
PARAMETERS: PROG(70) DEFAULT
'C:\Program Files\Microsoft Office\Office\excel.EXE'.
PARAMETERS: FILE1(70) DEFAULT 'C:\TEMP\TEST.TXT'.
Tick to print the Text file after saving from MS
WORDS
PARAMETERS: S_UP AS CHECKBOX.
Tick to create new or overwrite Text file
PARAMETERS: S_NEW AS CHECKBOX.
IF S_UP = 'X'.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'FILE1'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1.
IF SY-SUBRC = 0.
LOOP AT ITAB.
WRITE: / ITAB.
ENDLOOP.
ELSE.
WRITE: / 'File open error.'.
ENDIF.
ELSE.
IF S_NEW = 'X'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = 'FILE1'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
OTHERS = 5.
ENDIF.
CASE SY-SUBRC.
WHEN 1.
WRITE: / 'GUI DOWNLOAD FILE WRITE ERROR'.
WHEN 2.
WRITE: / 'GUI DOWNLOAD NO BATCH'.
WHEN 3.
WRITE: / 'GUI DOWNLOAD GUI REFUSE
FILETRANSFER'.
WHEN 4.
WRITE: / 'GUI DOWNLOAD INVALID TYPE'.
WHEN 5.
WRITE: / 'GUI DOWNLOAD OTHERS'.
ENDCASE.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
PROGRAM = PROG
COMMANDLINE = 'FILE1'
INFORM = ' '
EXCEPTIONS
FRONTEND_ERROR = 1
NO_BATCH = 2
PROG_NOT_FOUND = 3
ILLEGAL_OPTION = 4
GUI_REFUSE_EXECUTE = 5
OTHERS = 6.
CASE SY-SUBRC.
WHEN 1.
WRITE: / 'FRONTEND ERROR'.
WHEN 2.
WRITE: / 'NO BATCH'.
WHEN 3.
WRITE: / 'PROGRAM NOT FOUND'.
WHEN 4.
WRITE: / 'ILLEGA OPTION'.
WHEN 5.
WRITE: / 'GUI REFUSE EXECUTE'.
WHEN 6.
WRITE: / 'OTHERS'.
ENDCASE.
ENDIF.