Show TOC

Procedure documentationUsing Object messages Locate this document in the navigation structure

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:

Syntax Syntax

  1. <%-- 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. %>
End of the code.

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:

Note Note

  • Access to the messages object is via the attribute of page page->messages.

  • You use the method num_messages( ) to query the number of messages (that is, the number of entries in the list)

  • One way of accessing the error messages is by addressing them using the index

End of the note.