2025 Nov 06 6:16 PM - edited 2025 Nov 07 5:25 AM
Hi everyone,
In the ABAP BTP Trial environment, we can create Application Log Objects, add messages, and save them successfully. However, our users currently lack the authorization to view the logs we’ve created.
Example:
METHOD if_oo_adt_classrun~main.
TRY.
" Create log object
DATA(lo_log) = cl_bali_log=>create( ).
" Create and set header
DATA(lo_header) = cl_bali_header_setter=>create( object = 'ZZLOG'
subobject = 'CONN'
external_id = '12345'
)->set_expiry( expiry_date = CONV d( cl_abap_context_info=>get_system_date( ) + 7 )
keep_until_expiry = abap_true ).
lo_log->set_header( lo_header ).
" Classic Message
DATA(lo_msg) = cl_bali_message_setter=>create(
severity = if_bali_constants=>c_severity_error
id = 'ZZMSGCLS'
number = '001' ).
lo_log->add_item( lo_msg ).
" Save logs
DATA(lo_log_db) = cl_bali_log_db=>get_instance( ).
lo_log_db->save_log( lo_log ).
" Get the handle
DATA(l_handle) = lo_log->get_handle( ).
out->write( |Log created: { l_handle }| ).
" Read messages from handle
lo_log = lo_log_db->load_log(
handle = l_handle
read_only_header = abap_true
).
DATA(lt_items) = lo_log->get_all_items( ).
LOOP AT lt_items ASSIGNING FIELD-SYMBOL(<ls_item>).
out->write( <ls_item>-item->get_message_text( ) ).
ENDLOOP.
CATCH cx_bali_runtime INTO DATA(lo_cx_bali_runtime).
out->write( lo_cx_bali_runtime->get_text( ) ).
ENDTRY.The method call:
" Read messages from handle
lo_log = lo_log_db->load_log(
handle = l_handle
read_only_header = abap_true
).throws the exception with the text: You are not authorized to display the specified log
Does anyone know if there is any other way to read the logs?
Thank you,
Christian
Request clarification before answering.
Hallo @ChristianSilva,
That's the normal behavior. You have to add the authorization (S_APPL_LOG) to an IAM App and assign it to role and than to you. Without this object not possible.
Greetings
Björn
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.