webdynpro 3

Embed Size (px)

Citation preview

  • 7/29/2019 webdynpro 3

    1/16

    SAP AG 2005, Title of Presentation / Speaker Name / #

    The structure of the context

    Context mapping

    Internal mapping

    Contents:

    The Context At Design Time

  • 7/29/2019 webdynpro 3

    2/16

    SAP AG 2005, Title of Presentation / Speaker Name / #

    After completing this topic, you will be able to:

    Understand the structure of the context

    Use the context editor

    Use internal context mapping

    The Context At Design Time: Topic Objectives

  • 7/29/2019 webdynpro 3

    3/16

    SAP AG 2005, Title of Presentation / Speaker Name / #

    The Context - The Heart of a Controller

    Controller

    Implementation

    StandardHook

    Methods

    Instance

    Methods

    Context

    Root Node

    RequiredControllers

    ControllerInterface

    Other WDControllers

    CustomController

    BusinessLogic

    (Models)

    Created by explicit declaration or coding Created by the Web Dynpro Framework (WDF)

    ComponentUsage

    Other WDComponents

  • 7/29/2019 webdynpro 3

    4/16

    SAP AG 2005, Title of Presentation / Speaker Name / #

    Changing the Context

    1) Open a controller (view orcustom) using the Changeoption in the context menu

    2) Choose the Contexttab.

    3) Display the Propertybyselecting the CONTEXTnode

  • 7/29/2019 webdynpro 3

    5/16

    SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Structure Design Time (1)

    Context Root Node

    Node

    Attribute

    Context menu on the Context Root Node

    Context Node:

    Are arranged hierarchically and are permitted to have children

    Children of a node may be entities known as other nodes or attributes

    Metadata description declared manually or derived from a Dictionary Structure

    Context Attribute:

    Stores runtime data or references to runtime data

    Based on DDIC Types

  • 7/29/2019 webdynpro 3

    6/16

    SAP AG 2005, Title of Presentation / Speaker Name / #

    Node Metadata (c=cardinality, s=singleton)

    IF_WD_CONTEXT_NODE_INFO (interface)

    Attribute Metadata (data type)WDR_CONTEXT_ATTRIBUTE_INFO (structure)

    Context Structure Design Time (2)

    All context nodes are collections.

    A node collection is composed of

    elements, where an element is anaggregation of the nodes immediate

    children (attributes and/or other nodes).

    The cardinalityproperty controls thenumber of elements a node collection

    may hold at runtime.Design time

    A node collection

    Context Root (c=1..1, s=true)

    FLIGHTS (c=0..n, s=true)

    PRICE

    Context Metadata

    CARRID

    CONNID

    FLDATE

    Context Metadata

    BOOKINGS (c=0..n, s=false)

    BOOKID

    CUSTOMID

    CLASS

    PASSNAME

  • 7/29/2019 webdynpro 3

    7/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Structure Runtime (1)

    All independent nodes are forced to be singletons. This is

    because the context root node has one and only one element.

    c=1..1, s=true

    Independent Node

    1Default

    Element

    c=0..1, s=true

    Independent Node

    1

    Context Root Node

    c=1..1, s=true

    1Default

    Element

    = Element created by an application at runtime

    = Element created by the WDF at context initialisation time

    Node collection is initially empty.

    Can contain a maximum of one element.

    Node collection contains a default element.

    Can contain a maximum of one element.

  • 7/29/2019 webdynpro 3

    8/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Structure Runtime (2)

    Context Root Node

    c=1..1, s=true

    1Default

    Element

    = Element created by an application at runtime

    = Element created by the WDF at context initialisation time

    Node collection is initially empty.

    Can contain as many elements as required.

    Node collection contains a default element.

    Can contain as many elements as required.

    = Element at the lead selection

    c=0..n, s=true

    Independent Node

    ..n2

    1

    c=1..n, s=true

    ..n2

    Independent Node

    1DefaultElement

    All independent nodes are forced to be singletons. This is

    because the context root node has one and only one element.

  • 7/29/2019 webdynpro 3

    9/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Structure Runtime (3)

    Design Time

    Context Root

    0Default

    Element

    The runtime structure of the

    context if node BOOKINGS is a

    non-singleton.

    Context Root (c=1..1, s=true)

    FLIGHTS (c=0..n, s=true)

    PRICE

    Context Metadata

    CARRID

    CONNID

    FLDATE

    Context Metadata

    BOOKINGS (c=0..n, s=false)

    BOOKID

    CUSTOMID

    CLASS

    PASSNAME

    ..nCARRID

    CONNID2CARRID

    CONNID1CARRID

    CONNID

    FLDATE

    FLIGHTS

    BOOKINGS

    ..nBOOKID

    CUSTOMID2BOOKID

    CUSTOMID1BOOKIDCUSTOMID

    BOOKINGS

    ..nBOOKID

    CUSTOMID2BOOKID

    CUSTOMID1BOOKID

    CUSTOMID

    BOOKINGS

    ..nBOOKID

    CUSTOMID2BOOKID

    CUSTOMID1BOOKID

    CUSTOMID

    Runtime

  • 7/29/2019 webdynpro 3

    10/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Root (c=1..1, s=true)

    FLIGHTS (c=0..n, s=true)

    PRICE

    Context Metadata

    CARRID

    CONNID

    FLDATE

    Context Metadata

    BOOKINGS (c=0..n, s=true)

    BOOKID

    CUSTOMID

    CLASS

    PASSNAME

    Context Structure Runtime (4)

    Design Time

    Context Root

    0Default

    Element

    The runtime structure of thecontext if node BOOKINGS is a

    singleton.

    BOOKINGS

    ..nBOOKID

    CUSTOMID2BOOKID

    CUSTOMID1BOOKID

    CUSTOMID

    Runtime

    ..nCARRID

    CONNID2CARRID

    CONNID1CARRID

    CONNID

    FLDATE

    FLIGHTS

  • 7/29/2019 webdynpro 3

    11/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Structure Why Singleton nodes?

    Context Root

    0Default

    Element

    Q: Why do singleton nodes exist?

    A: Efficiency!

    This design of context structure both copies

    the way users handle business data, andcauses the Web Dynpro application to

    consume significantly less memory.

    BOOKINGS

    ..nBOOKID

    CUSTOMID2BOOKID

    CUSTOMID1BOOKID

    CUSTOMID

    ..nCARRID

    CONNID2CARRID

    CONNID1CARRID

    CONNID

    FLDATE

    FLIGHTS

  • 7/29/2019 webdynpro 3

    12/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Supply Function

    Context node can be assigned a supply

    function

    This supply function is called by the runtime

    when the data of the context node is required

    Especially useful in combination with singleton

    nodes

    Context Root

    BOOKINGS

    ..nBOOKID

    CUSTOMID2BOOKID

    CUSTOMID1BOOKI

    DCUSTOMID

    ..nCARRID

    CONNID2CARRID

    CONNID 1CARRID

    CONNID

    FLDATE

    FLIGHTS

    Supply function

    BOOKINGS_READ

  • 7/29/2019 webdynpro 3

    13/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Mapping

    Context mapping is the primary mechanism for

    sharing data between different controllers.

    Advantages:

    Data is automatically available to all

    controllers using the mapping relationship

    Only one copy of the data is ever maintained

    Data can be mapped selectively, thus reducing

    the amount of data in a controllers context to

    the minimal set required to fulfil a task

  • 7/29/2019 webdynpro 3

    14/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    Context Mapping

    Drag and drop structure

    or create a node anddefine the mapping

    After the mapping themapped structure appears

    in the target context

    In the property of the node the mapping path is visible

  • 7/29/2019 webdynpro 3

    15/16 SAP AG 2005, Title of Presentation / Speaker Name / #

    W e b D y n p r o C o m p o n e n t

    Context Mapping: Internal Mapping

    View Controller Component Controller

    Mapping Relationship

    Context Root

    FLIGHTS

    Mapped node collection Node collection of mapping origin

    Controller

    Usage

    Declaration

    Context Root

    BOOKINGS

    BOOKID

    CUSTID

    CLASS

    PASSN

    PRICE

    CARRID

    CONNID

    FLDATE

    BOOKINGS

    BOOKID

    CUSTID

    CLASS

    PASSN

    PRICE

    CARRID

    CONNID

    FLDATE

    FLIGHTS

  • 7/29/2019 webdynpro 3

    16/16 SAP AG 2005 Title of Presentation / Speaker Name / #

    You should now be able to understand:

    The Structure of the Context

    Internal Context Mapping

    The Context At Design Time: Unit Summary