Entering content frame

Background documentation Context Change Log (Recording User Entries) Locate the document in its SAP Library structure

In many applications, it is important to mark user entries as such. If, for example, many bound UI elements are displayed in a view, but only one single value changes through a user entry, this can have an unnecessary negative effect on performance – when all the context contents are again processed by the business logic. It is more appropriate to mark the changes that the user has made within the view and to edit them separately. The changes which the user can make include changing the value of an attribute and converting the selection or the lead selection.

First of all, each context node provides the option of storing the relevant information for itself. However, so that not all existing context nodes of a controller have to be checked, the Web Dynpro Framework provides the context change log function. Within a controller, all the information on user-based changes to context elements are stored in a single internal table only. The Web Dynrpo runtime has access to this table and can adapt the flow of business logic to the table entries.

Note The table records solely changes made by the user; changes to context elements that were made in the programs (for example, dynamic programming) are not listed.

The function of the context change log is switched off in the controller default settings. You may activate it as required. You do this through the IF_WD_CONTEXT interface of the respective controller.

 

The IF_WD_CONTEXT Interface

The IF_WD_CONTEXT interface provides a reference to the controller context.

Caution In contrast to the IF_WD_CONTEXT_NODE interface, IF_WD_CONTEXT does not refer to the root node of the context but to the context as a whole.

 

Use the following call to get a reference to IF_WD_CONTEXT:

 

MY_CONTEXT = WD_CONTEXT->GET_CONTEXT( ). 

 

The following methods are available with the interface IF_WD_CONTEXT for using the change log function:

ENABLE_CONTEXT_CHANGE_LOG( )

Switches on the recording of user entries for this controller.

DISABLE_CONTEXT_CHANGE_LOG( )

Switches the recording off again.

GET_CONTEXT_CHANGE_LOG( and_reset )

Supplies the current content of the change log table and automatically resets this (the latter feature is set as default, but can be switched off as well).

RESET_CONTEXT_CHANGE_LOG( )

Resets the change log table.

ADD_CONTEXT_ATTRIBUTE_CHANGE( )

Using this method, changes to a context attribute can be programmed into the change log table. This is particularly important during programming of input helps since the data selected from the help is not automatically entered into the change log table.

 

Table of User-Defined Context Changes

The table in which the user-defined changes to context are listed is of the type WDR_CONTEXT_CHANGE_LIST. It contains nine columns which have the following meanings:

NODE_NAME

Name of the node that contains the change

SEQUENCE

Current number of the entry

NODE

Reference to the node

NODE_PATH

Node path

CHANGE_KIND

Categorizes the type of change ; the constants are available for the values

IF_WD_CONTEXT=>CHANGED_*

ELEMENT_INDEX

Index of the context element

ATTRIBUTE_NAME

Name of the attribute that was changed

OLD_VALUE

Reference to the current value

NEW_VALUE

Reference to the new value

With regard to the values in the columns OLD_VALUE und NEW_VALUE, a copy is first made of the old and the new attribute values. A reference to this copy is then stored in the table.

Note Changes in the lead selection are also recorded as changes in the selection.

Note In the case of OVS input help or freely programmed input help, the new value is not entered automatically into the table but must be entered actively using the method ADD_CONTEXT_ATTRIBUTE_CHANGE of the interface IF_WD_CONTEXT – provided an entry is desired.

 

You will find an example application DEMO_CONTEXT_CHANGES in your system in the package SWDP_DEMO.

 

 

 

Leaving content frame