LOOP AT gt_return.
CONCATENATE gt_return-message INTO gt_return-message SEPARATED BY space.
MODIFY gt_return TRANSPORTING message.
APPEND LINES OF gt_return TO mensaje.
ENDLOOP.
CALL FUNCTION 'MESSAGES_INITIALIZE'.
LOOP AT mensaje.
CALL FUNCTION 'MESSAGE_STORE'
EXPORTING
arbgb = 'Inf'
msgty = mensaje-type
msgv1 = mensaje-message(47)
msgv2 = mensaje-message+47(47)
msgv3 = mensaje-message+94
txtnr = mensaje-number.
ENDLOOP.
CALL FUNCTION 'MESSAGES_SHOW'
EXPORTING
* corrections_option = 'X'
show_linno = space
object = 'Log de mensajes'
i_use_grid = 'X'
show_linno_text_len = 3
EXCEPTIONS
inconsistent_range = 1
no_messages = 2
OTHERS = 3.
DATA: BEGIN OF ita OCCURS 0,
ty(4) TYPE c,
ms(220) TYPE c,
END OF ita.
TYPES: t_fieldcat TYPE slis_fieldcat_alv.
data: i_fieldcat TYPE STANDARD TABLE OF t_fieldcat,
w_fieldcat TYPE t_fieldcat.
*iconos
LOOP AT gt_return.
CLEAR ita-ms.
CONCATENATE gt_return-message into ita-ms SEPARATED BY space.
IF gt_return-type = 'S'.
ita-ty = icon_green_light.
ELSEIF gt_return-type = 'E'.
ita-ty = icon_red_light.
ELSEIF gt_return-type = 'W'.
ita-ty = icon_yellow_light.
ENDIF.
APPEND ita.
ENDLOOP.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'TY'.
w_fieldcat-tabname = 'ITA'.
w_fieldcat-seltext_m = 'Tipo'.
w_fieldcat-icon = 'X'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
CLEAR w_fieldcat.
w_fieldcat-fieldname = 'MS'.
w_fieldcat-tabname = 'ITA'.
w_fieldcat-seltext_m = 'Mensaje'.
APPEND w_fieldcat TO i_fieldcat.
CLEAR w_fieldcat.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Mensajes '
i_zebra = 'X'
i_screen_start_column = 1
i_screen_start_line = 1
i_screen_end_column = 150
i_screen_end_line = 15
i_tabname = 'ITA'
it_fieldcat = i_fieldcat
is_private = is_private
TABLES
t_outtab = ita
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.