Skip to content

Latest commit

 

History

History
1220 lines (760 loc) · 15.8 KB

cl-bali-log-interface-if-bali-log-5e25cf7.md

File metadata and controls

1220 lines (760 loc) · 15.8 KB

CL_BALI_LOG (Interface IF_BALI_LOG)

Class CL_BALI_LOG handles all read and change operations on a single application log. It contains methods to read and change the log header. In addition, it allows to read items from the log and to add items to the log. The public interface of the instance methods is IF_BALI_LOG.

Public Methods

Create an instance of the log class:

CREATE (static)

Name

Description

Returning parameter

LOG

Log object: A reference to interface IF_BALI_LOG

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_INTERNAL_ERROR

Internal error during processing

Create an instance of the log class and set the header:

CREATE_WITH_HEADER (static)

Name

Description

Importing parameter

HEADER

Header which is put into the log: Reference to interface IF_BALI_HEADER_SETTER

Returning parameter

LOG

Log object: A reference to interface IF_BALI_LOG

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OBJECT_NOT_ALLOWED:

Access to the log object of the header is not allowed

CX_BALI_INVALID_PARAMETER

The log object or subobject of the header don't exist

CX_BALI_INTERNAL_ERROR

Internal error during processing

Get the log handle which is the unique identifier of the log:

GET_HANDLE

Name

Description

Returning parameter

HANDLE

Log handle

Get the log header:

GET_HEADER

Name

Description

Returning parameter

HEADER

Log header: References to interface IF_BALI_HEADER_GETTER

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED:

The memory of the log was released. The log can't be used

CX_BALI_INTERNAL_ERROR

Internal error during processing

Set the log header:

SET_HEADER

Name

Description

Importing parameter

HEADER

Header which is put into the log: References to interface IF_BALI_HEADER_SETTER

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OBJECT_NOT_ALLOWED:

    Access to the log object of the header is not allowed

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED:

    The memory of the log was released. The log can't be used

CX_BALI_INVALID_PARAMETER

The log object or subobject of the header don't exist

CX_BALI_INTERNAL_ERROR

Internal error during processing

Add an item (e.g. a message) to the log:

ADD_ITEM

Name

Description

Importing parameter

ITEM

Item which is added: Reference to interface IF_BALI_ITEM_SETTER

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OBJECT_NOT_ALLOWED:

    Access to the log object of the header is not allowed

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED:

    The memory of the log was released. The log can't be used

CX_BALI_INVALID_PARAMETER

The log object or subobject of the header don't exist

CX_BALI_INTERNAL_ERROR

Internal error during processing

Note:

An exception may contain a message. This means that the ABAP exception class contains interface IF_T100_MESSAGE, or it contains at least the attributes T100_MSGID and T100_MSGNO. In this case, the exception is internally converted into a message before it is added to the log.

If the item is a message, it's checked whether the log already contains another message with identical message attributes. These are the attributes: severity, message ID, message number and message variable 1 - 4. If this message exist, the message counter of the message is increased by 1. Otherwise, a new message is added to the log. Also free texts and exceptions are always added to the log without cumulation.

CUMULATE_ITEM

Name

Description

Importing parameter

ITEM

Item which is cumulated or added: Reference to interface IF_BALI_ITEM_SETTER

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OBJECT_NOT_ALLOWED:

    Access to the log object of the header is not allowed

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED:

    The memory of the log was released. The log can't be used

CX_BALI_INVALID_PARAMETER

The log object or subobject of the header don't exist

CX_BALI_INTERNAL_ERROR

Internal error during processing

Note:

An exception may contain a message. This means that the ABAP exception class contains interface IF_T100_MESSAGE, or it contains at least the attributes T100_MSGID and T100_MSGNO. In this case, the exception is internally converted to a message before it is added to the log (but this message is not cumulated to an already existing message).

Add all messages from an internal table of type BAPIRETTAB table to the log:

ADD_MESSAGES_FROM_BAPIRETTAB

Name

Description

Importing parameter

MESSAGE_TABLE

