## 4.2.15.9.2.3.1  CL\_BALI\_LOG\_DB (Interface IF\_BALI\_LOG\_DB)
Class CL\_BALI\_LOG\_DB handles all database accesses of the application logs. This includes the reading of one or several logs from the database, writing a log to the database and deleting a log from the database. In addition, it offers methods to set and clear an SAP enqueue on a log. The public interface of the instance methods is IF\_BALI\_LOG\_DB .
## Public Methods
Get an Instance of the Database Handler:
GET\_INSTANCE (static)
| Name                | Description                                                      |
|---------------------|------------------------------------------------------------------|
| Returning parameter | Returning parameter                                              |
| DB_HANDLER          | Database handler object: A reference to interface IF_BALI_LOG_DB |
Load a single log from the database into the memory:
LOAD\_LOG
| Name                                      | Description                                                                        |
|-------------------------------------------|------------------------------------------------------------------------------------|
| Importing parameters                      |                                                                                    |
| HANDLE                                    | Handle of the Application Log which shall be read                                  |
| READ_ONLY_HEADER                          | (Optional): If set, only the header of the log is read (no items) Default: Not set |
| Returning parameter                       |                                                                                    |
| LOG                                       | Log which was read from the database: Reference to inter- face IF_BALI_LOG         |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                    |
| CX_BALI_NOT_FOUND                         | • The log handle is initial • The log was not found in the database                |
## Name
## Description
| CX_BALI_NOT_POSSIBLE   | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>NO_AU- THORIZATION: No authorization to access the log   |
|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CX_BALI_INTERNAL_ERROR | Internal error during processing                                                                                                                                                               |
##  Note
It is recommended to use method LOAD\_LOG\_WITH\_ITEMS if all items should be loaded.
The following authorization is checked:
Authorization Object: S\_APPL\_LOG with:
- ALG\_OBJECT: Object name of the application log
- ALG\_SUBOBJ: Subobject of the application log
- ACTVT: 03
Load a single log including all items from the database into the memory:
LOAD\_LOG\_WITH\_ITEMS
| Name                                      | Description                                                                                                                                                                                  |
|-------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Importing parameters                      |                                                                                                                                                                                              |
| HANDLE                                    | Handle of the application log that should be read                                                                                                                                            |
| Returning parameter                       |                                                                                                                                                                                              |
| LOG                                       | Log that was read from the database: Reference to interface IF_BALI_LOG                                                                                                                      |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                                                                                                                              |
| CX_BALI_NOT_FOUND                         | • The log handle is initial • The log was not found in the database                                                                                                                          |
| CX_BALI_NOT_POSSIBLE                      | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>NO_AU- THORIZATION: No authorization to access the log |
| CX_BALI_INTERNAL_ERROR                    | Internal error during processing                                                                                                                                                             |
##  Note
The following authorization is checked:
Authorization Object: S\_APPL\_LOG with:
- ALG\_OBJECT: Object name of the application log
- ALG\_SUBOBJ: Subobject of the application log
- ACTVT: 03
Load several logs via a filter from the database into the memory:
LOAD\_LOGS\_VIA\_FILTER
Name
Description
| Importing parameters                      |                                                                                               |
|-------------------------------------------|-----------------------------------------------------------------------------------------------|
| FILTER                                    | Log filter object: Reference to interface IF_BALI_LOG_FILTER                                  |
| READ_ONLY_HEADER                          | (Optional): If set, only the headers of the logs are read (no items) Default: Not set         |
| Returning parameter                       |                                                                                               |
| LOG_TABLE                                 | Table of logs which were read from the database: Table of references to interface IF_BALI_LOG |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                               |
| CX_BALI_NOT_FOUND                         | No log can be returned which fits to the filter criteria                                      |
| CX_BALI_INVALID_PARAMETERS                | • The filter contains invalid values • The filter is initial or empty                         |
| CX_BALI_INTERNAL_ERROR                    | Internal error during processing                                                              |
##  Note
It is recommended to use method LOAD\_LOGS\_W\_ITEMS\_VIA\_FILTER if all items should be loaded.
The following authorization is checked:
Authorization Object: S\_APPL\_LOG with:
- ALG\_OBJECT: Object name of the application log
- ALG\_SUBOBJ: Subobject of the application log
- ACTVT: 03
If the object of a log is not allowed or if the log doesn't pass the authorization check, it is removed from the table of logs which is returned. An exception is only raised if the final table is empty.
Load several logs including all items via a filter from the database into the memory:
## LOAD\_LOGs\_W\_ITEMS\_VIA\_FILTER
## Name
## Description
| Importing parameters                      | Importing parameters                                                                          |
|-------------------------------------------|-----------------------------------------------------------------------------------------------|
| FILTER                                    | Log filter object: Reference to interface IF_BALI_LOG_FILTER                                  |
| Returning parameter                       | Returning parameter                                                                           |
| LOG_TABLE                                 | Table of logs which were read from the database: Table of references to interface IF_BALI_LOG |
| Exceptions (inherit from CX_BALI_RUNTIME) | Exceptions (inherit from CX_BALI_RUNTIME)                                                     |
| CX_BALI_NOT_FOUND                         | No log can be returned that fits to the filter criteria                                       |
| CX_BALI_INVALID_PARAMETERS                | • The filter contains invalid values • The filter is initial or empty                         |
| CX_BALI_INTERNAL_ERROR                    | Internal error during processing                                                              |
##  Note
The following authorization is checked:
Authorization Object: S\_APPL\_LOG with:
- ALG\_OBJECT: Object name of the application log
- ALG\_SUBOBJ: Subobject of the application log
- ACTVT: 03
If the object of a log is not allowed or if the log doesn't pass the authorization check, it's removed from the table of logs that is returned. An exception is only raised if the final table is empty.
Save a single log to the database using the default database connection:
SAVE\_LOG
## Name
## Description
| Importing parameters                      |                                                                                                                                                                          |
|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| LOG                                       | Log that should be saved: Reference to interface IF_BALI_LOG                                                                                                             |
| USE_2ND_DB_CONNECTION                     | Deprecated: Please use method SAVE_LOG_2ND_DB_CON- NECTION instead                                                                                                       |
| ASSIGN_TO_CURRENT_APPL_JOB                | (Optional): If set, and if the application runs in an application job, a connection between the application log and an appli- cation job is established Default: Not set |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                                                                                                          |
## Name
## Description
| CX_BALI_NOT_POSSIBLE   | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>SAVE_NOT_ALLOWED: • Log object and log subobject are empty • Locking of the log is not possible • Error during saving into the database • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used   |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CX_BALI_INTERNAL_ERROR | Internal error during processing                                                                                                                                                                                                                                                                                                                                                                       |
##  Note
If parameter LOG is initial, the method returns without exception.
Save a single log to the database using a service connection to the database:
SAVE\_LOG\_2ND\_DB\_CONNECTION
## Name
## Description
| Importing parameters                      |                                                                                                                                                                          |
|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| LOG                                       | Log that should be saved: Reference to interface IF_BALI_LOG                                                                                                             |
| ASSIGN_TO_CURRENT_APPL_JOB                | (Optional): If set, and if the application runs in an application job, a connection between the application log and an appli- cation job is established Default: Not set |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                                                                                                          |
## Name
## Description
| CX_BALI_NOT_POSSIBLE   | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>SAVE_NOT_ALLOWED: • Log object and log subobject are empty • Locking of the log is not possible • Error during saving into the database • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used   |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CX_BALI_INTERNAL_ERROR | Internal error during processing                                                                                                                                                                                                                                                                                                                                                                       |
##  Note
A commit is executed on the service connection after the saving.
If parameter LOG is initial, the method returns without exception.
Delete a single log from the database:
## DELETE\_LOG
| Name                                      | Description                                                                                                                                                                                                                                                                                                       |
|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Importing parameters                      |                                                                                                                                                                                                                                                                                                                   |
| LOG                                       | Log which shall be saved: Reference to interface IF_BALI_LOG                                                                                                                                                                                                                                                      |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                                                                                                                                                                                                                                                   |
| CX_BALI_NOT_POSSIBLE                      | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>NO_AU- THORIZATION: No authorization to access the log • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used |
| CX_BALI_NOT_FOUND                         | The log was not found in the database                                                                                                                                                                                                                                                                             |
| CX_BALI_INTERNAL_ERROR                    | Internal error during processing                                                                                                                                                                                                                                                                                  |
##  Note
- If parameter LOG is initial, the method returns without exception.
- The following authorization is checked: Authorization Object: S\_APPL\_LOG with:
- ALG\_OBJECT: Object name of the application log
- ALG\_SUBOBJ: Subobject of the application log
- ACTVT: 06
Set an SAP enqueue on a log:
ENQUEUE
| Name                                      | Description                                                                                                                                                                                                                                                                                                                               |
|-------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Importing parameters                      |                                                                                                                                                                                                                                                                                                                                           |
| LOG                                       | Log which shall be saved: Reference to interface IF_BALI_LOG                                                                                                                                                                                                                                                                              |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                                                                                                                                                                                                                                                                                                           |
| CX_BALI_NOT_POSSIBLE                      | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>EN- TRY_IS_LOCKED: The enqueue can't be set, because the log is already locked • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used |
CX\_BALI\_INTERNAL\_ERROR
##  Note
If parameter LOG is initial, the method returns without exception.
Clear an SAP enqueue from a log:
DEQUEUE
## Name
## Description
| Importing parameters                      |                                                              |
|-------------------------------------------|--------------------------------------------------------------|
| LOG                                       | Log which shall be saved: Reference to interface IF_BALI_LOG |
| Exceptions (inherit from CX_BALI_RUNTIME) |                                                              |
Internal error during processing
## Name
## Description
| CX_BALI_NOT_POSSIBLE   | • ERROR_CODE: CX_BALI_NOT_POSSIBLE=>OB- JECT_NOT_ALLOWED: Access to the log object is not allowed • ERROR_CODE: CX_BALI_NOT_POSSI- BLE=>LOG_WAS_INVALIDATED: The memory of the log was released. The log can't be used   |
|------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CX_BALI_INTERNAL_ERROR | Internal error during processing                                                                                                                                                                                         |
<!-- image -->
##  Note
If parameter LOG is initial, the method returns without exception.