Start of Content Area

Procedure documentation Using the Relate Context Attribute Template  Locate the document in its SAP Library structure

This template is used to copy one or more attribute values within a single context or across contexts and is available for the Web Dynpro application entities controller and view. With the aid of a wizard, you can pass the values and create the corresponding method using graphical means.

Prerequisites

You have created a project, a Web Dynpro component, and the entity for which you want to use the template. This can be a view, a custom controller, or a component controller. In addition, you must have created a context tree for this entity – as described in Context Structure – so that a copy source exists. Before starting the template, you must also create the target attribute to which the copy is to be passed.

Procedure

       1.      To use the template, place the cursor on the application entity in whose context you want to copy an attribute value; this is done in the Web Dynpro Explorer. Alternatively, you can also use this function in the Web Dynpro tool Data Modeler.

       2.      In the context menu, choose Template Apply followed by the template type. Accept the default name Relate Context Attributes for the template, or enter a new name.

       3.      Choose Next to proceed to the window for the copy function. The current context, which represents the copy target, is displayed in the right area of the window. In the left area of the window, you can select the source attribute from the same context tree as well as the contexts of all used controllers. This allows you to copy values from other contexts or copy values from controller contexts for views.

       4.      Use Drag&Drop to copy an attribute value from the left tree to an attribute of the right tree. For the purpose of the value transfer, it is irrelevant whether or not the target object already has a pre-assigned value. The value transfer is then graphically displayed by means of a black connecting arrow.

Note

You can copy several values one after the other using one template, either for the same target attribute or for different attributes. If you want to undo a copy process, select the relevant connecting line – displayed in red in edit mode – and choose Delete from the context menu. You can also still carry out this deletion if you have already switched to the wizard window for the method selection. Choose Back and make the changes.

 

       5.      To assign the operation, select one of the two methods available in the dropdown menu in the next wizard window (for example, wdDoInit or wdDoExit).Alternatively, you can choose New to create a new method. You can also specify whether the source code is to be inserted at the start or the end of the method. Close the wizard by choosing Finish.

Result

To display the generated source code, choose Implementation and navigate to the relevant method.

 

End of Content Area