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

You might also be interested in these posts:

  1. ABAP Program to Display OAER pictures on Screen
  2. ABAP Program to Display SE78 pictures on Screen
  3. ABAP Program to search specific words(string) in SAP Programs
  4. ABAP Program for Table Maintenance in SAP
  5. ABAP Program to Send Mail through SAP

2 Responses to “ABAP Program to Execute a DOS command from SAP”
kalyan Posted on July 24, 2009 at 1:42 PM

Please note that the function module is obsolete

naveenvishal Posted on July 24, 2009 at 5:06 PM

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

Post a Comment