Show TOC

Manipulation of the Element ContentLocate this document in the navigation structure

Use

Activate this option in the Attributes display for the BSP element if it is necessary that this element can manipulate its own content.

Procedure

After this option is activated, the interface attribute M_OUT of the element handler class contains a so-called BodyWriter that manages the content of the BSP element. You can then use the BodyWriter methods to manipulate the content accordingly.

To change the element content, you must also redefine the interface method DO_AT_END for the element handler class as well as activate the option Manipulation of the Element Content.

This method is accessed in any case at the end of the element call. You can use them especially for manipulating the content in order to explicitly pass the BodyWriter content to the BodyWriter of a surrounding BSP element. If no pass takes place in this case, the element content is discarded.

Example

In the following example, a BSP element is to convert its entire text content into upper-case letters. The method DO_AT_END is overwritten as follows:

First, the element content from the current BodyWriter m_out is written to the local variable content. A new content is then assigned to this variable. Afterwards, the method call me->get_previous_out() returns the BodyWriter of the surrounding element previous_out. The new content, however, is not automatically copied to this BodyWriter. The assignment of the new content finally takes place with the method print_string().

method IF_BSP_ELEMENT~DO_AT_END.
data: content type string.
  content = m_out->get_content( ).
  translate content to upper case.

data: previous_out type ref to IF_BSP_WRITER.
  previous_out = me->get_previous_out().
  previous_out-> print_string( content ).
  rc = CO_PAGE_CONTINUE.
endmethod.