Execute DOS Command from ABAP in SAP Version 3.x
*
* Execute DOS Command in SAP Version 3.x
*
* Written by : SAP Basis, ABAP Programming and Other IMG Stuff
*              http://www.erpgreat.com
*
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                 = 6
    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

Read Also
Simple Program that Create Internal Table Dynamically

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.