
Step 1 a) Implementing <sf:SimpleFormItem>
Since the
<sf:SimpleFormItem> requires an HTML <table> wrapper, first create the <sf:SimpleForm> element to render the correct HTML in the output stream.Within class
CL_BSP_TUTCMPLX_SIMPLE_FORM, overwrite and implement the following two methods:|
method IF_BSP_ELEMENT~DO_AT_BEGINNING . DATA: out TYPE REF TO IF_BSP_WRITER. endmethod.
method IF_BSP_ELEMENT~DO_AT_END . DATA: out TYPE REF TO IF_BSP_WRITER. endmethod. |
For the actual element
<sf:SimpleFormItem>, the rendering code is as follows:|
<tr><td> <htmlb:Label/> </td><td> <htmlb:inputField/> </td></tr> |
For the implementation, the HTML coding is fetched in the usual way using the current output writer, and written to the data stream.
Processing the
<htmlb:*> element is slightly more difficult. Since both elements are empty (that is, they don’t have a body), they can be processed in one step. The processing steps are as follows for each element:The complete coding is then as follows:
|
method IF_BSP_ELEMENT~DO_AT_BEGINNING . DATA: out TYPE REF TO IF_BSP_WRITER. * <tr><td> * <htmlb:Label/> CREATE OBJECT label. CONCATENATE me->id '_label' INTO label->id. m_page_context->ELEMENT_PROCESS( element = label ). * </td><td> * <htmlb:inputField/> DATA: inputField TYPE REF TO CL_HTMLB_INPUTFIELD. inputField->id = me->id. m_page_context->ELEMENT_PROCESS( element = inputField ). * </td></tr> rc = CO_ELEMENT_DONE. endmethod. |

Note that you cannot make any changed to the actual output writer structures. The coding, exactly like the inner elements that are processed, is executed on the current writer. This is automatically controlled by the development environment (indirectly using the
PROCESS_ELEMENT call).You can now test page after.htm.
The following task appears:

Continue with Step1 b) Using <htmlb:SimpleFormItem>