Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Application Log implementation

$
0
0

Application Log implementation

 

To implement basic functionality of application log we need to create object and sub object.

 

  1. Creation of object and sub object:

For creating object and sub object go to SLG1 transaction. Select New Entries and create object.

     

bal log.jpg

 

  1. Then Use function modules for application log.
  2. BAL_LOG_CREATE
  3. BAL_LOG_MSG_ADD
  4. BAL_DB_SAVE
  5. SLG1 transaction for displaying existing logs.
  6. SLG2 transaction for deleting existing logs.

 

 
 

 

Code

 

DATAls_log              TYPE   bal_s_log,
ls_log1            
TYPE   bal_s_log ,
ls_log_handle      
TYPE   balloghndl,
lt_log_handle      
TYPE   bal_t_logh,
ls_msg             
TYPE   bal_s_msg.

CLEAR:ls_log, ls_log1, ls_log_handle, ls_msg.
REFRESH:lt_log_handle.

ls_log
-aldate    = sy-datum.
ls_log
-object    = cv_object.
ls_log
-subobject = cv_subobject.

CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log     
= ls_log
IMPORTING
e_log_handle
= ls_log_handle.
IF sy-subrc <> 0.
ENDIF.

ls_msg
-msgty = 'E'.
ls_msg
-msgid = '/RB94/YG2_EX'.
ls_msg
-msgno = '000'.
ls_msg
-msgv1 = cv_message+0(50).
ls_msg
-msgv2 = cv_message+50(50).

CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
i_log_handle
= ls_log_handle
i_s_msg     
= ls_msg.
IF sy-subrc <> 0.
ENDIF.

INSERT ls_log_handle INTO TABLE lt_log_handle.
CALL FUNCTION 'BAL_DB_SAVE'
EXPORTING
i_save_all    
= 'X'
i_t_log_handle
= lt_log_handle.
IF sy-subrc <> 0.
ENDIF.


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>