An internal table with messages which use type BAPIRETTAB

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>TOO_MANY_ITEMS:

    The maximum number 999999 of items was reached

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED:

    The memory of the log was released. The log can't be used

CX_BALI_INVALID_PARAMETER

The message ID of one of the messages is initial

CX_BALI_INTERNAL_ERROR

Internal error during processing

Note:

If a message of the message table can't be added to the log, it's skipped and the processing continues until the end of the table is reached. Afterwards, an exception is raised to notify the caller that some of the messages couldn't be added to the log.

Add a message from the ABAP Restful Application Programming Model (interface IF_ABAP_BEHV_MESSAGE) to the log:

ADD_ABAP_BEHAVIOR_MESSAGE

Name

Description

Importing parameter

MESSAGE

A reference to the interface IF_ABAP_BEHV_MESSAGE

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>TOO_MANY_ITEMS: The maximum number 999999 of items was reached

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used

CX_BALI_INVALID_PARAMETER

The message ID of the messages is initial

CX_BALI_INTERNAL_ERROR

Internal error during processing

Add all items from another log to this log:

ADD_ALL_ITEMS_FROM_OTHER_LOG

Name

Description

Importing parameter

SOURCE_LOG

Reference to the log whose items are to be copied

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>TOO_MANY_ITEMS: The maximum number of 999999 items was reached

  • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used

CX_BALI_INVALID_PARAMETER

The source log is invalid. It contains a log handle which doesn't exist

CX_BALI_INTERNAL_ERROR

Internal error during processing

Note:

If the parameter SOURCE_LOG is initial, the processing is skipped and no exception is raised.

Add an item filter to the log. The item filter is checked before an item is added to the log using the methods ADD_ITEM, CUMULATE_ITEM, ADD_MESSAGES_FROM_BAPIRETTAB, or ADD_ABAP_BEHAVIOR_MESSAGE. If an item doesn't pass the filter, it's ignored.

SET_FILTER_FOR_ADD_ITEM

Name

Description

Importing parameter

FILTER

A reference to the item filter

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used

Note:

  • If FILTER is initial, any item filter is removed from the log. The log then no longer uses an item filter.

  • Since the method ADD_ALL_ITEMS_FROM_OTHER_LOG is intended for the mass-processing of items, it ignores the item filter because of performance reasons.

  • The filter is only used by methods of the class CL_BALI_LOG. If an application uses the application log function modules to add an item to the log, the filter is ignored.

Get the item filter which was set using SET_FILTER_FOR_ADD_ITEM.

GET_FILTER_FOR_ADD_ITEM

Name

Description

Returning parameter

FILTER

A reference to the item filter which is currently used by the log

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_POSSIBLE

ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used

Get a single item from the log:

GET_ITEM

Name

Description

Importing parameter

LOG_ITEM_NUMBER

Serial number of the item which shall be read (it is the position of the item in the log)

Returning parameter

ITEM

Item which was read: Reference to interface IF_BALI_ITEM_GETTER

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_FOUND

An item with the requested log item number does not exist

CX_BALI_NOT_POSSIBLE

ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used

CX_BALI_INTERNAL_ERROR

Internal error during processing

Get all items from the log:

GET_ALL_ITEMS

Name

Description

Returning parameter

ITEM_TABLE

Table of all items which are stored in the log. The table has the following structure:

  • LOG_ITEM_NUMBER: The serial number of the item in the log

  • ITEM: Item object: Reference to interface IF_BALI_ITEM_GETTER

Exceptions (inherit from CX_BALI_RUNTIME)

CX_BALI_NOT_FOUND

No item was found in the log

CX_BALI_NOT_POSSIBLE

ERROR_CODE: CX_BALI_NOT_POSSIBLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used

CX_BALI_INTERNAL_ERROR

Internal error during processing

RELEASE_MEMORY:

Remove the log from the memory. After this, the log is invalidated and can no longer be used.

Check whether the memory of the log was released in order to verify that the log is invalidated and can no longer be used.

IS_INVALIDATED

Name

Description

Returning parameter

IS_INVALIDATED

If set, the log is invalidated and can no longer be used