Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
hassan_zahid
Explorer

Run Host Command from ABAP code.

REPORT hostcommand.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECTION-SCREEN PUSHBUTTON /10(10) bt_calc USER-COMMAND calc.

SELECTION-SCREEN PUSHBUTTON /10(10) bt_word USER-COMMAND word.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

   MOVE 'Calculator' TO bt_calc.

   MOVE 'MS Word' TO  bt_word.

START-OF-SELECTION.

END-OF-SELECTION.

AT SELECTION-SCREEN.

   CASE sy-ucomm.

      " Calculator

     WHEN 'CALC'.

       CALL FUNCTION 'GUI_RUN'

         EXPORTING

           command = 'CALC.EXE'.

       " MS Word

     WHEN 'WORD'.

       CALL FUNCTION 'GUI_RUN'

         EXPORTING

           command = 'winword.EXE'.

   ENDCASE.