REPORT ZADN_SAMPLE.
DATA: it_vbscript LIKE STANDARD TABLE OF soli WITH HEADER LINE,
v_vbsfile LIKE rlgrap-filename.
*-----------------------------------------------------------------------
* This code creates the vbScript to play sound ringin.wav
*-----------------------------------------------------------------------
APPEND: 'strSoundFile = "C:\WINDOWS\Media\ringin.wav"' TO it_vbscript,
'Set objShell = CreateObject("Wscript.Shell")' TO it_vbscript,
'strCommand = "sndrec32 /play /close " & chr(34) & strSoundFile & chr(34)' TO it_vbscript,
'objShell.Run strCommand, 0, True' TO it_vbscript.
*-----------------------------------------------------------------------
* Generated Script file must be downloaded into the TEMP folder of
* the Windows environment
*-----------------------------------------------------------------------
CALL FUNCTION 'WS_QUERY'
EXPORTING
environment = 'TEMP'
query = 'EN'
IMPORTING
return = v_vbsfile
EXCEPTIONS
inv_query = 1
no_batch = 2
frontend_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
CONCATENATE v_vbsfile '\my_script.vbs' INTO v_vbsfile.
*-----------------------------------------------------------------------
* Script file is downloaded
*-----------------------------------------------------------------------
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = v_vbsfile
filetype = 'DAT'
mode = 'S'
TABLES
data_tab = it_vbscript
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
*-----------------------------------------------------------------------
* The Script file is executed
*-----------------------------------------------------------------------
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
commandline = v_vbsfile
program = 'WSCRIPT.EXE'
EXCEPTIONS
frontend_error = 1
no_batch = 2
prog_not_found = 3
illegal_option = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
28/09/2010
Alert Sound in ABAP
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário