METHOD get_log.
DATA lv_cont TYPE n LENGTH 3.
TRY.
DATA(lo_filter) = cl_bali_log_filter=>create(
)->set_create_info( user = sy-uname
)->set_descriptor( object = c_log-object
subobject = c_log-subobject
external_id = CONV balnrext( iv_ordemvenda ) ).
DATA(lv_data_final) = utclong_current( ).
DATA(lv_data_inicio) = utclong_add( val = lv_data_final
days = '30-' ).
lo_filter->set_time_interval( start_time = lv_data_inicio
end_time = lv_data_final ).
lo_filter->set_maximum_log_number( max_log_number = 15 ).
DATA(lt_log_table) = cl_bali_log_db=>get_instance( )->load_logs_w_items_via_filter( filter = lo_filter ).
CATCH cx_bali_runtime INTO DATA(lx_exception). "##NEEDED
RETURN.
ENDTRY.
* sort lo_log_table by log_timestamp.
LOOP AT lt_log_table INTO DATA(lo_log). "#EC CI_NESTED
" Get log header and output attributes of the header
TRY.
DATA(lo_header) = lo_log->get_header( ).
ADD 1 TO lv_cont.
* APPEND INITIAL LINE TO rt_return ASSIGNING FIELD-SYMBOL(<lf_return>).
* <lf_return> = VALUE #( id = 'ZSD' type = 'E' number = '000'
* message_v1 = lv_cont "|{ lv_cont }- Data/hora log:|
* message_v2 = lo_header->log_timestamp
* message = |Data/hora log:| && ##NO_TEXT
* |{ lo_header->log_timestamp }| ).
" Get all items and output some data which exist in all item categories
DATA(lt_item_table) = lo_log->get_all_items( ).
LOOP AT lt_item_table INTO DATA(ls_item_entry). "#EC CI_NESTED
ADD 1 TO lv_cont.
" Output attributes which are specific for messages and exceptions
IF ls_item_entry-item->category = if_bali_constants=>c_category_message.
DATA(lo_message_ref) = CAST if_bali_message_getter( ls_item_entry-item ).
APPEND INITIAL LINE TO rt_return ASSIGNING FIELD-SYMBOL(<lf_return>).
<lf_return> = VALUE #( id = lo_message_ref->id
type = lo_message_ref->severity
number = lo_message_ref->number
message_v1 = lv_cont "lo_message_ref->variable_1
message_v2 = lo_message_ref->variable_2
message_v3 = lo_message_ref->variable_3
message_v4 = lo_message_ref->variable_4
* message = |{ lv_cont }- { lo_message_ref->get_message_text( ) }| ).
message = lo_message_ref->get_message_text( ) ).
ENDIF.
ENDLOOP.
SORT rt_return BY message_v1 DESCENDING. "#EC CI_SORTLOOP
CATCH cx_bali_runtime INTO DATA(lx_exc). "##NEEDED
DATA(lv_error_msg) = lx_exc->get_text( ).
ENDTRY.
ENDLOOP.
ENDMETHOD.