Entering content frame

This graphic is explained in the accompanying text Filling the Context Locate the document in its SAP Library structure

The values of the context elements play a crucial role in Web Dynpro for ABAP. Therefore, the filling and changing the context must be thoroughly planned. Depending on when the context is to be filled or updated, you can choose from the following methods.

 

WDDOINIT

The method WDDOINIT is the initialization method of the controller. If you know beforehand that the context in your application is only filled once and not invalidated afterwards, this method is appropriate for filling the context. You can also use this method if you want to associate the data update with an action and transfer the update to the corresponding event handler.

This graphic is explained in the accompanying text The method WDDOINIT should only be used to fill those context nodes when it is known that they must be filled.

 

The order of calls for filling the context in this method is a bit more complex than in a supply function because the calls are not linked to a context node and the corresponding node must be first created as a reference.

 

method WDDOINIT.

 

data: NODE type ref to IF_WD_CONTEXT_NODE,

      FLIGHTS type SPFLI_TAB.

 

* get node from context

 

  NODE = WD_CONTEXT->GET_CHILD_NODE( 'CARRIER_NODE' ).

 

* get connections from help class

 

  FLIGHTS = CL_WD_GET_SPFLI=>GET_FLIGHTS( ).

 

  NODE->BIND_ELEMENTS( FLIGHTS ).

 

endmethod.

 

 
Supply Function

The filling of a context using a supply function is useful when the content of the node must be available on demand only. This is the case for singleton nodes, for example. The supply function is called when elements of the associated node are accessed. Very often, they are not accessed before rendering. From a technical point of view, the filling of the context in the supply function is the simplest, because the corresponding node is already available as a parameter (see example in chapter Supply Function).

 

This graphic is explained in the accompanying text Note that you always have to recreate the entire context node when updating the data using the supply function (you cannot use the supply function to fill individual elements of the context with new values). This may slow down the performance of a Web Dynpro application (see below).

 

Action Event Handlers

The response to an action of the user often requires the filling or change of a context. In this case, you can program the context in the event handler method of the action. In general, you have two options:

First option: The event handler only invalidates the node so that a supply function must be called automatically. The event handler method "assumes" that an appropriate implementation of the supply function exists.

The second option: The event handler itself fills the context. (You need to ensure that the event handler method is not bound to a specific context node. As is the case with the WDDOINIT method, the node to be filled is not directly available as a parameter, but must be created in a previous programming step).  

 

This graphic is explained in the accompanying text Regardless of the method you choose for filling a context, the following rule applies: When specifying the name of a node or attribute as a string in the source code of a method, you must use UPPERCASE.

 

Performance of the Context

Since the context provides many design options, can have many split small objects, and must act dynamically, you can have a significant control over the performance of a Web Dynpro application.

·         

 

Leaving content frame