ABAP program that “speaks” through local desktop speaker

ABAP program to output words through speaker in local desktop.

REPORT  zspeak.

INCLUDE ole2incl.

DATA objectvar1 TYPE ole2_object.
DATA objvoice   TYPE ole2_object.

PARAMETERS strtext TYPE string DEFAULT 'Hey man! Are you crazy?'.

START-OF-SELECTION.

  CREATE OBJECT objvoice 'SAPI.SpVoice'.

  IF strtext IS INITIAL.
    strtext = 'Hey! Hey! I am talking to you, do not do it! do not do it! this is your first warning, please pay attention!'.
  ENDIF.

  CALL METHOD OF objvoice 'Speak' = objectvar1
    EXPORTING #1 = strtext.

  FREE: objvoice,objectvar1.