Logger-class: /SCT/QP_CL_LOGGER
The /SCT/QP_CL_LOGGER class implements the /SCT/QP_IF_LOGGER interface and provides the central functions for managing logs.
Methods | Description |
|---|---|
add importing i_obj_to_log type any optional iv_msgty type symsgty optional iv_probclass type balprobcl optional | Adds a message to the logSupported structures: BAPIRET1, BAPIRET2, BAPI_CORU_RETURN, BAPI_ORDER_RETURN, BDCMSGCOLL, HRPAD_MESSAGE, RCOMP and tables used by these. Parameter: i_obj_to_log iv_msgty iv_probclass |
free | Releases resources of the logger instance, deletes attributes |
fullscreen | Displays the current log in full screen mode |
get_messages returning value(rt_bapiret) type bapirettab | Returns the saved messages of the logParameter rt_bapiret Return value - table with the messages |
has_errors returning value(rv_yes) type abap_bool | Checks whether the log contains errorsParameter rv_yes |
has_warnings returning value(rv_yes) type abap_bool | Checks whether the log contains warningsParameter rv_yes |
is_empty returning value(rv_yes) type abap_bool | Checks whether the log is emptyParameter rv_yes |
length returning value(rv_length) type i | Returns the length of the logParameter rv_length Number of entries in the log. |
new importing iv_extnumber type balnrext iv_object type balobj_d default c_object iv_subobject type balsubobj default c_subobject iv_context type bal_s_cont optional iv_auto_save type abap_bool optional returning value(r_log) type ref to /sct/qp_if_logger | Creates a new logger instance, initializes the logParameter iv_extnumber GUID or external number of the log iv_object iv_subobject iv_context iv_auto_save Activate or deactivate automatic saving r_log Return value - reference to the logger instance |
open importing iv_extnumber type balnrext iv_object type balobj_d default '/SCT/QP' iv_subobject type balsubobj default 'VART' iv_context type bal_s_cont optional iv_auto_save type abap_bool optional iv_create_if_does_not_exist type abap_bool default abap_false returning value(r_log) type ref to /sct/qp_if_logger | Opens an existing logParameter iv_extnumber GUID or external number of the log iv_object iv_subobject iv_context iv_auto_save Activate or deactivate automatic saving iv_create_if_does_not_exist r_log Return value - reference to the logger instance |
popup | Displays the log in a pop-up window |
save importing iv_extnumber type balnrext optional | Saves the current logParameter iv_extnumber GUID or external number of the log |
Example program
1. Creation of a new log
DATA(lo_logger) = /sct/qp_cl_logger=>new( iv_extnumber = 'GUID123' iv_object = '/SCT/QP' iv_subobject = 'VART').lo_logger->add( i_obj_to_log = VALUE bapiret2( type = 'E' id = '/SCT/QP' number = '001' message_v1 = 'Testnachricht' ) ).lo_logger->save( ).2. Show messages
DATA(lo_view) = NEW /sct/qp_cl_bal_view( ).lo_view->set_gui_container( io_gui_container = mo_container ).lo_view->set_instance( ir_objtyp = lo_logger ).3. Read out logs
DATA(lo_logger) = /sct/qp_cl_logger=>open( iv_extnumber = 'GUID123' ).DATA(lt_messages) = lo_logger->get_messages( ).Results in QPPD
Display logs with SLG1
The SAP standard transaction SLG1 enables the selection and display of logs. This function is particularly useful for checking the results of a program or log based on a GUID.
Settings for log display
To display the messages of a specific node, we use the GUID of the node. The GUID is used as a filter criterion in the "External identification" field.


