Start of Content Area

Procedure documentation Creating a Component  Locate the document in its SAP Library structure

For the development of Web Dynpro components (from now on referred to as components), the Web Dynpro tools provide efficient support in the form of a wizard and automatic code generation. When you create a component, you simultaneously define the logical interface element window and a view.

Prerequisites

Before you define a component, you must create a Web Dynpro project.

Procedure

To create a component, proceed as follows:

...

       1.      In the Web Dynpro Explorer, place the cursor on the subnode This graphic is explained in the accompanying textWeb Dynpro Components of your project.

       2.      Choose This graphic is explained in the accompanying textCreate Web Dynpro Component from the context menu.

       3.      In the wizard, make the required entries, such as the name for the component and a component package.

This graphic is explained in the accompanying text

You should keep the name for the component and the package as short as possible. The path name of the URL generated for the application cannot exceed 255 characters.

       4.      When you define a component, a window is created simultaneously. By default, the system suggests the name of the component as the name for the window. However, you can also enter a different name for the window. Alternatively, you can select or create a different window package.

You also have the option of creating a view by leaving the Embed New View option checked (as is the default). You can either accept the suggested view name or enter a new one. The same applies to the view package.

       5.      Save the component by choosing Finish.

       6.      In the Web Dynpro Explorer, place the cursor on the newly created component and save the newly created elements by choosing This graphic is explained in the accompanying textSave All Metadata.

Result

The logical structure of a component is displayed in the Web Dynpro Explorer: The structure requires the creation or editing of the following component elements (this concerns the active part of the component definition, the controller:

·        Component controller

·        Component interface with an

¡        Interface controller

¡        Interface view

When you define a component, the Web Dynpro Generator creates a number of XML files and Java classes: In the Navigator view, you can open these files by choosing the context menu entry Open With Text Editor for a file in the directory \<myProject>\src\packages\<myPackage>.

Do not make any changes to the individual generated files:

File type

File name

Function

Component XML file

<MyComponent>.wdcomponent

Component definition file. This file has a reference to the following Web Dynpro elements:

- View

- View layout

- User messages

Controller XML files of the component

<MyComponent>.wdcontroller

The file assigns one controller to the component (cardinality 1:1).

 

<MyComponent>_WindowInterfaceView.wdcontroller

The file assigns the relevant window to the component (cardinality 1:1).

 

<MyComponent>Interface.wdcontroller

The file assigns the controller context to the component (cardinality 1:1)

 

<MyComponent>InterfaceCfg.wdcontroller

Configuration file of the file <MyComponent>Interface.wdcontroller.

Component interface XML file of the component

<MyComponent>Interface.wdcomponentinterface

The component interface implementation file assigns the various controllers and the interface view to the relevant component package.

Interface view XML file of the component

<MyComponent>_WindowInterfaceView.wdinterfaceview

The file assigns an inbound plug to the component for the application start  The inbound plug, which is actually an event handler, is bound to the window interface view.

Window XML file of the component

<MyComponent>_Window.wdwindow

The navigation links are fixed to the window – that is, to the interface view.

Window navigation XML file of the component

<MyComponent>_Window.wdnavigation

The file assigns the navigation links to the component element window.

XML file for the message processing of the component

<MyComponent>MessagePool.wdmessagepool

Assignment of message management to the component.

The directory \<MyProject>\gen_wdp\packages\<myPackage> contains the following classes of the component:

File type

File name

Component class

<myComponent>.java

Component interface

<myComponent>Interface.java

Configuration file for the component interface

<myComponent>InterfaceCfg.java

Class for the interface view of the component window

<myComponent>_WindowInterfaceView.java

The interface files of the component are stored in the subdirectory \<MyProject>\gen_wdp\packages\<myPackage>\gen_wdp:

File type

File name

Component interfaces

Internal<MyComponent>.java

 

IPrivate<MyComponent>.java

 

IPublic<MyComponent>.java

Component interface classes

IExternal<MyComponent>Interface.java

 

Internal<MyComponent>Interface.java

 

IPrivate<MyComponent>Interface.java

 

IPublic<MyComponent>Interface.java

Configuration files for the component interface classes

IExternal<MyComponent>InterfaceCfg.java

 

Internal<MyComponent>InterfaceCfg.java

 

IPrivate<MyComponent>InterfaceCfg.java

 

IPublic<MyComponent>InterfaceCfg.java

Window interface

Internal<MyComponent>_WindowInterfaceView.java

 

IPrivate<MyComponent>_WindowInterfaceView.java

 

IPublic<MyComponent>_WindowInterfaceView.java

Interface for user messages

IMessage<MyComponent>.java

The compiled files for the classes and interfaces listed above are stored in the directory \<myProject>\bin\<myPackage\wdp in the local file system. Additionally, the directory \wdp contains the interface files for the context nodes and context elements of the component context as well as the action handlers for the component and its interfaces.

Creating a Component Without an Interface View

The cardinality 1:1 exists between a window and the interface of a component. You can also define a component without an interface view, resulting in a component without its own user interface. To create such a component, proceed as follows:

Procedure

...

       1.      First, create a component as described above.

       2.      In the second step, delete the interface view of the component. To do so, delete the window from the component by choosing the context menu entry This graphic is explained in the accompanying textDelete for the window name in the Web Dynpro Explorer.

 

See also:

Nesting Components

Declaring Components

 

End of Content Area