cancel
Showing results for 
Search instead for 
Did you mean: 

Make a "beep" using the pcu00B4s speaker

Former Member
0 Kudos

Hi,

How can I force a "beep" (sound) using the pc´s speaker using ABAP ?

Thanks in adevance.

Accepted Solutions (0)

Answers (2)

Answers (2)

athavanraja
Active Contributor
0 Kudos

data: h_com1 type ole2_object.

data beep type x.

data command(100) type c.

beep = '07'.

concatenate 'cmd /c echo' beep into command separated by space.

create object h_com1 'SAPINFO' no flush.

if sy-subrc <> 0.

exit.

endif.

if not h_com1 is initial.

constants: sw_hide type i value 0,

sw_shownormal type i value 1,

sw_show type i value 5.

call method of h_com1 'EXEC' = return

exporting #1 = command

#2 = sw_hide.

if sy-subrc = 0.

endif. "// SY-SUBRC

free h_com1.

endif.

Former Member
0 Kudos

Hi Durairaj,

This code doesn´t work. "Return" is not declarated, and you can´t concatenate a type x variable (beep), so i´ve done this modifications:

data: return(100),

beep(2) type c,

but it doesn´t work, any suggestion ???

Thansk for your answers.

athavanraja
Active Contributor
0 Kudos

Hi Indra,

Which version of SAP are you using. We are on 4.7 and it works fine.

Regards

Raja

Former Member
0 Kudos

I found that I needed to adapt the suggested code as follows:



REPORT BEEP.

TYPE-POOLS:
  ole2.

DATA:
  return  TYPE i,
  sapinfo TYPE ole2_object.

DATA:
  BEGIN OF command,
    command(12)           TYPE c VALUE 'cmd /c echo ',
    hex07(1)              TYPE x VALUE '07',
  END OF command.

*------------------------------------------------------*
START-OF-SELECTION.

  CREATE OBJECT sapinfo 'SAPINFO' NO FLUSH.

  CALL METHOD OF sapinfo 'EXEC' = return
    EXPORTING
      #1 = command
      #2 = 0.

  FREE sapinfo.

Scott

Former Member
0 Kudos

To get the code posted by Durairaj to compile you need to declare the variable return and make sure the 'unicode checks' tick box is un-checked within program attributes. Oh yeah and insert the statement 'INCLUDE ole2incl.' Having said that i am on 4.7 and the code still does not seem to make a beeping noise.

Anyone got any ideas

Message was edited by: Mart

Former Member
0 Kudos

This worked fine on 4.7 Thanks

Is there way I can run this on 4.5B. (What is the code for 4.5B). Appreciated.

Former Member
0 Kudos

Can we do this on SAPGUI for Java, too?

Peter_Inotai
Active Contributor
0 Kudos

Try this:

<i>REPORT zbeep .

INCLUDE ole2incl.

DATA wordbasic TYPE ole2_object.

DATA objectvar1 TYPE ole2_object.

CREATE OBJECT wordbasic 'Word.Basic' .

CALL METHOD OF wordbasic 'Beep' = objectvar1

EXPORTING #1 = '1' .

</i>

Incho

Former Member
0 Kudos

I have been testing this report, but there is a problem. It opens Microsoft Word on memory and don't close it.

I suppose that it can't work if you don't have Word installed... but I can test it