0% found this document useful (0 votes)
53 views3 pages

Emitir SOM No ABAP

This ABAP code defines a form that plays sound files in SAP. It first checks if sound files exist and are valid. If a error flag is passed, it will play the error sound, otherwise it will play the success sound. It defines constants, global data structures, and calls functions to retrieve path parameters and check file existence.

Uploaded by

Yonatan Díaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views3 pages

Emitir SOM No ABAP

This ABAP code defines a form that plays sound files in SAP. It first checks if sound files exist and are valid. If a error flag is passed, it will play the error sound, otherwise it will play the success sound. It defines constants, global data structures, and calls functions to retrieve path parameters and check file existence.

Uploaded by

Yonatan Díaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Emitir SOM no ABAP

TYPES: BEGIN OF tp_sound,


file_checked TYPE c,
param_file_ok TYPE string,
param_file_error TYPE string,
END OF tp_sound.

DATA: wg_sound TYPE tp_sound.

*&-------------------------------------------------------------------*
*& Form F_SOM
*&-------------------------------------------------------------------*
FORM f_som USING iv_erro TYPE flag.

CONSTANTS:
BEGIN OF c_param,
modulo TYPE /pgtpa/param_val-modulo VALUE 'SD',
param1 TYPE /pgtpa/param_val-param1 VALUE 'COLETOR',
param2 TYPE /pgtpa/param_val-param2 VALUE 'SOM',
param3_ok TYPE /pgtpa/param_val-param3 VALUE 'OK',
param3_erro TYPE /pgtpa/param_val-param3 VALUE 'ERRO',
END OF c_param.

DATA:
vl_application TYPE string,
vl_exe_exist TYPE abap_bool,
vl_param3 TYPE /pgtpa/param_val-param3.

IF wg_sound-file_checked IS INITIAL.
PERFORM f_preload_sound.
ENDIF.

IF iv_erro IS INITIAL.
IF wg_sound-param_file_ok IS NOT INITIAL.
vl_application = wg_sound-param_file_ok.
ENDIF.
ELSE.
IF wg_sound-param_file_error IS NOT INITIAL.
vl_application = wg_sound-param_file_error.
ENDIF.
ENDIF.

CALL METHOD cl_gui_frontend_services=>execute


EXPORTING
application = vl_application
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10.
IF sy-subrc <> 0.

ENDIF.

ENDFORM.

*&-------------------------------------------------------------------*
*& Form f_preload_sound
*&-------------------------------------------------------------------*
* text
*--------------------------------------------------------------------*
FORM f_preload_sound.

CONSTANTS:
BEGIN OF c_param,
modulo TYPE /pgtpa/param_val-modulo VALUE 'SD',
param1 TYPE /pgtpa/param_val-param1 VALUE 'COLETOR',
param2 TYPE /pgtpa/param_val-param2 VALUE 'SOM',
param3_ok TYPE /pgtpa/param_val-param3 VALUE 'OK',
param3_erro TYPE /pgtpa/param_val-param3 VALUE 'ERRO',
END OF c_param.

DATA: vl_exe_exist TYPE abap_bool.

* Realizar a checagem apenas na primeira vez em que a tela é chamada


CHECK wg_sound-file_checked IS INITIAL.

* Verifica áudio de sucesso


CALL FUNCTION '/PGTPA/PARAM_BUSCA_VALORES'
EXPORTING
i_modulo = c_param-modulo
i_param1 = c_param-param1
i_param2 = c_param-param2
i_param3 = c_param-param3_ok
IMPORTING
e_valor = wg_sound-param_file_ok
EXCEPTIONS
nao_encontrado = 1
range_nao_informado = 2
OTHERS = 3.
IF sy-subrc = 0.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = wg_sound-param_file_ok
RECEIVING
result = vl_exe_exist
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.
IF sy-subrc <> 0 OR vl_exe_exist <> 'X'.
CLEAR wg_sound-param_file_ok.
ENDIF.
ENDIF.

* Verifica áudio de erro


CALL FUNCTION '/PGTPA/PARAM_BUSCA_VALORES'
EXPORTING
i_modulo = c_param-modulo
i_param1 = c_param-param1
i_param2 = c_param-param2
i_param3 = c_param-param3_erro
IMPORTING
e_valor = wg_sound-param_file_error
EXCEPTIONS
nao_encontrado = 1
range_nao_informado = 2
OTHERS = 3.

IF sy-subrc = 0.
CALL METHOD cl_gui_frontend_services=>file_exist
EXPORTING
file = wg_sound-param_file_error
RECEIVING
result = vl_exe_exist
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
not_supported_by_gui = 4
OTHERS = 5.

IF sy-subrc < 0 OR vl_exe_exist <> 'X'.


CLEAR wg_sound-param_file_error.
ENDIF.
wg_sound-file_checked = 'X'.
ENDIF.
ENDFORM. "f_preload_sound

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy