
If a request is successful, warnings and success messages can be returned to the consumer in the new HTTP header SAP-Message. The format of the messages can be either set by the URL option format=json or in case of a modifying request with an empty response by using the request header Accept: application/json.
Example of adding a message in the header SAP-Message:
lo_message_container->add_message(
iv_msg_type = /iwbep/cl_cos_logger=>warning
iv_msg_id = /iwbep/cx_tea_business=>team_id_out_of_range-msgid
iv_msg_number = /iwbep/cx_tea_business=>team_id_out_of_range-msgno
iv_add_to_response_header = abap_true
).
<notification xmlns:sap="http://www.sap.com/Protocols/SAPData">
<code>/IWBEP/CM_TEA/004</code>
<message>Team ID 'XXX_I' is not in the defined range.Team ID 'XXX_I' is not in the defined range.</message>
<severity>info</severity>
<target></target>
<details>
<detail>
<code>/IWBEP/CM_TEA/004</code>
<message>Team ID 'XXX_E' is not in the defined range.</message>
<target>Team_Itentifier</target>
<severity>error</severity>
</detail>
<detail>
<code></code>
<message>Message text directly set as warning.</message>
<target>Name</target>
<severity>warning</severity>
</detail>
</details>
</notification>
Response in http-header sap-message JSON:
{
"code":"/IWBEP/CM_TEA/004",
"message":"Team ID 'XXX_I' is not in the defined range.",
"severity":"info",
"target":"",
"details": [
{
"code":"",
"message":"Message text directly set as warning.",
"target":"Name",
"severity":"warning"
}
]
}
End of the code.