DOC

x_ComponentReuse-SOLUTION

By Susan Wright,2014-09-18 09:29
12 views 0
x_ComponentReuse-SOLUTION

    Component Reuse, Solution

    Chapter: Structuring Web Dynpro Applications

    Theme: Development Component Reuse

    At the end of this Exercise, you are able to:

    ; Reuse a Web Dynpro development component.

    Developing, Step-by-Step

    Launch the NetWeaver Developer Studio.

     1 Launch the NetWeaver Developer Studio

    Make sure your J2EE Engine is running.

    Start > Programs > SAP NetWeaver

    Developer Studio > SAP NetWeaver

    Developer Studio

    This will start the SAP NetWeaver

     Developer Studio

    From within the NetWeaver Developer

    Studio, switch to the Development

    Configurations Perspective.

    2

    Create New Development Components: wddc1, wddc2

The Development Configurations

    Perspective is a collection of multiple views that help you manage development

    components.

From within the Local DCs view, expand

    the Local Development node. Right click on the MyComponents node and select “Create new DC.”

    This will launch the New Development Component project wizard. We will need to specify the Name and Type of the development component we are creating.

Enter the following information:

Name: wddc1

    Caption: Web Dynpro Development

    Component 1

    Type: Web Dynpro

Select Next >.

    The next screen will show you the name and location of the project that is being

    created. Everything here is fine, go ahead and select Finish.

    The NetWeaver Developer Studio will automatically switches you back to the

    Web Dynpro Explorer within the Web

    Dynpro Perspective so you can begin working on your development component

    project. However, our exercise explores the concepts of component reuse, so we will need at least two development

    components.

Repeat the steps contained within this

    section (2) this time creating a development component named wddc2.

    Once your Web Dynpro Explorer contains both development component wddc1 and wddc2, then you can move on to section 3.

    Save the new project data by choosing Save All Metadata from the toolbar.

     3

    Create the applications

From within the Web Dynpro Explorer

    select the project:

LocalDevelopment~wddc1~sap.com

wddc1

    Expand the Web Dynpro node to expose the following:

     Applications

     Models

     Web Dynpro Component Interfaces

     Web Dynpro Components

    Right click on the Applications and select Create Application

    This will launch the New Application wizard. We will need to give our new application a name and package. Enter the

    following:

Name: WDDC1app

    Package:

    com.sap.webdynpro.component.reuse

Select Next >

Select the option to Create a New

    component.

Select Next >

    Make sure the option to Embed new View is selected with the View Name of WDDC1appView and the same package.

    If the option has not been selected by default enter in the information.

Select Finish

    You should now be able to expand the Web Dynpro Components node of the wddc1 development component to see the Web Dynpro Component (WDDC1app) we

    added, as well as the View

    (WDDC1appView) we added to that Web Dynpro component.

    We now need to create the application, Web Dynpro component, and Web Dynpro View for the second development component. Repeat all of the steps in this

    section (3) using the following.

Application Name:

     WDDC2app

    Web Dynpro Component

     WDDC2app

    View

     WDDC2appView

    Package: com.sap.webdynpro.component.reuse

    Save the new project data by choosing Save All Metadata from the toolbar.

    4

    Add a new Public Part to wddc1

In the Web Dynpro Explorer:

Expand the

    LocalDevelopment~wddc1~sap.com development component so you can see the following nodes:

DC Metadata

     Web Dynpro

    Dictionaries

    src

    Expand the DC Metadata node to expose the Public Parts attribute.

Right click on the Public Parts attribute

    and select New Public Part.

This will launch the Add Public Part

    wizard.

When the Public Part wizard comes up we

    will need to assign our new public part a unique name. Enter the name wddc1pp and select Next >.

We have to define the entity

    The Public Part wizard will allow you to select next and drill down to the specific entities that you wish to expose as a public part. For the purposes of our exercise we will accept the defaults.

    You should now see the Public Part wddc1pp that you just created in the Web Dynpro Explorer.

    Save the new project data by choosing Save All Metadata from the toolbar.

     5

    Add Used Development Component: wddc2(wddc1pp)

    Now that we have created our supplier development component (wddc1) and given it a public part (wddc1pp) that can be reused, we will need to configure our second development component (wddc2) to become the consumer.

In the Web Dynpro Explorer:

Expand the

    LocalDevelopment~wddc2~sap.com

    development component to the following attribute.

DC Metadata > DC Definition > Used DCs

Right click on Used DCs and select Add

    Used DC…

    This will launch a wizard that will help us select the Development Component’s Public Part that we would like to reuse in our Development Component (wddc2).

Select the public part that we defined in the

    previous section by following the path:

    Local Developments > MyComponents > wddc1 > DC MetaData > Public Parts > wddc1pp

    Our development component (wddc2) now has a dependency relationship with another

    development component (wddc1).

    From within the Web Dynpro Explorer you

    can now see the dependency on the first

    development component. Under the Used

    DCs node you will see all of the default

    dependencies as well as the one we’ve just

    declared.

Save the new project data by choosing Save All Metadata from the toolbar.

     6

    Build Development Component : wddc1

    From within the Web Dynpro Explorer

    select the project:

    LocalDevelopment~wddc1~sap.com

    wddc1

    Right click on

    LocalDevelopment~wddc1~sap.com and

    select Development Components > Build…

    This wizard will allow you to select the

    development component that you would

    like to build. Make sure wddc1 have been

    checked and select OK.

    Building the DC.

Save the new project data by choosing Save All Metadata from the toolbar.

     7

    Deploy Development Component : wddc1

    From within the Web Dynpro Explorer

    select the project:

    LocalDevelopment~wddc1~sap.com

    wddc1

    Right click on

    LocalDevelopment~wddc1~sap.com >

    Development Components > and select

    Deploy.

Report this document

For any questions or suggestions please email
cust-service@docsford.com