Using Object messages

Procedure

If you want to see the content of the messages object (see also Object messages), you can first display a simple table containing the messages. Insert the following code to the body of page default.htm:

<%-- if there are messages, we want to display them in a table --%>
<% if page->messages->num_messages( ) > 0. %>
 <h2 class="bspH2" style="background-color:red">Es sind folgende Fehler aufgetreten</h2>
  <table class="bspTbvStd">
  <tr class="bspTbvHdrStd">
  <th class="bspTbvHdrStd">Index</th>
  <th class="bspTbvHdrStd">Bedingung</th>
  <th class="bspTbvHdrStd">Text</th>
  <th class="bspTbvHdrStd">Schwere</th>
  </tr>

  <%
  data: condition type string,
  message type string,
  severity type i,
  ind type i.
  ind = page->messages->num_messages( ).
  do ind times.
  call method page->messages->Get_message
  exporting index = sy-index
  importing condition = condition
  message = message
  severity = severity.
  %>
    <tr class="bspTbvCellStd">
    <td>  <%= sy-index %>  </td>
    <td>  <%= condition %>  </td>
    <td>  <%= message %>  </td>
    <td>  <%= severity %>  </td>
    </tr>
   <% enddo. %>
   </table>   <p>
<% endif. %>
         

If you then test by using incorrect entries (for example, enter 47 as the time), you can see the error message(s).

Be aware of the following: