## 4.2.15.9.2.3.5  CL\_BALI\_MESSAGE\_SETTER (Interface IF\_BALI\_MESSAGE\_SETTER)
To add a new message to an application log an object of class CL\_BALI\_MESSAGE\_SETTER is used. The public interface of the instance methods is IF\_BALI\_MESSAGE\_SETTER . It contains the interface IF\_BALI\_ITEM\_SETTER .
## Public Attributes
| Name                       | Description                                                   |
|----------------------------|---------------------------------------------------------------|
| CATEGORY                   | Category of the item                                          |
| (from IF_BALI_ITEM_SETTER) | Contains fixed value: IF_BALI_CONSTANTS=>C_CATE- GORY_MESSAGE |
## Public Methods
Create a message class instance and set the message attributes:
CREATE (static)
| Name                 | Description                                                                                                 |
|----------------------|-------------------------------------------------------------------------------------------------------------|
| Importing parameters |                                                                                                             |
| SEVERITY             | (Optional): Severity of the message ('Error', 'Warning', etc) Default: IF_BALI_CONSTANTS=>C_SEVERITY_STATUS |
| ID                   | Message ID                                                                                                  |
| NUMBER               | Message number                                                                                              |
| VARIABLE_1           | (Optional): Message variable 1                                                                              |
| Name                | Description                                                       |
|---------------------|-------------------------------------------------------------------|
| VARIABLE_2          | (Optional): Message variable 2                                    |
| VARIABLE_3          | (Optional): Message variable 3                                    |
| VARIABLE_4          | (Optional): Message variable 4                                    |
| Returning parameter |                                                                   |
| MESSAGE             | Message object: A reference to interface IF_BALI_MES- SAGE_SETTER |
Create a message class instance. The message attributes are read from the fields of structure SY (like SYMSGID):
CREATE\_FROM\_SY (static)
## Name
Description
| Returning parameter   |                                                                   |
|-----------------------|-------------------------------------------------------------------|
| MESSAGE               | Message object: A reference to interface IF_BALI_MES- SAGE_SETTER |
Create a message class instance. The message attributes are read from a structure of type BAPIRET2:
CREATE\_FROM\_BAPIRET2 (static)
| Name                | Description                                                       |
|---------------------|-------------------------------------------------------------------|
| Importing parameter |                                                                   |
| MESSAGE_DATA        | Message attributes (a structure of type BAPIRET2)                 |
| Returning parameter |                                                                   |
| MESSAGE             | Message object: A reference to interface IF_BALI_MES- SAGE_SETTER |
Set attributes of the message:
SET\_ATTRIBUTES
| Name                 | Description                                                                                                 |
|----------------------|-------------------------------------------------------------------------------------------------------------|
| Importing parameters |                                                                                                             |
| SEVERITY             | (Optional): Severity of the message ('Error', 'Warning', etc) Default: IF_BALI_CONSTANTS=>C_SEVERITY_STATUS |
| ID                   | Message ID                                                                                                  |
| NUMBER               | Message number                                                                                              |
| Name                | Description                         |
|---------------------|-------------------------------------|
| VARIABLE_1          | (Optional): Message variable 1      |
| VARIABLE_2          | (Optional): Message variable 2      |
| VARIABLE_3          | (Optional): Message variable 3      |
| VARIABLE_4          | (Optional): Message variable 4      |
| Returning parameter |                                     |
| NEW_MESSAGE         | Reference to current message object |
Set message attributes from the fields of structure SY (like SY-MSGID):
SET\_FROM\_SY
## Name
## Description
| Returning parameter   | Returning parameter                 |
|-----------------------|-------------------------------------|
| NEW_MESSAGE           | Reference to current message object |
Set message attributes from structure BAPIRET2:
SET\_FROM\_BAPIRET2
## Name
| Importing parameter   |                                                   |
|-----------------------|---------------------------------------------------|
| MESSAGE_DATA          | Message attributes (a structure of type BAPIRET2) |
| Returning parameter   |                                                   |
| NEW_MESSAGE           | Reference to current message object               |
Set the level of detail of the item:
SET\_DETAIL\_LEVEL
## Name
Description
## Description
| Importing parameter   |                                                                            |
|-----------------------|----------------------------------------------------------------------------|
| DETAIL_LEVEL          | Detail level of the item Allowed values: Number between '1' and '9' or ' ' |
| Returning parameter   |                                                                            |
| NEW_MESSAGE           | Reference to current message object                                        |
Set the message context using a data dictionary structure:
## SET\_CONTEXT
| Name                                                 | Description                                                                                                                                                                                                                                                                                        |
|------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Importing parameters                                 |                                                                                                                                                                                                                                                                                                    |
| CONTEXT                                              | Structure with the context data                                                                                                                                                                                                                                                                    |
| NEW_MESSAGE                                          | Reference to the current message object                                                                                                                                                                                                                                                            |
| CX_BALI_INVALID_PARAMETER                            | • Field CONTEXT is not based on a database table or structure that is defined in the data dictionary • The total size of field CONTEXT is longer than 256 char- acters                                                                                                                             |
| Get all message values:                              |                                                                                                                                                                                                                                                                                                    |
| GET_ALL_VALUES                                       |                                                                                                                                                                                                                                                                                                    |
| Name                                                 | Description                                                                                                                                                                                                                                                                                        |
| Exporting parameters                                 |                                                                                                                                                                                                                                                                                                    |
| DETAIL_LEVEL                                         | Detail Level of the item (number between '1' and '9' or ' ')                                                                                                                                                                                                                                       |
| SEVERITY                                             | Severity of the message ('Error', 'Warning', etc)                                                                                                                                                                                                                                                  |
| ID                                                   | Message ID                                                                                                                                                                                                                                                                                         |
| NUMBER                                               | Message number                                                                                                                                                                                                                                                                                     |
| VARIABLE_1                                           | (Optional): Message variable 1                                                                                                                                                                                                                                                                     |
| VARIABLE_2                                           | (Optional): Message variable 2                                                                                                                                                                                                                                                                     |
| VARIABLE_3                                           | (Optional): Message variable 3                                                                                                                                                                                                                                                                     |
| VARIABLE_4                                           | (Optional): Message variable 4                                                                                                                                                                                                                                                                     |
| CONTEXT_DATA                                         | Structure and content of the context. CONTEXT_DATA has the following fields: • STRUCTURE_NAME : Nameof the data dictionary structure which was used for the context data • CONTENT : The content of the context data. The con- tent is stored in a character field with a length of 256 characters |
| Check whether the message can pass an item filter:   |                                                                                                                                                                                                                                                                                                    |
| CHECK_PASSING_ITEM_FILTER (from IF_BALI_ITEM_SETTER) |                                                                                                                                                                                                                                                                                                    |
| Name                                                 | Description                                                                                                                                                                                                                                                                                        |
| Importing parameter                                  |                                                                                                                                                                                                                                                                                                    |
## Name
## Description
| ITEM_FILTER         | Reference to the item filter that is being checked   |
|---------------------|------------------------------------------------------|
| Returning parameter |                                                      |
| FILTER_PASSED       | If set, the message can pass the item filter         |
##  Note
If the severity of the message contains a value which is not allowed, it is changed to IF\_BALI\_CONSTANTS=&gt;C\_SEVERITY\_DEFAULT . Allowed values of the severity can be found in interface IF\_BALI\_CONSTANTS .
If the detail level of the message contains a value which is not allowed, it is changed to IF\_BALI\_CONSTANTS=&gt;C\_DETAIL\_LEVEL\_DEFAULT . Allowed values of the detail level are a number between '1' and '9' and ' '.
If the message attributes are set from structure BAPIRET2 , only the fields TYPE, ID, NUMBER, MESSAGE\_V1, MESSAGE\_V2, MESSAGE\_V3 and MESSAGE\_V4 of the structure are considered.