01-06-2015 3:24 AM
I am new to BOPF and have learnt the basic of BOPF (create custom Business Object, query/modify records, alt.key, etc).
The Application Log BO is mentioned in the following blogs. However, I am not able find enough material for me to integrate my BOPF with Application Log.
Below are topics that I have looked into, but no conclusion yet.
I believe /BOFU/BASIS_APPLICATION_LOG is the correct object to use along with its actions from /BOFU/CL_A_BAL_ACTION. However, I am not able to get it working.
I am hoping there is someone out there can give a some reference as to how to implement application log within BOPF.
01-06-2015 9:35 AM
Hello Henry,
The correct business object for the Application log /BOFU/BASIS_APPLICATION_LOG.
1. First we need to create the Application log header with the proper input like object, sub-object, extnumber and create the instance.
2. In order to create the application log messages use the action header -> add_bopf_messages
io_message is nothing but the actual BOPF failure messages.
"Create log messages
CREATE DATA lr_act_param.
lr_act_param->o_message = io_message.
DATA lo_serv_manager_app_log | TYPE REF TO /bobf/if_tra_service_manager. |
lo_serv_manager_app_log->do_action(
EXPORTING
iv_act_key = /bofu/if_bal_application_log_c=>sc_action-header-add_bopf_messages "Action
it_key = lt_header_key " Key Table
is_parameters = lr_act_param
IMPORTING
eo_change = lo_change " Interface of Change Object
eo_message = lo_message " Interface of Message Object
).
Thanks,
Dinesh
01-06-2015 9:35 AM
Hello Henry,
The correct business object for the Application log /BOFU/BASIS_APPLICATION_LOG.
1. First we need to create the Application log header with the proper input like object, sub-object, extnumber and create the instance.
2. In order to create the application log messages use the action header -> add_bopf_messages
io_message is nothing but the actual BOPF failure messages.
"Create log messages
CREATE DATA lr_act_param.
lr_act_param->o_message = io_message.
DATA lo_serv_manager_app_log | TYPE REF TO /bobf/if_tra_service_manager. |
lo_serv_manager_app_log->do_action(
EXPORTING
iv_act_key = /bofu/if_bal_application_log_c=>sc_action-header-add_bopf_messages "Action
it_key = lt_header_key " Key Table
is_parameters = lr_act_param
IMPORTING
eo_change = lo_change " Interface of Change Object
eo_message = lo_message " Interface of Message Object
).
Thanks,
Dinesh
10-20-2021 9:08 PM
I want to share back the solution I landed with at the end, which is pretty much the same as Dinesh provided above.
" action
/bobf/cl_tra_serv_mgr_factory=>get_service_manager( /bofu/if_bal_application_log_c=>sc_bo_key )->do_action(
EXPORTING
iv_act_key = /bofu/if_bal_application_log_c=>sc_action-header-add_bopf_messages "Action
it_key = VALUE /bobf/t_frw_key( ( key = ls_bal_data-key ) )
is_parameters = NEW /bofu/s_bal_add_bopf_message( o_message = i_message )
IMPORTING
eo_message = data(l_message) ).
" save
IF l_message->check( ) = abap_false.
/bobf/cl_tra_trans_mgr_factory=>get_transaction_manager( )->save( ).
ENDIF.