Código abierto > Funciones
Funcion messages_show
(1/1)
gabriela_soria:
Hola a todos! :) :) :) Mi nombre es Gabriela, y programé en abap durante dos años, deje por otros dos años y aqui me tienen retomando el tema. Asi que es como comenzar de nuevo.
Se me presentó la oportunidad de hacer una dynpro con radiobuttons y titulos que figuran como preguntas, con lo cual estoy loca desde hace dos dias tratando de hacer algo, alguien me dijo que pruebe con la funcion messages_show, la abri pero no se como se usa, alguien puede decirme como se usa la funcion? en todo caso saber para que sirve cada campo y como rellenarlo? :(
Les agradeceré alguna respuesta !!
Muchas gracias por la ayuda que me puedan brindar
Saludos,
Gabriela.
Enrique.Borroni:
Este es un ejemplo que encontre hace un tiempo de como aplicar la funcion.
HinweisListe anzeigen und im ApplikationLog speichern
*&---------------------------------------------------------------------*
* Hinweis anlegen => Button für Anzeigen und Speichern => siehe Anlage
*----------------------------------------------------------------------*
form message_add using iv_text_var type char3
is_protk type ty_protk.
data: lv_dummy type char72.
data: ls_msg type bal_s_msg.
data: lv_log_message type balmi.
data: lv_level type char1.
case iv_text_var.
when '001'.
message i000(38) with 'Ausgewählter Programmname:' so_name-low into lv_dummy.
when others.
endcase.
* Struktur für Application Log definieren
ls_msg-msgty = sy-msgty.
ls_msg-msgid = sy-msgid.
ls_msg-msgno = sy-msgno.
ls_msg-msgv1 = sy-msgv1.
ls_msg-msgv2 = sy-msgv2.
ls_msg-msgv3 = sy-msgv3.
ls_msg-msgv4 = sy-msgv4.
* Detailierungsgrad bis maximal 9 Stufen tief
ls_msg-detlevel = '1'.
call function 'BAL_LOG_MSG_ADD'
exporting
i_s_msg = ls_msg
* i_log_handle =
exceptions
log_not_found = 0
others = 1.
if sy-subrc <> 0.
message i099(rscatt) with sy-cprog 'message_add' 'BAL_LOG_MSG_ADD'.
* cv_rc = 1.
return.
endif.
endform. " message_add
*&---------------------------------------------------------------------*
* HinweisListe sortieren und anzeigen
*----------------------------------------------------------------------*
form messages_show .
data: lt_log_handle type bal_t_logh.
data: lt_msg_handle type bal_t_msgh,
ls_msg_handle type balmsghndl.
data: ls_message type bal_s_msg,
lt_messages type table of bal_s_msg.
* data: lv_locat type ltrm_locat.
* Nachrichten aus dem Hauptspeicher laden
* -----------------------------------------------
append go_log_handle to lt_log_handle.
call function 'BAL_GLB_SEARCH_MSG'
EXPORTING
i_t_log_handle = lt_log_handle
IMPORTING
e_t_msg_handle = lt_msg_handle
EXCEPTIONS
msg_not_found = 1.
if sy-subrc ne 0. message i059(6g). return. endif.
* Nachrichten auslesen
* -----------------------------------------------
loop at lt_msg_handle into ls_msg_handle.
call function 'BAL_LOG_MSG_READ'
EXPORTING
i_s_msg_handle = ls_msg_handle
IMPORTING
e_s_msg = ls_message
EXCEPTIONS
log_not_found = 1
msg_not_found = 2
others = 3.
if sy-subrc <> 0.
message w889(1b) with 'BAL_LOG_MSG_READ'.
return.
endif.
append ls_message to lt_messages.
endloop.
* Nachrichten sortieren und Dubletten löschen
* -----------------------------------------------
sort lt_messages.
delete adjacent duplicates from lt_messages.
* Nachrichten im Hauptspeicher löschen
* -----------------------------------------------
call function 'BAL_LOG_MSG_DELETE_ALL'
EXPORTING
i_log_handle = go_log_handle
EXCEPTIONS
log_not_found = 1
others = 2.
if sy-subrc <> 0.
message w889(1b) with 'BAL_LOG_MSG_DELETE_ALL'.
return.
endif.
* Sortierte Nachrichten wieder zurück in den Hauptspeicher
* -----------------------------------------------
loop at lt_messages into ls_message.
get time stamp field ls_message-time_stmp.
call function 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle = go_log_handle
i_s_msg = ls_message
EXCEPTIONS
log_not_found = 1
msg_inconsistent = 2
log_is_full = 3
others = 4.
if sy-subrc <> 0.
message w889(1b) with 'BAL_LOG_MSG_ADD'.
return.
endif.
endloop.
if sy-subrc ne 0.
message w889(1b) with 'Kein Protokoll vorhanden'(125).
endif.
* Nachrichten anzeigen
* -----------------------------------------------
call function 'BAL_DSP_LOG_DISPLAY'
EXPORTING
i_t_log_handle = lt_log_handle
EXCEPTIONS
profile_inconsistent = 1
internal_error = 2
no_data_available = 3
no_authority = 4
others = 5.
if sy-subrc <> 0.
message w889(1b) with 'BAL_DSP_LOG_DISPLAY'.
return.
endif.
endform. " messages_show
*&---------------------------------------------------------------------*
* HinweisListe im ApplikationLog speichern
*----------------------------------------------------------------------*
form messages_save .
data: lt_log_logs type table of balnri.
call function 'APPL_LOG_WRITE_DB'
exporting
object = gc_bal_object
* subobject = ' '
* log_handle = ' '
* update_task = ' '
tables
object_with_lognumber = lt_log_logs
exceptions
object_not_found = 1
subobject_not_found = 2
internal_error = 3
others = 4.
if sy-subrc eq 0.
message i899(5b) with 'Die Hinweise wurden gesichert!'(108).
else.
message i899(5b) with 'Es sind keine Hinweise vorhanden!'(109).
endif.
endform. " messages_save
*&---------------------------------------------------------------------*
Navegación
Ir a la versión completa