cancel
Showing results for 
Search instead for 
Did you mean: 

supply functions

Former Member
0 Kudos

Hi experts,

Supply functions are applicable for which type of Nodes ?

Thanks,

Teja

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Contexts do not only contain nodes that are independent of each other on one level, but also those that are hierarchically related to each other. A node (called a parent node) can contain other nodes (child nodes). Context nodes directly below the root node are known as independent nodes; all the other nodes are called dependent nodes. Whereas the content of the independent nodes is determined directly by the application, in contrast to this, the content of the child nodes (node elements in the node collection of a child node) depends on which node element they refer to in the parent node. The mechanism that automatically obtains node elements for a dependent node is based on what are called supply functions.

the Web Dynpro programming model provides the concept of supply functions to fill context nodes (or more precisely u2013 their node collections). They can be defined for all value nodes (both dependent as well as independent ones), by assigning a method name to the node property supplyFunction in a controller context at design time. The Web Dynpro tools also automatically enhance the corresponding controller class with a supply function including the user coding area contained in it.

Regards,

H.V.Swathi

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Why are supply function needed?

- A supply is needed primarily to populate a singleton node's element collection.

- However if required, any context node can have a supply function defined for it.

Singleton Nodes

It is very important to remember the difference in runtime behaviour between a singleton node and a non-singleton node. When a node is declared to be singleton, there will only ever be only one instance of that node-irrespective of the number of elements found in the parent node's element collection. This is not the case for the non-singleton node. In this case, there will be as many instances of the non-singleton child nodes as there are elements in the parent node's element collection.

The significant point here is that when the lead selection in the parent element collection changes, the contents of the singleton child node become invalid. Consequently, the next time data is required from the singleton child node, the entire element collection must be rebuild in order that it match the data in the newly selected parent element.

The task of rebuilding singleton child node must be performed by a dedicated supply function.

singleton node is related to its parent node collection.

why do singleton node exists?

When a typical business transaction is being used, information will often be presented in the form of a list of header records of some sort; for instance, sales order headers. From this list, the user will typically select one order header and then look at its line items. It makes much better sense to read the line item information only when it is needed, rather than to read all the line items for all the sale orders in the hope that the user PLJKW want to look at the information! This would be a highly inefficient application architecture both in terms of processing requirements and memory usage.When a typical business transaction is being used, information will often be presented in the form of a list of header records of some sort; for instance, sales order headers. From this list, the user will typically select one order header and then look at its line items. It makes much better sense to read the line item information only when it is needed, rather than to read all the line items for all the sale orders in the hope that the user PLJKW want to look at the information! This would be a highly inefficient application architecture both in terms of processing requirements and memory usage.

To know more about supply functions, refer to

http://help.sap.com/saphelp_nw04/helpdata/en/86/7fcf3d4f902d10e10000000a114084/frameset.htm 

/people/sap.user72/blog/2005/03/15/supply-functions-in-webdynpro

Regards,

Sunaina Reddy T

Former Member
0 Kudos

Hi teja

Supply function principles:

A supply function is used to populate an entire node collection.

Any context node may have a supply function defined for it.

All singleton nodes must have a supply function defined.

The existence of a supply function is defined declaratively.

A supply function is called automatically by the Web Dynpro Runtime when an attempt is made to read an empty node collection

A node collection could be empty node collection

A node collection could be empty for any one of the following 3 reasons.

1. It has never been populated before.

2. The lead selection in the parent node collection has changed.

3. Application coding has explicitly invalidated the element collection.

For more information goto wiki link

https://www.sdn.sap.com/irj/scn/wiki?path=/display/wdjava/supplyFunctionin+Webdynpro

Regards

Ruturaj

Former Member
0 Kudos

Hi Teja,

NetWeaver Help contains the following details about Web Dynpro Supply Functions (under Web Dynpro - Advanced Web Dynpro Technologies - Context Description - Nodes and Node Elements - Supply Functions):

Invalid Context Nodes and Validation by Supply Functions

A supply function is called by the Web Dynpro runtime environment if node elements of an invalid context node are accessed. The Web Dynpro runtime environment executes a node validation.

Context nodes are set to invalid status under the following conditions:

· Initialization: Contexts are initialized by the Web Dynpro runtime environment as required. This means they only contain empty object instances.

· Changing the lead selection in the parent node: If the lead selection of the parent node changes, child nodes of type Singleton are invalidated by the Web Dynpro runtime environment.

· Invalidation using controller coding: The application developer can place context nodes into an invalid state directly using interface method IWDNode.invalidate(). The invalidation for child nodes takes place implicitly after the invalidation of parent nodes.

A context node is validated by the Web Dynpro runtime environment according to the following sequence of steps. If a condition is fulfilled, the check is terminated:

· The node is already valid: nothing happens.

· A supply function was defined for the node: the supply function is called

· Cardinality of the node is 1..1 or 1..n: a node element is added.

· An empty list of node elements is added.

As an application developer you can also force the validation of a context node using method IWDNode.validate().

Access to a context node requires its validation. The following forms of access are available:

· Data binding: UI elements are bound to context elements in context nodes and have to be supplied with data by the Web Dynpro runtime environment. Context nodes are validated for this by the Web Dynpro runtime environment.

· API access: The application developer access node elements using interface methods such as getCurrentElement(), getElementAt(index). If these node elements are located in invalid context nodes, they are validated before the actual method call

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/10b4b51f-b5dc-2910-e393-a5fa3232...

Regards,

Sri