Run Host Command from ABAP code.

REPORT hostcommand.

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

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 syucomm.

      ” Calculator

     WHEN ‘CALC’.

       CALL FUNCTION ‘GUI_RUN’

         EXPORTING

           command = ‘CALC.EXE’.

       ” MS Word

     WHEN ‘WORD’.

       CALL FUNCTION ‘GUI_RUN’

         EXPORTING

           command = ‘winword.EXE’.

   ENDCASE.


W1.jpg

W2.jpg

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply