on 04-06-2004 10:43 AM
Hi,
How can I force a "beep" (sound) using the pc´s speaker using ABAP ?
Thanks in adevance.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.