SAP's Business Application message logging is made available through the Object Oriented paradigm, which makes it very available indeed. Check out this example on how ready-to-use classes can be used in your coding:
The class we are implementing here is called CL_ISHMED_BAL
and it's purpose is to log messages of all sorts. The messages can be displayed in an ALV report or stored on the database ready for SLG1
to be reported on.
CONSTANTS: co_slg0_object TYPE balobj_d VALUE 'ALERT', co_slg0_subobject TYPE balsubobj VALUE 'PROCESSING'. DATA: go_log type ref to CL_ISHMED_BAL. CREATE OBJECT go_log EXPORTING i_object = co_slg0_object i_subobject = co_slg0_subobject i_repid = sy-repid. * Start logging messages: go_log->add_free_text( exporting i_msg_type = 'W' "Warning i_text = 'This is a warning message for you' ). * Another message, added in alternative way: go_log->add_msg( exporting i_type = 'I' "Informational i_id = 'V2' i_number = 123 i_message_v1 = 'Eyes and ears' ).
Whatever messages are applicable, e.g. when processing an interface, you can add messages to the go_log
object. At the end of the program run, the message can be displayed, or even saved:
* Now display the messages go_log->display( ). go_log->save( ).
The display
and save
methods really don't need anything other than the actual method call. "It" knows exactly what to display or save.