Every ABAP developer will write an application log some day. SAP system provides wide range of logging and monitoring capabilities from simple tools to sophisticated ones. SAP is restructuring the different applications and functions encapsulated in packages to specific layers and and application components from time to time. Writing a helper class from scratch to manage logs on Object Oriented manner is double work, and not necessary.

Option 1

cf_reca_message_list is a good one, providing the possibility to enter an external ID. Might not found in your system, but in S/4HANA sure exists, and most probably in ECC also.

me->_log = cf_reca_message_list=>create(
  id_object    = i_log_obj
  id_subobject = i_log_subobj
  id_extnumber = i_log_extnr
).

Option 2

Audit Information System ( AIS ) is part of the SAP basis, so this component is available in every ABAP System (at least from 7.0 EhP2). This contains class  cl_s_aut_bal_log what you can use to create Application Logs and save (or display), but lack of providing the external ID as parameter, but this not necessery in all cases.

DATA(lo_applog) = cl_s_aut_bal_log=>create( 
  im_object = 'Some_Object' 
  im_subobject = 'Some_subobject' 
).

You can read more about Application Logging – Auditing and Logging in SAP Library.

Share this content: