
Adding Your Own Error Messages
Use
You can add your own error messages to the list during OnInputProcessing of the second page (
second.htm ).Procedure
Fill the event handler OnInputProcessing of
second.htm with the following coding:if page->messages->assert( 'date_at' ) ne 0.
date_at = sy-date + 1.
elseif date_at <= sy-date.
date_at = sy-date + 1.
page->messages->add_message(
condition = 'date_at'
message = 'The date must be in the future'
severity = page->messages->CO_SEVERITY_ERROR ).
endif.
if page->messages->assert( 'date_at' ) ne 0.
time_from = '080000'.
elseif time_from < '080000'
or time_from > '180000' .
time_from = '080000'.
page->messages->add_message(
condition = 'time_from'
message = 'Time must be between 08:00 and 17:00 o’clock'
severity = page->messages->CO_SEVERITY_ERROR ).
endif.
if page->messages->assert( 'date_at' ) ne 0.
time_to = time_from + 3600.
elseif time_to <= time_from.
time_to = time_from + 3600.
page->messages->add_message(
condition = 'time_to'
message = 'End time must occur after start time'
severity = page->messages->CO_SEVERITY_ERROR ).
endif.
The system checks whether the date and times are possible. The date must lie in the future and the time must lie in the working time (between 08:00 and 17:00 o‘clock). The end time must occur after the start time.
The same conditions apply to these entries (parameter condition) as to automatically generated error messages. The advantage of this is that no additional queries are required in the layout method.

This example deliberately omits translation issues. If you manage error messages using the Online Text Repository (OTR), they are automatically output in the required language thanks to the connection to the translation tools.
For information on the OTR directives, see the section
For information on using the OTR when creating BSP applications, see
Internationalization and Translation: Tutorial.