Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Application Log BO in BOPF

0 Kudos

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 am aware of the existing of
    • /BOFU/BASIS_APPLICATION_LOG
    • /BOFU/CL_LIB_C_APPLICATION_LOG
    • /BOFU/CL_A_BAL_ACTION
  • I also wonder if I have to learn about Output Management, but this isn't clear to me.
  • I have done PPF before when doing custom development in Solution Manager, but I do not see example of how to link that to Application Log.

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.

1 ACCEPTED SOLUTION

0 Kudos

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_logTYPE 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

2 REPLIES 2

0 Kudos

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_logTYPE 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

0 Kudos

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.