Execute DOS Command from ABAP in SAP Version 3.x
Execute DOS Command in SAP Version 3.x

*
REPORT ZDOSCMDSAP3.

DATA: BEGIN OF ITAB OCCURS 0,
DOSCMD LIKE RLGRAP-FILENAME,
END OF ITAB.

ITAB-DOSCMD = 'CD\'. APPEND ITAB.
ITAB-DOSCMD = 'MD TESTDIR'. APPEND ITAB.

CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = 'C:\DOSCMD.BAT'
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TYPE = 4
NO_BATCH = 5
UNKNOWN_ERROR = 6Advertisement

INVALID_TABLE_WIDTH = 7
GUI_REFUSE_FILETRANSFER = 8
CUSTOMER_ERROR = 9
OTHERS = 10.

CALL FUNCTION 'WS_EXECUTE'
EXPORTING
PROGRAM = 'C:\DOSCMD.BAT'.

*-- End of Program