ABAP Program to Execute a DOS command from SAP

This sample program demonstrate the execution of DOS command from SAP.


To execute a dos command from ABAP, you need to create a bat file.
Use the windows notepad to create this bat file c:\test.bat with content:-

test.batc:\cd\tempdir /p

REPORT ZDOSCOMMAND NO STANDARD PAGE HEADING.
PARAMETERS: DOSCMD(30) DEFAULT ‘c:\test.bat’ LOWER CASE.
CALL method cl_gui_frontend_services=>execute
EXPORTING
DOCUMENT = DOSCMD.
“End of program

Tags: , ,

2 Responses to “ABAP Program to Execute a DOS command from SAP”

  1. kalyan says:

    Please note that the function module is obsolete

  2. naveenvishal says:

    Thanx for the correct update Kalyan.
    The function is now an absolute from version 4.7 onwards.
    I will update the post itself.

Leave a Reply