# FORMAT_MESSAGE — Format Message Text

> Builds the complete text of a message from message class, number and up to four variables in the requested language. It is widely used to turn BAPIRET2 lines, SY-MSG fields or batch input messages into readable text for logs and ALV outputs. Pass the language explicitly (for example SY-LANGU); for BAPI messages MESSAGE_TEXT_BUILD or the MESSAGE field of BAPIRET2 are alternatives.

- Modules: CA
- Type: Function module
- Function group: SPOO
- Remote-enabled (RFC): No
- S/4HANA status: Used the same way in S/4HANA
- URL: https://nekuhub.com/en/functions/format-message/

## Importing parameters

| Parameter | Type | Description | Required |
|---|---|---|---|
| ID | - | Message class | - |
| LANG | - | Language | - |
| NO | - | Message number | - |
| V1 | - | Message variable 1 | - |
| V2 | - | Message variable 2 | - |
| V3 | - | Message variable 3 | - |
| V4 | - | Message variable 4 | - |

## Exporting parameters

| Parameter | Type | Description |
|---|---|---|
| MSG | - | Formatted message text |

## Exceptions

- NOT_FOUND: Message not found

## Call template (ABAP)

```abap
CALL FUNCTION 'FORMAT_MESSAGE'
  IMPORTING
    msg = lv_msg
  EXCEPTIONS
    not_found = 1
    OTHERS = 2.
```

## Related tables

T100

