98
1 Custom development of web dynpro ESS applications using Floor Plan Manager

Custom development of web dynpro ess applications using floor plan manager

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Custom development of web dynpro ess applications using floor plan manager

1

Custom development of web dynpro ESS applications using Floor Plan Manager

Page 2: Custom development of web dynpro ess applications using floor plan manager

2

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 2

Agenda

Harald Reiter, PMPProject Manager,

Page 3: Custom development of web dynpro ess applications using floor plan manager

3

Add source code to WD components

Demo and screenshots

Session Abstract

Create WD components

Page 4: Custom development of web dynpro ess applications using floor plan manager

4

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 4

Session Abstract: What

Create a custom ESS application with the following features– Follow SAP standard roadmap design/pattern

- BizCard Overview screen- Detailed screen to update information- Review screen to check and save/delete information- Confirmation screen with navigation links

– Multiple subtypes- BizCard shows different fields per subtype

– Multiple countries with different fields– Dependable drop downs

Page 5: Custom development of web dynpro ess applications using floor plan manager

5

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 5

DEMO

Page 6: Custom development of web dynpro ess applications using floor plan manager

6

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 6

Session Abstract: How

Follow SAP standard development model for Personal Information services– Same approach for all services– Same look and feel for all services

Use DC ess/per to implement common framework including FPMUse SAP delivered configuration tables for– Use Case and Time Constraint configuration– Required fields configuration– Infotype/Subtype/Country specific validation checks– UI structure to UI class assignment

Page 7: Custom development of web dynpro ess applications using floor plan manager

7

Add source code to WD components

Demo and screenshots

Session Abstract

Create WD components

Page 8: Custom development of web dynpro ess applications using floor plan manager

8

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 8

Create WD components: Create DC

Create a new DC

For this session we only create a local development component – no check in to DTR!

Switch to the web dynpro perspective where you will find the new project.

Create a project from an existing ESS application that supports subtypes e.g. ess/us/address

Will be used as template for the custom ESS application

Page 9: Custom development of web dynpro ess applications using floor plan manager

9

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 9

Create WD components: Used DC requirements

Define dependency of our DC to FPM DCOur DC->DC MetaData->DC Definition->Used DCs->context menu->Add used DC

Choose the following public parts:Local Development->MyComponents->pcui_gp/xssfpm->DC MetaData->Public Parts->FloorplanManager

Select all checkboxes except Design Time

Ensure that the following DC’s are available in your Local Development directory:

pcui_gp/xssfpm

pcui_gp/xssutils

ess/per

To create a web dynpro application using FPM, you have to make the components and component interfaces of FPM visible to that application.

Therefore, you have to have the following development components available in your Local Developmentdirectory in addition to your own project:

– pcui_gp~xssfpm~sap.com (FPM web dynpro component)

– pcui_gp~xssutils~sap.com (FPM utilities)

Additionally, for ESS applications that are based on Personal Information services e.g. bank details, personal data, etc… you need to add the development component ess/per as well.

To convert your application into a self-service application using FPM, you have to set the properties ofyour application so that it starts the FPM, rather then one of its own components.

Before you can create a reference to a component of the FPM, the development component of your application must declare the FPM development component as Used DCs.

You have to add the following development components to the Used DCs list:

– pcui_gp~xssfpm

– pcui_gp~xssutils

– ess/per- Only if you develop an ESS application based on Personal Information services

Page 10: Custom development of web dynpro ess applications using floor plan manager

10

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 10

Create WD components: Declaration of additional used DC’s

Define dependency of our DC to International Personal Information DCOur DC->DC MetaData->DC Definition->Used DCs->context menu->Add used DC

Choose the following public parts:Local Development->MyComponents->ess/per->DC MetaData->Public Parts->InternationalPersInfo

Select all checkboxes except Design Time

Define dependency of our DC to FPM UtilsDCOur DC->DC MetaData->DC Definition->Used DCs->context menu->Add used DC

Choose the following public parts:Local Development->MyComponents->pcui_gp/xssutils->DC MetaData->Public Parts->FPMUtils

Select all checkboxes except Design Time

Page 11: Custom development of web dynpro ess applications using floor plan manager

11

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 11

Create WD components: Configuration Component

In the web dynpro perspective expand the node for Web Dynpro and select Web Dynpro Components.Press the right mouse button and select Create Web Dynpro Component.

Deactivate checkbox to embed new view as the configuration component does not have any views!

A DC that uses FPM has three different types of components:– Configuration Components– Business Logic Components– Visual Application Components

Our DC needs the following Web Dynpro components:– A configuration component (CC), specifying the configuration of our application

- CcAddress– The necessary business logic component (BLC) for backend access

- FcAddress– The necessary visual application components (VACs) for the visual parts of your application

- VcAddressDetail- VcAddressOverview- VcAddressReview

Naming Conventions– Component Name:

- Use prefix Cc to identify the component as configuration component – this is not mandatory but helps in keeping the components structured.

– Component Package:- Use suffix cc to package all configuration component objects of this application.

– Window Name & Window Package:- Use the default values.

We use different packages for every component. For the CC and the BLC, this is merely convenience. For the VACs, however, different packages must be used, because every VAC will have a window named IVACWindow and it is impossible to have a duplicate window name inside a single package.

The BLC and CC are invisible components. Therefore, when creating the component, it is safe to deselect the Embed New View checkbox.

Page 12: Custom development of web dynpro ess applications using floor plan manager

12

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 12

Create WD components: CC: Interface & Message pool

Interface setup for FPM– A configuration component has to implement the interface IXssAppConf– CcAddress->Component Interface->Implemented Interfaces->Add->Select

IXssAppConf

Message pool setup for Roadmap titles– Double-click on message pool and select Add Message

Please note that CC’s don’t contain any visual parts –it’s save to delete any view/window!

Message pool texts for Roadmap titles– For the Overview screen enter/select:

- Message Key: OverviewROP

- Message Type: standard

- Message Text: Overview

– For the Detailed screen enter/select:- Message Key: DetailROP

- Message Type: standard

- Message Text: Edit

– For the Review screen enter/select:- Message Key: ReviewROP

- Message Type: standard

- Message Text: Review and Save

– For the Confirmation screen enter/select:- Message Key: ConfirmationROP

- Message Type: standard

- Message Text: Completed

Page 13: Custom development of web dynpro ess applications using floor plan manager

13

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 13

Create WD components: Business Logic Component

In the web dynpro perspective expand the node for Web Dynpro and select Web Dynpro ComponentsPress the right mouse button and select Create Web Dynpro Component

Deactivate checkbox to embed new view as the business logic component does not have any views!

BLCs are invisible components that handle communication between the application and the backend systemThey use one or more web dynpro models and prepare the frontend data to be sent to the backend and the backend data to be displayed in a VAC

All business logic components have to implement the interface IBLC

Please note that BLC’s don’t contain any visual parts –it’s save to delete any view/window!

Message pool text for user messages– For the delete confirmation message enter/select:

- Message Key: DeleteConfirmation

- Message Type: standard

- Message Text: The following {0} data will be deleted

– For the delete review message enter/select:- Message Key: DeleteReview

- Message Type: standard

- Message Text: The following {0} data was deleted

– For the edit review message enter/select:- Message Key: EditReview

- Message Type: standard

- Message Text: Please check {0} below

– For the edit confirmation message enter/select:- Message Key: EditConfirmation

- Message Type: standard

- Message Text: The changes you have made to your {0} data have been saved.

Page 14: Custom development of web dynpro ess applications using floor plan manager

14

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 14

Create WD components: Model & RFC’s for IT operations

The BLC needs a model to call the RFC’s.Before you can continue with the import of the model we need to make sure that an R/3 function group and RFCs within that function group are available for our application. In SAP backend copy function group: HRXSS_PER_P0006_US– This includes also all RFC’s of that function group!

Create a new DDIC structure and table type to replace SAP standard components in copied RFC’s– Only includes fields that you will need to manage performance!

Custom DDIC structure

Custom DDIC table type

Page 15: Custom development of web dynpro ess applications using floor plan manager

15

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 15

Create WD components: Model & RFC’s for Matchcodes

Create RFC’s to populate drop down fields– List of countries– List of states for selected country– List of priorities (Emergency Contact)

List of countries

List of states

List of priorities

DDIC structure and table type for country list RFC

DDIC structure and table type for state list RFC

DDIC structure and table type for priority list RFC

Page 16: Custom development of web dynpro ess applications using floor plan manager

16

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 16

Create WD components: Create Model & JCO Connections

On the next screen enter the logon data for the SAP backend

When generating the adaptive RFC models for your application thesystem asks for Jco destinations which should be used by this model later as default systems– It is necessary to define these Jco destination before creating the models– Address->Context Menu->Properties->Web Dynpro references->JCO

references->Add- SAP_R3_HumanResources- SAP_R3_HumanResources_MetaData

Create Model– In this demo all RFC’s are placed in one model– Address->Web Dynpro->Models->Context Menu->Create Model->Select Import

Adaptive RFC Model

Model setup– Model Name: ZHR_ESS_P0006 (*)

– Model Package: com.demo.hr.ess.address.model

– Default logical system name for model instances: WD_MODELDATA_DEST

– Default logical system name for RFC metadata: WD_RFC_METADATA_DEST

– Logical Dictionary: ZHR_ESS_P0006

(*) Function group name in SAP backend

Page 17: Custom development of web dynpro ess applications using floor plan manager

17

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 17

Create WD components: Create Model cont.

Enter the function group name: ZHR_ESS_P0006 in the related field and push the Search button– Select all RFC’s of this function group

Our DC should contain the following elements:

Page 18: Custom development of web dynpro ess applications using floor plan manager

18

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 18

Create WD components: Implementing the BLC

All necessary business logic and backend access should be placed in the BLC FcAddress– We need to define the usage of the model to FcAddress

- FcAddress->Used Models->Add ZHR_ESS_P0006

– We need to create a reference to the BLC of the International PersInfo DC- FcAddress->Used Web Dynpro Components->Add Used Component

- Enter FcPersInfo- Press the BROWSE… button and select FcPersInfo in the dialog window- Press OK button and then select manual in lifecycle drop down field.

– We need to setup the component controller

To setup the component controller perform the following steps:– Double-click on component controller in FcAddress

– Press the ADD button in the Properties tab to add a required controller

– Select FcPersInfo in the dialog window

Page 19: Custom development of web dynpro ess applications using floor plan manager

19

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 19

Create WD components: BLC: CC: Create context nodes

To use the RFC’s from FcAddress we need to create context nodes that allows us to fill the import parameters, execute the RFC’s and to retrieve the export parametersCreate the following context nodes in the component controller of FcAddress– DeleteInfotype– EditInfotype– F4_Values– ModifyInfotype– NewInfotype– ReadInfotype– SelectedInfotype

Additionally add the following context nodes to populate drop down fields– CountryMc– StateMc– PriorityMc

Add the following value nodes to manage UI elements and text instructions– UI– Text

ImportantSet cardinality to 0..nSet selection to 1..1

Open the component controller by double-clicking on FcAddress->Component Controller

Go to the Context tab

Create a node by clicking– Context->Context Menu->New->Model Node

– Enter the name e.g. SelectedInfotype

Page 20: Custom development of web dynpro ess applications using floor plan manager

20

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 20

Create WD components: BLC: CC: Create value nodes

Add the following value nodes to manage UI elements and text instructions– UI– Text

Add the following value attributes to value node UI– isEmergencyContactVisible(*)– isAreaCodeVisible(*)– isCountyEntryVisible(*)– isRegionRequired(**)– isZipRequired(**)– RegionLabel (String)– ZipLabel (String)

Add the following value attributes to value node Text– CreditCardHeader (String)– CreditCardInstructions (String)

*Set type to com.sap.ide.webdynpro.uielementdefinitions.Visibility

**Set type to com.sap.ide.webdynpro.uielementdefinitions.State

ImportantSet cardinality and selection to 1..1

For all is….Visible value attributes we need to set the type to – com.sap.ide.webdynpro.uielementdefinitions.Visibility

For isRegionRequired and isZipRequired value attributes we perform the same steps and select State in the list of available types

In the Properties of the value attribute we need to select the type selection button

String is the default type!

A dialog window appears where we need to select radio button for Dictionary Simple Type and then expand the Local Dictionary node and node com.sap.ide.webdynpro.uielementdefinitions

Scroll down till we find Visibility type and push OK button to select it

Page 21: Custom development of web dynpro ess applications using floor plan manager

21

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 21

Create WD components: BLC: CC: Bind context nodes

Bind the following context nodes to the corresponding nodes in the model– DeleteInfotype– EditInfotype– ModifyInfotype– NewInfotype– ReadInfotype– CountryMc– StateMc– PriorityMc

Bind the following context node to export structure of the related model class– SelectedInfotype

Perform context mapping for the following context node– F4_Values

- Select related context node in FcPersInfo

Please note to rename generated sub nodes!

Rename nodes to

Sub nodes are automatically created for each model input node with the same name. Web dynpro does not allow context nodes with the same name in the same context. Sub nodes should always be renamed to prevent conflicts!

To setup model binding perform the following steps– Select the context node->Context Menu->Edit Model Binding– Select corresponding node e.g. for EditInfotype node select Z_HRESS_Edit_P0006_Input

Important properties for drop down field context nodes– CountryRecords & PriorityRecords

- cardinality 0..n

- selection 1..1

- singleton false

– StateRecords- cardinality 0..n

- selection 1..1

- singleton true

Select Next buttonExpand EditInfotype folder and all sub folders

Select all sub folders first and then the main folder which will also select any import parameters

Page 22: Custom development of web dynpro ess applications using floor plan manager

22

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 22

Create WD components: BLC: CC: Methods

Copy methods from SAP standard US Address serviceCopy/Paste all methods to our own custom service

Ignore warning message that source code could not be located!

We will add source code later to the methods

Service specific methods– getCountries– getStates

- Country– getPriorities

- Employeenumber- Priority

– selectCountry- Country

– selectState- State

– selectPriority- Priority

– setDefaultCountry- Country

– setDefaultState- State

– setDefaultPriority- Priority

– setInstructions– setUI

- Country– setUI_EMCVisible

- Subtype

Page 23: Custom development of web dynpro ess applications using floor plan manager

23

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 23

Create WD components: BLC: IC: Create context nodes

We need to expose the nodes containing the address data to the visual components (will be created later!)This is done by maintaining the interface controller of FcAddress

Create the following FPM context nodes– InfotypeList– SelectedInfotype

Create also the following context nodes to populate drop down fields– CountryMc– StateMc– PriorityMc

Additionally create the following value nodes– UI– Texts

Open the interface controller of FcAddress

Add the controller FcAddress to the list of required controllers

Page 24: Custom development of web dynpro ess applications using floor plan manager

24

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 24

Create WD components: BLC: IC: Bind context nodes

Perform context mapping to the context nodes of the component controller of FcAddress from the interface controller– CountryMc

- Bind to CountryOutput node and select CountryRecords node in the context mapping dialog window

– InfotypeList- Bind to ReadRecords node of node ReadOutput and ReadInfotype and select all fields

– PriorityMc- Bind to PriorityOutput node and select PriorityRecords node in the context mapping

dialog window– SelectedInfotype

- Bind to SelectedInfotype node and select all fields– StateMc

- Bind to StateOutput node and select StateRecords node in the context mapping dialog window

– Texts- Bind to Texts node and select all fields

– UI- Bind to UI node and select all fields

Page 25: Custom development of web dynpro ess applications using floor plan manager

25

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 25

Create WD components: BLC: IC: Methods

We need to expose the methods of the component controller to thevisual components (source code will be added later!)This is done by setting up methods in the interface controller.The interface controller requires the same methods and parameters as the component controller – except setInstructions and addValueHelpCopy the methods from the component controller to the interface controller - except setInstructions and addValueHelp

Please note that you copy also the source code if you add source code to the methods in the component controller and then copy those methods to the interface controller

You will then need to replace the source code as the interface controller methods only call the component controller methods!

This should not happen though if you follow this procedure as there is not code yet available in the component controller methods

Page 26: Custom development of web dynpro ess applications using floor plan manager

26

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 26

Create WD components: Visual Application Component

In the web dynpro perspective expand the node for Web Dynpro and select Web Dynpro ComponentsPress the right mouse button and select Create Web Dynpro Component

Deactivate checkbox to embed new view as we are going to add our own view later!

Delete the created window component in each VAC because a default window (IVACWindow) will be added automatically when we add FPM interface IVAC

VACs are the building blocks of perspectives. They display data on the screen, handle user input, and trigger FPM events.We need to create three VACs– Overview screen– Detailed screen– Review screen

Using the Overview screen as an example perform the following steps

Perform the same steps for the other screens as well following the naming conventions!

Naming conventions– Use prefix Vc in the component name to identify the component as visual application component –

this is not mandatory but helps in keeping the components structured.

Use suffix vc.overview, vc.detail, vc.review to package the visual application components for the corresponding view of this project.

– It is mandatory to use different packages for each visual application component, because every VAC will have a window named IVACWindow and it is impossible to have a duplicate window name inside a single package.

Page 27: Custom development of web dynpro ess applications using floor plan manager

27

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 27

Create WD components: Visual Application Component cont.

We are done with the creation of web dynpro components after youcreated all VACs

All visual application components have to implement the interface IVAC

You will see the interface and window added to each VAC

Expand the Component Interface node of each VAC and select Implemented Interfaces->Context Menu->AddIn the dialog window select IVAC and push OK button

Push the FINISH button on the next dialog window to confirm the window name

Page 28: Custom development of web dynpro ess applications using floor plan manager

28

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 28

Create WD components: Visual Application Component cont.

We need to create references to various BLCs to be able to trigger events and display/update dataFor VcAddressOverview only we need to create a reference to the BLCof the FPMUtils DC– VcAddressOverview>Used Web Dynpro Components->Add Used Component

- Enter FcEmployeeServices- Press the BROWSE… button and select FcEmployeeServices in the dialog window

- Press OK button and then select manual in lifecycle drop down field.

For all three VACs we need to create a reference to the BLC of International PersInfo DC and of cause our own BLC - FcAddress– VcAddressxxx>Used Web Dynpro Components->Add Used Component

- Enter FcPersInfo- Press the BROWSE… button and select FcPersInfo in the dialog window

– Repeat the step to enter/add FcAddress

Page 29: Custom development of web dynpro ess applications using floor plan manager

29

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 29

Create WD components: VAC: CC: Overview

We are going to implement the navigation between the different perspectives, which is done in the component controller of each VACAdd the required controllers to the component controller of the VAC– FcAddress– FcPersInfo– FcEmployeeServices

Create model/value nodes and perform binding– Model nodes

- CountryMc Edit Context mapping->FcAddress->CountryMc->CountryRecords- InfotypeList Edit Context mapping->FcAddress->InfotypeList->All fields- SelectedInfotype Edit Context mapping->FcAddress->SelectedInfotype>All fields- Subtypes Edit Context mapping->FcPersInfo->Subtypes>All fields

– Model attribute- Default_Begda Edit Context mapping->FcPersInfo->Default_Begda

– Value nodes- Text Edit Context mapping->FcAddress->Text->All fields- UI Edit Context mapping->FcAddress->UI>RegionLabel & ZipLabel

Page 30: Custom development of web dynpro ess applications using floor plan manager

30

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 30

Create WD components: VAC: CC: Overview methods

Copy methods from SAP standard US Address service (VCPerAddressUSOverview)

Copy/Paste all methods to our own VACIgnore warning message that source code could not be located!We will add source code later to the methods

Page 31: Custom development of web dynpro ess applications using floor plan manager

31

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 31

Create WD components: VAC: IC: Overview&Detail&Review

We need to expose the methods of the component controller to the view component that will be created later– This is done via the interface controller of the VAC

No context nodes are required but we do need to add the component controller of the VAC to the list of required controllers of the interface controller

This will automatically add methods of the component controller to the interface controller of the VACWe compare the methods of our VAC with the methods of the interface controller of SAP standard US Address service (VCPerAddressUSOverview)– Copy any missing methods

- isHidingPossible- isSelectionChangePossible

Perform the above mentioned steps for the other two VAC’s as well after you completed the component controller setup!

Page 32: Custom development of web dynpro ess applications using floor plan manager

32

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 32

Create WD components: VAC: Message Pool: Overview

We use the message editor to setup description for screen elements (Buttons, Headers, Labels, etc…) Double-click on message pool in the VACUse the Add Message button to add descriptions– Button texts

- New- Delete- Edit- Cancel

– BizCard header- EffectiveAsOf- EffectiveAsOfToday

– Service name in success message- ITName

– BizCard field labels for mailing address- BizCardField1 to BizCardField5

– BizCard field labels for emergency contact- BizCardField6 to BizCardField8

Setup of messages in message edit– BizCard field labels are setup with

- Message type set to text

- Message text type set to informationmessage

Page 33: Custom development of web dynpro ess applications using floor plan manager

33

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 33

Create WD components: VAC: View: Overview

We need to create a view element for the BizCard and embed it into the FPM window componentVcAddressOverview->Views->Context menu->Create View

Embed view in FPM window componentVcAddressOverview->Windows->IVACWindow->Context menu->Embed View– Select Embed existing view– Select BizCardsView and push FINISH button

Next we are going to add the component controller of the VAC to the view controller– Double-click on BizCardsView and select Properties tab– Select the correct VAC controller – don’t select the web dynpro component

interface controller which has the same name!

Enter BizCardsView as view name –everything else is OK

Page 34: Custom development of web dynpro ess applications using floor plan manager

34

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 34

Create WD components: VAC: View: Overview: Context

To pass the data between BLC’s and this VAC (and also to trigger events) we need to create context nodes and actionsCreate model/value nodes and perform binding– Model nodes

- InfotypeList Edit Context mapping->VcAddressOverview->InfotypeList->All fields- Subtypes Edit Context mapping-> VcAddressOverview->Subtypes->All fields

– Model attribute- Default_Begda Edit Context mapping-> VcAddressOverview->Default_Begda

– Value nodes- UI Edit Context mapping-> VcAddressOverview->UI->All fields- Text Edit Context mapping-> VcAddressOverview->Text->All fields

Create actions– Cancel

- No parameters– Delete– Edit– New

To setup additional actions select the Actions tab in BizCardsView– Push the New button

– Setup delete action

– Setup edit action

– Setup new action

Page 35: Custom development of web dynpro ess applications using floor plan manager

35

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 35

Create WD components: VAC: View: Overview: Layout

Select Layout tab in BizCardsView and make sure that you have the Outline and Properties view visible in NWDSCompare BizCardsView outline/properties of VcAddressOverview with BizCardsView outline/properties of VcPerAddressUSOverview– Change properties of RootUIElementContainer– Delete DefaultTextView– Copy rootContainer– Add transparent container for instructions

- InstructionContainer- layout RowLayout- width 60%

– Add text field for instruction header to instruction container- DinersClubHeaderText

- Bind text property to context node text and attribute CreditCardHeader– Add text field for instruction text to instruction container

- DinersClubInstructionText- Bind text property to context node text and attribute CreditCardInstructions

Properties of RootUIElementContainer

Properties of InstructionContainer

Properties of DinersClubHeaderText and DinersClubInstructionText

Page 36: Custom development of web dynpro ess applications using floor plan manager

36

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 36

Create WD components: VAC: CC: Detail

We are going to implement the navigation between the different perspectives, which is done in the component controller of each VACAdd the required controllers to the component controller of the VAC– FcAddress– FcPersInfo

Create model/value nodes and perform binding– Model nodes

- SelectedInfotype Edit Context mapping->FcAddress->SelectedInfotype->All fields- Subtypes Edit Context mapping->FcPersInfo->Subtypes->All fields- CountryMc Edit Context mapping->FcAddress->CountryMc->CountryRecords- StateMc Edit Context mapping->FcAddress->StateMc->StateRecords- PriorityMc Edit Context mapping->FcAddress->PriorityMc->PriorityRecords

– Model attribute- Default_Begda Edit Context mapping->FcPersInfo->Default_Begda

– Value nodes- UI Edit Context mapping->FcAddress->UI->All fields- FutureDay Edit Context mapping->FcPersInfo->All fields and sub folders

Page 37: Custom development of web dynpro ess applications using floor plan manager

37

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 37

Create WD components: VAC: CC: Detail methods

Copy methods from SAP standard US Address service (VCPerAddressUSDetail)

Add the following service specific methods and parameters– selectCountry

- Country– selectState

- State– selectPriority

- Priority

Copy/Paste all methods to our own VAC

Ignore warning message that source code could not be located!

We will add source code later to the methods

Page 38: Custom development of web dynpro ess applications using floor plan manager

38

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 38

Create WD components: VAC: View: Detail

We need to create a view element for the detailed screen and embed it into the FPM window componentVcAddressDetail->Views->Context menu->Create View

Embed view in FPM window componentVcAddressDetail->Windows->IVACWindow->Context menu->Embed View– Select Embed existing view– Select DetailView and push FINISH button

Next we are going to add the component controller of the VAC to the view controller– Double-click on DetailView and select Properties tab– Select the correct VAC controller – don’t select the web dynpro component

interface controller which has the same name!

Enter DetailView as view name –everything else is OK

Page 39: Custom development of web dynpro ess applications using floor plan manager

39

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 39

Create WD components: VAC: View: Detail: Context

To pass the data between BLC’s and this VAC (and also to trigger events) we need to create context nodesActions will be done later when we setup the drop down fields for Country, State and Priority!Create model/value nodes and perform binding– Model nodes

- SelectedInfotype Edit Context mapping->VcAddressDetail->SelectedInfotype->All fields- Subtypes Edit Context mapping-> VcAddressDetail->Subtypes->All fields- CountryMc Edit Context mapping-> VcAddressDetail->CountryMc->CountryRecords- StateMc Edit Context mapping-> VcAddressDetail->StateMc->StateRecords- PriorityMc Edit Context mapping-> VcAddressDetail->PriorityMc->PriorityRecords

– Model attribute- Default_Begda Edit Context mapping-> VcAddressDetail->Default_Begda

– Value nodes- UI Edit Context mapping-> VcAddressDetail->UI->All fields- FutureDay Edit Context mapping-> VcAddressDetail->FutureDay->All fields/ subfolders

Page 40: Custom development of web dynpro ess applications using floor plan manager

40

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 40

Create WD components: VAC: View: Detail: Layout

Select Layout tab in DetailView and make sure that you have the Outlineand Properties view visible in NWDSSet layout attribute of RootUIElementContainer to GridLayout and widthattribute to 100%Set the following properties for DefaultTextView element– design header3– text Select field Stext of context node Subtypes– paddingBottom medium

Add a transparent container for Emergency Contact fields– EmergencyContactContainer

- Set visible property to field isEmergencyContactVisible of context node UI

Add a transparent container for Address fields– AddressContainer

Add a transparent container for validity start date– DateContainer

- layout MatrixLayout- stretchedHorizontally false

Page 41: Custom development of web dynpro ess applications using floor plan manager

41

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 41

Create WD components: VAC: View: Detail: Layout cont.

Add the following transparent containers to AddressContainer– AddressDataContainer and TelephoneContainer

- layout MatrixLayout- stretchedHorizontally false

Add the following elements to AddressDataContainer– CountryLabel Label– Country DropDownByIndex– CareOfLabel Label– CareOf InputField– AddressLabel Label– Address InputField– Address2Label Label– Address2 InputField– CityLabel Label

Add the following elements to TelephoneContainer– TelephoneLabel Label– AreaCode InputField– Telephone InputField

– City InputField– StateLabel Label– State DropDownByIndex– ZipLabel Label– Zip InputField– CountyLabel Label– County InputField– EmailLabel Label– Email InputField

Specific label properties– text use a descriptive text

- StateLabel set to field RegionLabel of context node UI

- ZipLabel set to field ZipLabel of context node UI

– visible set to visible

- CountyLabel set to field isCountyEntryVisible of context node UI

– Width

- CountryLabel & TelephoneLabel 100px

Input field properties- CareOf

- length 30- value set to field Name2 of context node SelectedInfotype- tooltip Care of

- Address- length 30- value set to field Stras of context node SelectedInfotype- tooltip Street and House number- state required

- Address2- length 30- value set to field Locat of context node SelectedInfotype- tooltip Additional address information

- City- length 20- value set to field Ort01 of context node SelectedInfotype- tooltip City- state requied

– Zip- state set to field isZipRequired of context code UI- value set to field Pstlz of context node SelectedInfotype

– County- length 20- value set to field Ort02 of context node SelectedInfotype- visible set to field isCountyEntryVisible of context node UI

– Email- length 35- value set to field Zzemail_Id of context node SelectedInfotype

– AreaCode- tooltip Area code- value set to field Areac of context node SelectedInfotype- visible set to field isAreaCodeVisible of context node UI

– Telephone- length 20- tooltip Telephone number- value set to field Telnr of context node SelectedInfotype

Page 42: Custom development of web dynpro ess applications using floor plan manager

42

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 42

Create WD components: VAC: View: Detail: Layout cont.

Properties for drop down fields– Country

- texts set to field Landx of context node CountryMc->CountryRecords- state required - onselect Push new action button to setup CountrySelect action

– State- texts set to field State_Text of context node StateMc->StateRecords- state set to field isRegionRequired of context node UI- onselect Push new action button to setup StateSelect action

Page 43: Custom development of web dynpro ess applications using floor plan manager

43

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 43

Create WD components: VAC: View: Detail: Layout cont.

Add the following transparent container to EmergencyContactContainer– EMCDataContainer

- layout MatrixLayout- stretchedHorizontally false

Add the following elements to EMCDataContainer– ContactPriorityLabel Label– ContactPriority DropDownByIndex– ContactNameLabel Label– ContactName InputField– RelationshipLabel Label– Relationship InputField– LanguageLabel Label– Language DropDownByKey

Properties for drop down fields– ContactPriority

- texts set to field Priority_Text of context node PriorityMc->PriorityRecords- state required- onselect Push new action button to setup PrioritySelect action

– Language- selectedKey set to field Zz_Cnt_Langu of context node SelectedInfotype- state required- onselect Push new action button to setup Dummy action

Specific label properties– Width

- ContactPriorityLabel 100px

Input field properties- ContactName

- value set to field Zz_Cnt_Name of context node SelectedInfotype- tooltip Contact Name- state required

- Relationship- value set to field Zz_Cnt_Relat of context node SelectedInfotype- tooltip Relationship- state required

Page 44: Custom development of web dynpro ess applications using floor plan manager

44

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 44

Create WD components: VAC: View: Detail: Layout cont.

Add the following elements to DateContainer– Radio_asofdate RadioButtonGroupByIndex– Begda InputField

Properties for Radio_asofdate Properties for Begda

Page 45: Custom development of web dynpro ess applications using floor plan manager

45

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 45

Create WD components: VAC: CC: Review

We are going to implement the navigation between the different perspectives, which is done in the component controller of each VACAdd the required controllers to the component controller of the VAC– FcAddress– FcPersInfo

Create model/value nodes and perform binding– Model nodes

- SelectedInfotype Edit Context mapping->FcAddress->SelectedInfotype->All fields- Subtypes Edit Context mapping->FcPersInfo->Subtypes->All fields

– Model attribute- Default_Begda Edit Context mapping->FcPersInfo->Default_Begda

– Value nodes- UI Edit Context mapping->FcAddress->UI->All fields- FutureDay Edit Context mapping->FcPersInfo->All fields and sub folders

Page 46: Custom development of web dynpro ess applications using floor plan manager

46

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 46

Create WD components: VAC: CC: Review methods

Copy methods from SAP standard US Address service (VCPerAddressUSReview)

Copy/Paste all methods to our own VACIgnore warning message that source code could not be located!We will add source code later to the methods

Page 47: Custom development of web dynpro ess applications using floor plan manager

47

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 47

Create WD components: VAC: View: Review

We need to create a view element for the review screen and embed it into the FPM window componentVcAddressReview->Views->Context menu->Create View

Embed view in FPM window componentVcAddressReview->Windows->IVACWindow->Context menu->Embed View– Select Embed existing view– Select ReviewView and push FINISH button

Next we are going to add the component controller of the VAC to the view controller– Double-click on ReviewView and select Properties tab– Select the correct VAC controller – don’t select the web dynpro component

interface controller which has the same name!

Enter ReviewView as view name –everything else is OK

Page 48: Custom development of web dynpro ess applications using floor plan manager

48

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 48

Create WD components: VAC: View: Review: Context

To pass the data between BLC’s and this VAC (and also to trigger events) we need to create context nodesCreate model/value nodes and perform binding– Model nodes

- SelectedInfotype Edit Context mapping->VcAddressReview->SelectedInfotype->All fields- Subtypes Edit Context mapping->VcAddressReview->Subtypes->All fields

– Value nodes- UI Edit Context mapping->VcAddressReview->UI->All fields- FutureDay Edit Context mapping->VcAddressReview->FutureDay->All fields/ subfolders

Page 49: Custom development of web dynpro ess applications using floor plan manager

49

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 49

Create WD components: VAC: View: Review: Layout

Select Layout tab in ReviewView and make sure that you have the Outline and Properties view visible in NWDSSet layout attribute of RootUIElementContainer to GridLayout and widthattribute to 100%Set the following properties for DefaultTextView element– design header3– text Select field Stext of context node Subtypes– paddingBottom medium

Add a transparent container for Emergency Contact fields– EmergencyContactContainer

- Set visible property to field isEmergencyContactVisible of context node UI

Add a transparent container for Address fields– AddressContainer

Add a transparent container for validity start date– DateContainer

- layout MatrixLayout- stretchedHorizontally false

Page 50: Custom development of web dynpro ess applications using floor plan manager

50

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 50

Create WD components: VAC: View: Review: Layout cont.

Add the following transparent containers to AddressContainer– AddressDataContainer and TelephoneContainer

- layout MatrixLayout- stretchedHorizontally false

Add the following elements to AddressDataContainer– CountryLabel Label– Country TextView– CareOfLabel Label– CareOf TextView– AddressLabel Label– Address TextView– Address2Label Label– Address2 TextView– CityLabel Label

Add the following elements to TelephoneContainer– TelephoneLabel Label– AreaCode TextView– Telephone TextView

– City TextView– StateLabel Label– State TextView– ZipLabel Label– Zip TextView– CountyLabel Label– County TextView– EmailLabel Label– Email TextView

Specific label properties– text use a descriptive text

- StateLabel set to field RegionLabel of context node UI

- ZipLabel set to field ZipLabel of context node UI

– visible set to visible

- CountyLabel set to field isCountyEntryVisible of context node UI

– Width

- CountryLabel & TelephoneLabel 100px

Text view field properties- Country

- text set to field Land1_Text of context node SelectedInfotype- tooltip Country

- CareOf- text set to field Name2 of context node SelectedInfotype- tooltip Care of

- Address- text set to field Stras of context node SelectedInfotype- tooltip Street and House number

- Address2- text set to field Locat of context node SelectedInfotype- tooltip Additional address information

– City- text set to field Ort01 of context node SelectedInfotype- tooltip City

– State- text set to field Sate_Text of context node SelectedInfotype

– Zip- text set to field Pstlz of context node SelectedInfotype

– County- text set to field Ort02 of context node SelectedInfotype- visible set to field isCountyEntryVisible of context node UI

– Email- text set to field Zzemail_Id of context node SelectedInfotype

– AreaCode- tooltip Area code- text set to field Areac of context node SelectedInfotype

– Telephone- tooltip Telephone number- text set to field Telnr of context node SelectedInfotype

Page 51: Custom development of web dynpro ess applications using floor plan manager

51

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 51

Create WD components: Define web dynpro application

All applications using FPM have to start the FPM component itself and pass the relevant configuration controller as an application propertyFPM reads the configuration controller and creates the specified web dynpro components (BLC and VAC)Expand Web DynproSelect Applications->Context Menu->Creat Application

Select the following FPM components

Add the following application properties

Push the Next button and select radio button to use existing component on the next screen

Double-click on the created application and then select the application properties tab

Define the application properties– Authentication

- Press the NEW button to open a dialog window.

- Select the radio button for Pre defined.

- Push the Browse… button and select Authentication from the dialog window.

- Select true from the drop down box.

– sap.xss.configurationComponentDC- Press the NEW button to open a dialog window.

- Select the radio button for Self defined.

- Enter the following information:

Name: sap.xss.configurationComponentDCValue: demo.com/ess~address

– sap.xss.configurationComponentName- Press the NEW button to open a dialog window.

- Select the radio button for Self defined.

- Enter the following information:

Name: sap.xss.configurationComponentName

Value: com.demo.hr.ess.address.cc.CcAddress

Page 52: Custom development of web dynpro ess applications using floor plan manager

52

Add source code to WD components

Demo and screenshots

Session Abstract

Create WD components

Page 53: Custom development of web dynpro ess applications using floor plan manager

53

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 53

Add source code to WD components: CcAddress: IC

Please note– Source code needs to be added in the coding area between //@@begin and

//@@end. - Your source code will be removed when rebuilding the project otherwise

– Import statements- Organize your imports to include the necessary import statements

- Context menu->Source->Organize Imports- Ctrl-Shift-O

Method– loadConfiguration– getCAPState

- return helper.getCAPState(perspective);– getNextPerspective

- return helper.getNextPerspective(currentPerspective, eventName);– getStartPerspective

- return helper.getStartPerspective();– getROPState

- return helper.getROPState(perspective);– Others section

- CcHelper helper;

– Source code for loadConfiguration//@@begin loadConfiguration()helper =

new CcHelper(fpm,wdThis.wdGetAPI(),"demo.com/ess~address","com.demo.hr.ess.address.vc.overview.VcAddressOverview","com.demo.hr.ess.address.vc.detail.VcAddressDetail","com.demo.hr.ess.address.vc.review.VcAddressReview");

//@@end

Page 54: Custom development of web dynpro ess applications using floor plan manager

54

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 54

Add source code to WD components: FcAddress: CC

Method– wdDoExit– addValueHelp

- wdThis.wdGetFcPersInfoInterface().getF4();- F4TextHelper.SetF4Values(wdThis.wdGetAPI(), wdContext.nodeF4_Values());

– cleanup- clearSelection();

– clearSelection– deleteRecord– getCountries– getPriorities– getStates– modifyRecord– newRecord– onInit– readRecord

– selectCountry– selectPriority– selectRecord– selectState– setDefaultCountry– seteDefaultPriority– setDefaultState– setInstructions– setUI– setUI_EMCVisible

– Source code for wdDoExit

– Source code for clearSelection

– Source code for getCountries

//@@begin wdDoExit()fpm.registerContext(wdContext);try{

fpm.exitCalled();} catch (Exception e){}

//@@end

//@@begin clearSelection()wdThis.wdGetContext().nodeSelectedInfotype().invalidate();wdContext.nodeSelectedInfotype().bind(

(Zhcmt_Bsp_Pa_R0006) model.createModelObject(Zhcmt_Bsp_Pa_R0006.class));

//@@end

//@@begin getCountries()try{

fpm.getMessageManager().deleteAllMessages(wdThis.wdGetAPI().getComponent());

wdContext.nodeCountryMc().bind((Z_Hress_P0006_Countrymc_Input) model.createModelObject(

Z_Hress_P0006_Countrymc_Input.class));wdContext.currentCountryMcElement().setI_Withemptyline(false);wdContext.currentCountryMcElement().modelObject().execute();//An exception is triggered and application will be terminated. Only first //message in messages node will be displayedMessageHelper.raiseException(

fpm,wdThis.wdGetAPI(),wdContext.nodeCountryMessages());

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 55: Custom development of web dynpro ess applications using floor plan manager

55

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 55

Add source code to WD components: FcAddress: IC

Methods– cleanup

- wdThis.wdGetFcAddressController().cleanup();

– clearSelection- wdThis.wdGetFcAddressController().clearSelection();

– deleteRecord- wdThis.wdGetFcAddressController().deleteRecord(selection);

– getCountries- wdThis.wdGetFcAddressController().getCountries();

– getPriorities- wdThis.wdGetFcAddressController().getPriorities(Employeenu

mber, Priority);

– getStates- wdThis.wdGetFcAddressController().getStates(Country);

– modifyRecord- wdThis.wdGetFcAddressController().modifyRecord();

– newRecord- wdThis.wdGetFcAddressController().newRecord(subtype);

– onCleanup- wdThis.wdGetFcAddressController().onCleanup();

– onInit- wdThis.wdGetFcAddressController().onInit(fpm);

– readRecord- wdThis.wdGetFcAddressController().readRecord();

– selectCountry- wdThis.wdGetFcAddressController().selectCountry(Country);

– selectPriority- wdThis.wdGetFcAddressController().selectPriority(Priority);

– selectRecord- wdThis.wdGetFcAddressController().selectRecord(selection);

– selectState- wdThis.wdGetFcAddressController().selectState(State);

– setDefaultCountry- wdThis.wdGetFcAddressController().setDefaultCountry(Count

ry);

– setDefaultPriority- wdThis.wdGetFcAddressController().setDefaultPriority(Priority

);

– setDefaultState- wdThis.wdGetFcAddressController().setDefaultState(State);

– setUI- wdThis.wdGetFcAddressController().setUI(Country);

– setUI_ECMVisible- wdThis.wdGetFcAddressController().setUI_EMCVisible(Subty

pe);

Page 56: Custom development of web dynpro ess applications using floor plan manager

56

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 56

Add source code to WD components: BizCard Helper class

The BizCard generation on the overview screen is done by the OverviewHelper.java class of ess/perWe want to display different fields for different subtypes in the BizCard on the overview screenTo do that we need to copy the helper class to our own web dynpro project, rename it and then change itCreate a web dynpro project for DC ess/perSelect Navigator tab in web dynpro perspectiveLocate BizCard helper class in DC ess/per and copy it– OverviewHelper.java

Expand src folder of our own web dynpro project Create new folder in address folder– Helpers

Paste BizCard helper class into folder helpers in our web dynpro projectRename class from OverviewHelper.java to AddressOverviewHelper.java– Check properties of helper class and deactivate the read only flag

Double-click on address overview helper class and perform necessary code changes– Check source code here!

Locate BizCard helper class in DC ess/perOpen folder src->packages->com->sap->xss->per->helpers

Create new folder for helper class in folder address in our own web dynpro projectSelect folder address->Context Menu->New->Other->Simple->Folder->enter name: helpers

Page 57: Custom development of web dynpro ess applications using floor plan manager

57

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 57

Add source code to WD components: VcAddressOverview: CC

Methods– wdDoExit– cancel

- wdThis.wdGetFcPersInfoInterface().cancel();

– create– delete– edit– isDirty

- return wdThis.wdGetFcPersInfoInterface().isDirty();

– onBeforeOutput– onEvent– onInit

Others section //@@begin others

static String IT = "0006";IFPM fpm;VAC thisVAC =

new VAC("demo.com/ess~address","com.demo.hr.ess.address.vc.overview.VcAddressOverview");

int selectedRecord;String selectedSubtype;

//@@end

– Source code for wdDoExit

– Source code for onBeforeOutput

– Source code for onInit

//@@begin wdDoExit()try{

fpm.exitCalled();} catch (Exception e){}

//@@end

//@@begin onBeforeOutput()onCleanup();wdThis.wdGetFcAddressInterface().readRecord();//Set UI based on Mailing Address record - assumption is that mailing address record//is the first record in the context node - just for the demo//Better to make sure we get country from the correct subtype record!wdThis.wdGetFcAddressInterface().setUI(

wdContext.currentInfotypeListElement().getLand1()); //@@end

//@@begin onInit()this.fpm = fpm;fpm.attachComponentToUsage(

wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcPersInfoComponentUsage());

fpm.attachComponentToUsage(wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcAddressComponentUsage());

fpm.attachComponentToUsage(wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcEmployeeServicesComponentUsage());

String ITName = wdThis.wdGetAPI().getTextAccessor().getText("ITName");wdThis.wdGetFcPersInfoInterface().initPernr(

wdThis.wdGetFcEmployeeServicesInterface().getEmployeenumber(),IT,ITName);

//@@end

Page 58: Custom development of web dynpro ess applications using floor plan manager

58

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 58

Add source code to WD components: VcAddressOverview: IC

Methods– isConsistent

- return true;

– isDirty- return wdThis.wdGetVcAddressOverviewController().isDirty();

– isHidingPossible- return true;

– isSelectionChangePossible- return true;

– onBeforeOutput- wdThis.wdGetVcAddressOverviewController().onBeforeOutput();

– onEvent- wdThis.wdGetVcAddressOverviewController().onEvent();- return true;

– onInit- wdThis.wdGetVcAddressOverviewController().onInit(fpm);

Page 59: Custom development of web dynpro ess applications using floor plan manager

59

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 59

Add source code to WD components: VcAddressOverview: BizCardsView

Methods– wdDoModifyView– onActionCancel

- wdThis.wdGetVcAddressOverviewController().cancel();

– onActionDelete- wdThis.wdGetVcAddressOverviewController().delete(index);

– onActionEdit- wdThis.wdGetVcAddressOverviewController().edit(index);

– onActionNew- wdThis.wdGetVcAddressOverviewController().create(subtype);

– Source code for wdDoModifyView//@@begin wdDoModifyView

BizcardFieldInfo[] fieldInfo1; //Mailing AddressBizcardFieldInfo[] fieldInfo2; //Emergency ContactDate defaultBegda =

wdContext.currentContextElement().getDefault_Begda();String bizcardField1 =

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizCardField1");

String bizcardField2 =wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"BizCardField2");String bizcardField3 = wdContext.currentUIElement().getRegionLabel();String bizcardField4 =

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizCardField4");

String bizcardField5 =wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"BizCardField5");String bizcardField6 =

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizCardField6");

String bizcardField7 =wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"BizCardField7");String bizcardField8 =

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("BizCardField8");

//Mailing AddressfieldInfo1 =

new BizcardFieldInfo[] {new BizcardFieldInfo(bizcardField1, "Stras"),new BizcardFieldInfo(bizcardField2, "Ort01"),new BizcardFieldInfo(bizcardField3, "State_Text"),new BizcardFieldInfo(bizcardField4, "Land1_Text"),new BizcardFieldInfo(bizcardField5, "Telnr_Biz")};

//Emergency ContactfieldInfo2 =

new BizcardFieldInfo[] {new BizcardFieldInfo(bizcardField6, "Priority_Text"),new BizcardFieldInfo(bizcardField7, "Zz_Cnt_Name"),new BizcardFieldInfo(bizcardField8, "Zz_Cnt_Relat"),new BizcardFieldInfo(bizcardField5, "Telnr_Biz"),new BizcardFieldInfo(bizcardField4, "Land1_Text")};

AddressOverviewHelper.CreateOverview(wdThis.wdGetContext().nodeInfotypeList(),wdThis.wdGetContext().nodeSubtypes(),view,fieldInfo1,fieldInfo2,defaultBegda,"Anssa");

//@@end

Page 60: Custom development of web dynpro ess applications using floor plan manager

60

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 60

Add source code to WD components: VcAddressDetail: CC

Methods– wdDoExit– isConsistent– isDirty

- return wdThis.wdGetFcPersInfoInterface().isDirty();

– onBeforeOutput– onFlush– onInit– selectCountry

- wdThis.wdGetFcAddressInterface().selectCountry(Country);

– selectPriority- wdThis.wdGetFcAddressInterface().selectPriority(Priority);

– selectState- wdThis.wdGetFcAddressInterface().selectState(State);

Others section //@@begin others

private IFPM fpm = null; //@@end

– Source code for wdDoExit

– Source code for onBeforeOutput

– Source code for onInit

//@@begin isConsistent()if (fpm.getEventData().getEventName().equals(IFPM.EVENT_REVIEW)){

if (wdThis.wdGetFcPersInfoInterface().check(wdContext.currentSelectedInfotypeElement())== true)

{//return Veto.NO_VETO;return true;

} else{

//return Veto.VETO;return false;

}} else{

//return Veto.NO_VETO;return true;

} //@@end

//@@begin wdDoExit()try{

fpm.exitCalled();} catch (Exception e){}

//@@end

//@@begin onInit()this.fpm = fpm;fpm.attachComponentToUsage(

wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcAddressComponentUsage());

fpm.attachComponentToUsage(wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcPersInfoComponentUsage());

//@@end

Page 61: Custom development of web dynpro ess applications using floor plan manager

61

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 61

Add source code to WD components: VcAddressDetail: IC

Methods– isConsistent

- return wdThis.wdGetVcAddressDetailController().isConsistent();

– isDirty- return wdThis.wdGetVcAddressDetailController().isDirty();

– isSelectionChangePossible- return true;

– onBeforeOutput- wdThis.wdGetVcAddressDetailController().onBeforeOutput();

– onCleanup- wdThis.wdGetVcAddressDetailController().onCleanup();

– onEvent- return true;

– onFlush- wdThis.wdGetVcAddressDetailController().onFlush();

– onInit- wdThis.wdGetVcAddressDetailController().onInit(fpm);

Page 62: Custom development of web dynpro ess applications using floor plan manager

62

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 62

Add source code to WD components: VcAddressDetail: DetailView

Methods– onActionCountrySelect

- wdThis.wdGetVcAddressDetailController().selectCountry(wdContext.currentCountryRecordsElement().getLand1());

– onActionPrioritySelect- wdThis.wdGetVcAddressDetailController().selectPriority(wdContext.currentPriorityRecordsEl

ement().getPriority());

– onActionStateSelect- wdThis.wdGetVcAddressDetailController().selectState(wdContext.currentStateRecordsElem

ent().getState());

Page 63: Custom development of web dynpro ess applications using floor plan manager

63

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 63

Add source code to WD components: VcAddressReview: CC

Methods– wdDoExit– isDirty

- return wdThis.wdGetFcPersInfoInterface().isDirty();

– onBeforeOutput– onInit

Others section //@@begin others

private IFPM fpm = null; //@@end

– Source code for wdDoExit

– Source code for onBeforeOutput

– Source code for onInit

//@@begin wdDoExit()try{

fpm.exitCalled();} catch (Exception e){}

//@@end

//@@begin onBeforeOutput()Date record_Begda =

wdContext.currentSelectedInfotypeElement().getBegda();Date default_Begda =

wdContext.currentContextElement().getDefault_Begda();

if ((record_Begda == null) || (record_Begda.before(default_Begda))) {wdContext.currentSelectedInfotypeElement().setBegda(default_Begda);

} //@@end

//@@begin onInit()this.fpm = fpm;fpm.attachComponentToUsage(

wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcPersInfoComponentUsage());

fpm.attachComponentToUsage(wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcAddressComponentUsage());

//@@end

Page 64: Custom development of web dynpro ess applications using floor plan manager

64

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 64

Add source code to WD components: VcAddressReview: IC

Methods– isConsistent

- return true;

– isDirty- return wdThis.wdGetVcAddressReviewController().isDirty();

– isHidingPossible- return true;

– isSelectionChangePossible- return true;

– onBeforeOutput- wdThis.wdGetVcAddressReviewController().onBeforeOutput();

– onEvent- return true;

– onInit- wdThis.wdGetVcAddressReviewController().onInit(fpm);

Page 65: Custom development of web dynpro ess applications using floor plan manager

65

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 65

Add source code to WD components: VcAddressReview: ReviewView

Methods– wdDoModifyView //@@begin wdDoModifyView

try{

IWDTextView areaCode = (IWDTextView) view.getElement("AreaCode");if (wdContext

.currentSelectedInfotypeElement()

.getAreac()

.equalsIgnoreCase("000")){

areaCode.setVisible(WDVisibility.NONE);} else{

areaCode.setVisible(WDVisibility.VISIBLE);}

} catch (Exception ex){}if (wdContext

.currentSelectedInfotypeElement()

.getAnssa()

.equalsIgnoreCase("4")){

TextFieldInfo[] fieldInfo =new TextFieldInfo[] {new TextFieldInfo("Zz_Cnt_Langu", "Language")};

F4TextHelper.GetF4Text(wdThis.wdGetAPI(),wdContext.nodeSelectedInfotype(),view,fieldInfo);

} //@@end

Page 66: Custom development of web dynpro ess applications using floor plan manager

66

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 66

Create backend conversion class

The conversion class with its methods includes the main business logic for the service and is used to transfer data between backend andfrontendGot to Class Builder (/se24) or via ABAP Workbench (se80)Copy SAP standard class CL_HRPA_CONVERT_0006_US to ZCL_HRPA_CONVERT_0006_XXAdd phone number conversion method for US/CA– CONVERT_USCA_TELNR– CONVERT_TO_USCA_PHONE

Source code for standard conversion class methods– INPUT_CONVERSION– OUTPUT_CONVERSION– FILL_DROPDOWN_LISTBOX

Page 67: Custom development of web dynpro ess applications using floor plan manager

67

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 67

Important SAP backend configuration tables

Configure the assignment of UI structures (V_T588IT_SCREEN)– Delete country specific entries for the address infotype

- Only those country specific entries that are replaced by the custom service e.g. US, CA and GB

– Add a new entry to link the custom conversion class to our custom service

Define active subtypes and use cases (V_T7XSSPERSUBTYP)

Use Case A1 for Main Address

Use Case B3 for Emergency Contact

No other subtypes can be used with this service if they are not configured in this table

Other important configuration tables– V_T588MFPROPC

- Configuration of field attributes e.g. make a field a required field and thus have automatically an error message displayed if there is no value provided

– V_T582ITVCLAS- Infotype specific business logic and validation checks that is part of the new infotype framework. Classes are executed for entered

infotypes in ESS – even without concurrent employment enabled!

– V_T582ITVCHCK- Country specific infotype business logic and validation checks. Classes are executed for entered country version and infotypes in ESS –

even without concurrent employment enabled!

Page 68: Custom development of web dynpro ess applications using floor plan manager

68

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 68

DEPLOY &RUN

Page 69: Custom development of web dynpro ess applications using floor plan manager

69

Add source code to WD components

Demo and screenshots

Session Abstract

Create WD components

Page 70: Custom development of web dynpro ess applications using floor plan manager

70

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 70

Screenshots of the completed application: Overview screen

Page 71: Custom development of web dynpro ess applications using floor plan manager

71

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 71

Screenshots of the completed application: Detailed screen

Page 72: Custom development of web dynpro ess applications using floor plan manager

72

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 72

Screenshots of the completed application: Review/Delete screen

Page 73: Custom development of web dynpro ess applications using floor plan manager

73

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 73

Screenshots of the completed application: Confirmation screen

Page 74: Custom development of web dynpro ess applications using floor plan manager

74

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 74

Source code: FcAddress: CC: deleteRecord

//@@begin deleteRecord()try{

WDCopyService.copyCorresponding(wdThis

.wdGetContext()

.nodeReadOutput()

.nodeReadRecords()

.getElementAt(selection),

wdThis.wdGetContext().currentSelectedInfotypeElement());wdContext.nodeDeleteInfotype().bind(

(Z_Hress_Delete_P0006_Input) model.createModelObject(Z_Hress_Delete_P0006_Input.class));

wdContext.currentDeleteInfotypeElement().setObjectkey(wdContext.currentSelectedInfotypeElement().getObject_Key());

wdContext.currentDeleteInfotypeElement().modelObject().execute();wdThis.addValueHelp();//error handling will be done by international Fc in method check()

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 75: Custom development of web dynpro ess applications using floor plan manager

75

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 75

Source code: FcAddress: CC: getPriorities

//@@begin getPriorities()try{

fpm.getMessageManager().deleteAllMessages(wdThis.wdGetAPI().getComponent());

wdContext.nodePriorityMc().bind((Z_Hress_P0006_Prioritymc_Input) model.createModelObject(

Z_Hress_P0006_Prioritymc_Input.class));wdContext.currentPriorityMcElement().setI_Withemptyline(false);wdContext.currentPriorityMcElement().setI_Employeenumber(

Employeenumber);wdContext.currentPriorityMcElement().setI_Priority(Priority);wdContext.currentPriorityMcElement().modelObject().execute();//An exception is triggered and application will be terminated. Only first //message in messages node will be displayedMessageHelper.raiseException(

fpm,wdThis.wdGetAPI(),wdContext.nodePriorityMessages());

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 76: Custom development of web dynpro ess applications using floor plan manager

76

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 76

Source code: FcAddress: CC: getStates

//@@begin getStates()try{

fpm.getMessageManager().deleteAllMessages(wdThis.wdGetAPI().getComponent());

wdContext.nodeStateMc().bind((Z_Hress_P0006_Statemc_Input) model.createModelObject(

Z_Hress_P0006_Statemc_Input.class));wdContext.currentStateMcElement().setI_Withemptyline(false);wdContext.currentStateMcElement().setI_Countrykey(Country);wdContext.currentStateMcElement().modelObject().execute();//An exception is triggered and application will be terminated. Only first //message in messages node will be displayedMessageHelper.raiseException(

fpm,wdThis.wdGetAPI(),wdContext.nodeStateMessages());

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 77: Custom development of web dynpro ess applications using floor plan manager

77

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 77

Source code: FcAddress: CC: modifyRecord

//@@begin modifyRecord()try{

wdContext.nodeModifyInfotype().bind((Z_Hress_Modify_P0006_Input) model.createModelObject(

Z_Hress_Modify_P0006_Input.class));Zhcmt_Bsp_Pa_R0006 recordElem =

(Zhcmt_Bsp_Pa_R0006) model.createModelObject(Zhcmt_Bsp_Pa_R0006.class);

wdContext.nodeModifyRecord().bind(recordElem);wdContext.currentModifyInfotypeElement().modelObject().setRecord(

recordElem);WDCopyService.copyCorresponding(

wdThis.wdGetContext().currentSelectedInfotypeElement(),wdThis.wdGetContext().currentModifyRecordElement());

wdContext.currentModifyInfotypeElement().modelObject().execute();//error handling will be done by international Fc in method check()

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 78: Custom development of web dynpro ess applications using floor plan manager

78

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 78

Source code: FcAddress: CC: newRecord

//@@begin newRecord()try{

//create new recordwdContext.nodeNewInfotype().bind(

(Z_Hress_New_P0006_Input) model.createModelObject(Z_Hress_New_P0006_Input.class));

wdContext.currentNewInfotypeElement().setInfty("0006");wdContext.currentNewInfotypeElement().setSubty(subtype);wdContext.currentNewInfotypeElement().modelObject().execute();WDCopyService.copyCorresponding(

wdThis.wdGetContext().nodeNewRecord().currentNewRecordElement(),wdThis.wdGetContext().currentSelectedInfotypeElement());

wdThis.addValueHelp();//error handling will be done by international Fc in method check()

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 79: Custom development of web dynpro ess applications using floor plan manager

79

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 79

Source code: FcAddress: CC: onInit

//@@begin onInit()setInstructions();try{

this.fpm = fpm;model =

(ZHR_ESS_P0006) WDModelFactory.getModelInstance(ZHR_ESS_P0006.class,WDModelScopeType.APPLICATION_SCOPE);

fpm.connectModel(model);wdContext.nodeSelectedInfotype().bind(

(Zhcmt_Bsp_Pa_R0006) model.createModelObject(Zhcmt_Bsp_Pa_R0006.class));

//debughelp//if (fpm.getApplicationContext().inDebugMode()) {fpm.registerContext(wdContext);//}

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

}fpm.attachComponentToUsage(

wdThis.wdGetAPI().getComponent(),wdThis.wdGetFcPersInfoComponentUsage());

//@@end

Page 80: Custom development of web dynpro ess applications using floor plan manager

80

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 80

Source code: FcAddress: CC: readRecord

//@@begin readRecord()try{

// GetInfotypeListwdContext.nodeReadInfotype().bind(

(Z_Hress_Read_P0006_Input) model.createModelObject(Z_Hress_Read_P0006_Input.class));

wdContext.currentReadInfotypeElement().setInfty("0006");wdContext.currentReadInfotypeElement().modelObject().execute();MessageHelper.raiseException(

fpm,wdThis.wdGetAPI(),wdContext.nodeReadMessages());

} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 81: Custom development of web dynpro ess applications using floor plan manager

81

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 81

Source code: FcAddress: CC: selectCountry

//@@begin selectCountry() //Set new UI attribute values according to provided country setUI(Country);

//Update current record context node with provided country informationwdContext.currentSelectedInfotypeElement().setLand1(Country);int iCountry = wdContext.nodeCountryRecords().getLeadSelection();wdContext.currentSelectedInfotypeElement().setLand1_Text(

wdContext.nodeCountryRecords().getCountryRecordsElementAt(iCountry).getLandx());

//Update drop down for states according to provided countrygetStates(Country);//Update current record context node with defaulted state information//This is necessary because user can decide to use value displayed in state drop down//and not select a new state!wdContext.currentSelectedInfotypeElement().setState(

wdContext.currentStateRecordsElement().getState());int iState = wdContext.nodeStateRecords().getLeadSelection();wdContext.currentSelectedInfotypeElement().setState_Text(

wdContext.nodeStateRecords().getStateRecordsElementAt(iState).getState_Text());

//@@end

Page 82: Custom development of web dynpro ess applications using floor plan manager

82

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 82

Source code: FcAddress: CC: selectPriority & selectState

//@@begin selectPriority()//Update current record context node with provided priority informationwdContext.currentSelectedInfotypeElement().setZz_Cnt_Priority(Priority);int iPriority = wdContext.nodePriorityRecords().getLeadSelection();wdContext.currentSelectedInfotypeElement().setPriority_Text(

wdContext.nodePriorityRecords().getPriorityRecordsElementAt(iPriority).getPriority_Text());

//@@end

//@@begin selectState()//Update current record context node with provided state informationwdContext.currentSelectedInfotypeElement().setState(State);int iState = wdContext.nodeStateRecords().getLeadSelection();wdContext.currentSelectedInfotypeElement().setState_Text(

wdContext.nodeStateRecords().getStateRecordsElementAt(iState).getState_Text());

//@@end

Page 83: Custom development of web dynpro ess applications using floor plan manager

83

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 83

Source code: FcAddress: CC: selectRecord

//@@begin selectRecord()try{

WDCopyService.copyCorresponding(wdThis

.wdGetContext()

.nodeReadOutput()

.nodeReadRecords()

.getElementAt(selection),

wdThis.wdGetContext().currentSelectedInfotypeElement());wdContext.nodeEditInfotype().bind(

(Z_Hress_Edit_P0006_Input) model.createModelObject(Z_Hress_Edit_P0006_Input.class));

wdContext.currentEditInfotypeElement().setObjectkey(wdThis

.wdGetContext()

.currentSelectedInfotypeElement()

.getObject_Key());wdContext.currentEditInfotypeElement().modelObject().execute();MessageHelper.raiseException(

fpm,wdThis.wdGetAPI(),wdContext.nodeEditMessages());

// WDCopyService.copyCorresponding(wdThis.wdGetContext().nodeEditOutput().nodeEditRecord().currentEditRecordElement(),

// wdThis.wdGetContext().currentSelectedInfotypeElement());

wdThis.addValueHelp();} catch (Exception ex){

fpm.getMessageManager().raiseException(wdThis.wdGetAPI().getComponent(),ex);

} //@@end

Page 84: Custom development of web dynpro ess applications using floor plan manager

84

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 84

Source code: FcAddress: CC: setDefaultCountry & setDefaultPriority //@@begin setDefaultCountry()

//Set default value of drop down to provided country valuefor (int iCountry = 0;

iCountry < wdContext.nodeCountryRecords().size();iCountry++)

{if (wdContext

.nodeCountryRecords()

.getCountryRecordsElementAt(iCountry)

.getLand1()

.equals(Country)){

wdContext.nodeCountryRecords().setLeadSelection(iCountry);wdContext.currentSelectedInfotypeElement().setLand1_Text(

wdContext.currentCountryRecordsElement().getLandx());}

} //@@end

//@@begin setDefaultPriority()//Set default value of drop down to provided priority valuefor (int iPriority = 0;

iPriority < wdContext.nodePriorityRecords().size();iPriority++)

{if (wdContext

.nodePriorityRecords()

.getPriorityRecordsElementAt(iPriority)

.getPriority()

.equals(Priority)){

wdContext.nodePriorityRecords().setLeadSelection(iPriority);wdContext.currentSelectedInfotypeElement().setPriority_Text(

wdContext.currentPriorityRecordsElement().getPriority_Text());

}}

//@@end

Page 85: Custom development of web dynpro ess applications using floor plan manager

85

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 85

Source code: FcAddress: CC: setDefaultState & setInstructions

//@@begin setDefaultState()//Set default value of drop down to provided state valuefor (int iState = 0;

iState < wdContext.nodeStateRecords().size();iState++)

{if (wdContext

.nodeStateRecords()

.getStateRecordsElementAt(iState)

.getState()

.equals(State)){

wdContext.nodeStateRecords().setLeadSelection(iState);wdContext.currentSelectedInfotypeElement().setState_Text(

wdContext.currentStateRecordsElement().getState_Text());}

} //@@end

//@@begin setInstructions()wdContext.currentTextElement().setCreditCardHeader(

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("DinersClubHeader"));

wdContext.currentTextElement().setCreditCardInstructions(wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"DinersClubInstructions")); //@@end

Page 86: Custom development of web dynpro ess applications using floor plan manager

86

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 86

Source code: FcAddress: CC: setUI //@@begin setUI()

if (Country.equalsIgnoreCase("US")){

wdContext.currentUIElement().setRegionLabel(wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"RegionLabel_US"));wdContext.currentUIElement().setZipLabel(

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("ZipLabel_US"));

wdContext.currentUIElement().setIsCountyEntryVisible(WDVisibility.VISIBLE);

wdContext.currentUIElement().setIsAreaCodeVisible(WDVisibility.VISIBLE);

wdContext.currentUIElement().setIsRegionRequired(WDState.REQUIRED);wdContext.currentUIElement().setIsZipRequired(WDState.REQUIRED);

} else if (Country.equalsIgnoreCase("CA")){

wdContext.currentUIElement().setRegionLabel(wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"RegionLabel_CA"));wdContext.currentUIElement().setZipLabel(

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("ZipLabel_CA"));

wdContext.currentUIElement().setIsCountyEntryVisible(WDVisibility.NONE);

wdContext.currentUIElement().setIsAreaCodeVisible(WDVisibility.VISIBLE);

wdContext.currentUIElement().setIsRegionRequired(WDState.REQUIRED);wdContext.currentUIElement().setIsZipRequired(WDState.REQUIRED);

} else if (Country.equalsIgnoreCase("GB")){

wdContext.currentUIElement().setRegionLabel(wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"RegionLabel_GB"));wdContext.currentUIElement().setZipLabel(

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("ZipLabel_GB"));

wdContext.currentUIElement().setIsCountyEntryVisible(WDVisibility.NONE);

wdContext.currentUIElement().setIsAreaCodeVisible(WDVisibility.NONE);

wdContext.currentUIElement().setIsRegionRequired(WDState.REQUIRED);wdContext.currentUIElement().setIsZipRequired(WDState.REQUIRED);

} else{

wdContext.currentUIElement().setRegionLabel(wdThis.wdGetAPI().getComponent().getTextAccessor().getText(

"RegionLabel_Other"));wdContext.currentUIElement().setZipLabel(

wdThis.wdGetAPI().getComponent().getTextAccessor().getText("ZipLabel_Other"));

wdContext.currentUIElement().setIsAreaCodeVisible(WDVisibility.NONE);

wdContext.currentUIElement().setIsRegionRequired(WDState.NORMAL);wdContext.currentUIElement().setIsZipRequired(WDState.NORMAL);

} //@@end

Page 87: Custom development of web dynpro ess applications using floor plan manager

87

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 87

Source code: FcAddress: CC: setUI_ECMVisible

//@@begin setUI_EMCVisible()//Check provided subtype value to hide or display Emergency Contact Containerif (Subtype.equalsIgnoreCase("4")){

wdContext.currentUIElement().setIsEmergencyContactVisible(WDVisibility.VISIBLE);

} else{

wdContext.currentUIElement().setIsEmergencyContactVisible(WDVisibility.NONE);

} //@@end

Page 88: Custom development of web dynpro ess applications using floor plan manager

88

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 88

Source code: BizCard Helper class: Part 1 & Part 2

/** * Copied from SAP standard overview helper class: OverviewHelper.java of DC: ess/per * on 08/22/06 by [email protected] * Code changes are identified by 'HR<date>' * *//** * HR082206 change package name to point to correct location of class */package com.demo.hr.ess.address.helpers;import java.util.Date;import java.util.GregorianCalendar;

import com.sap.dictionary.runtime.ISimpleType;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDButton;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridData;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGridLayout;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDGroup;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDLabel;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTransparentContainer;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDButtonDesign;import com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDGroupDesign;import com.sap.tc.webdynpro.progmodel.api.IWDNode;import com.sap.tc.webdynpro.progmodel.api.IWDNodeElement;import com.sap.tc.webdynpro.progmodel.api.IWDView;import com.sap.xss.per.helpers.BizcardFieldInfo;/** * @author i007419 * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */

/** * * HR082206 change public class name to avoid conflicts */public class AddressOverviewHelper {

public static void CreateOverview(IWDNode records,IWDNode subtypes,IWDView view,BizcardFieldInfo[] fieldInfo1, //HR082206

BizcardFieldInfo[] fieldInfo2, //HR082206Date defaultBegda,String subtypeFieldName) {view.resetView();

IWDTransparentContainer rootContainer =(IWDTransparentContainer) view.getElement("rootContainer");

//Create Bizcard Container ----------------------------------IWDTransparentContainer bizcardContainer =

(IWDTransparentContainer) view.createElement(IWDTransparentContainer.class,"bizcardContainer");

bizcardContainer.setWidth("70%");IWDGridLayout bcContainerGridLayout =

(IWDGridLayout) bizcardContainer.createLayout(IWDGridLayout.class);bcContainerGridLayout.setColCount(2);

//Create Button Container ----------------------------------IWDTransparentContainer buttonContainer =

(IWDTransparentContainer) view.createElement(IWDTransparentContainer.class,"buttonContainer");

IWDGridLayout buttonContainerGridLayout =(IWDGridLayout) buttonContainer.createLayout(IWDGridLayout.class);

buttonContainer.setWidth("250px");buttonContainerGridLayout.setColCount(2);

rootContainer.addChild(bizcardContainer);rootContainer.addChild(buttonContainer);

//Create Bizcardsfor (int i = 0; i < records.size(); i++) {

//Create Bizcard for this Record ----------------------IWDGroup bizcard =

(IWDGroup) view.createElement(IWDGroup.class, "bizcard_" + i);bizcard.setWidth("300px");bizcard.setDesign(WDGroupDesign.SAPCOLOR);IWDGridLayout bcGridLayout =

(IWDGridLayout) bizcard.createLayout(IWDGridLayout.class);

bcGridLayout.setColCount(2);

IWDGridData bcGridData =(IWDGridData) bizcard.createLayoutData(IWDGridData.class);

bcGridData.setPaddingRight("15px");bcGridData.setPaddingBottom("15px");

IWDNodeElement recordElement = records.getElementAt(i);

//Create Bizcard Header ---------------------------------------IWDCaption header =

(IWDCaption) view.createElement(IWDCaption.class, "header" + i);

//Get Subtype text--------------------------------------------String stext;for (int j = 0; j < subtypes.size(); j++) {

IWDNodeElement subtypeElement = subtypes.getElementAt(j);String tableSubtypeNumber =

subtypeElement.getAttributeValue("Subtype").toString();

if (subtypeFieldName.equals("")) {if (tableSubtypeNumber.equals("")) {

header.setText(subtypeElement

.getAttributeValue("Stext")

.toString());}

} else {String recordSubtypeNumber =

recordElement.getAttributeValue(subtypeFieldName).toString();

if (tableSubtypeNumber.equals(recordSubtypeNumber)) {header.setText(

subtypeElement.getAttributeValue("Stext").toString());

}}

}

//If future record, append begin date of record to Bizcard headertry {

ISimpleType st = records.getNodeInfo().getAttribute("Begda").getSimpleType();String recordDateFormat = st.format(recordElement.getAttributeValue("Begda"));String recordDateString =

recordElement.getAttributeValue("Begda").toString();GregorianCalendar calendar_default = new GregorianCalendar();GregorianCalendar calendar_record = new GregorianCalendar();calendar_default.setTime(defaultBegda);calendar_record.setTime(defaultBegda);calendar_record.set(

Integer.parseInt(recordDateString.substring(0, 4)),Integer.parseInt(recordDateString.substring(5, 7)) - 1,Integer.parseInt(recordDateString.substring(8, 10)));

if (calendar_record.equals(calendar_default)) {header.setText(

header.getText()+ " ("+ view.getComponent().getTextAccessor().getText(

"EffectiveAsOfToday")+ ")");

} else if (calendar_record.after(calendar_default)) {header.setText(

header.getText()+ " ("+ view.getComponent().getTextAccessor().getText(

"EffectiveAsOf",new String[] { recordDateFormat })

+ ")");}

} catch (RuntimeException ex) {// TODO Auto-generated catch blockex.printStackTrace();

}//HR082206 Begin bizcard.setHeader(header); BizcardFieldInfo[] fieldInfo; String strSubtype =

recordElement.getAttributeValue("Anssa").toString(); if (strSubtype.equals("4"))

fieldInfo = fieldInfo2; else

fieldInfo = fieldInfo1;//HR082206 End// bizcard.setHeader(header); HR082206

Part 1 Part 2

Page 89: Custom development of web dynpro ess applications using floor plan manager

89

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 89

Source code: BizCard Helper class: Part 3 & Part 4

for (int k = 0; k < fieldInfo.length; k++) {IWDLabel labelView =

(IWDLabel) view.createElement(IWDLabel.class,"labelView" + i + k);

labelView.setText(fieldInfo[k].label);IWDTextView textView =

(IWDTextView) view.createElement(IWDTextView.class,"textView" + i + k);

labelView.setLabelFor("textView" + i + k);if (recordElement.getAttributeValue(fieldInfo[k].fieldname)

== null) {textView.setText("");

} else {textView.setText(

recordElement.getAttributeValue(fieldInfo[k].fieldname).toString());

}IWDGridData textGridData =

(IWDGridData) textView.createLayoutData(IWDGridData.class);textGridData.setWidth("60%");bizcard.addChild(labelView);bizcard.addChild(textView);

}

//Create EDIT Button Container ----------------------------------IWDTransparentContainer editButtonContainer =

(IWDTransparentContainer) view.createElement(IWDTransparentContainer.class,"editButtonContainer" + i);

IWDGridLayout editButtonContainerGridLayout =(IWDGridLayout) editButtonContainer.createLayout(IWDGridLayout.class);

IWDGridData editButtonContainerGridData =(IWDGridData) editButtonContainer.createLayoutData(IWDGridData.class);

editButtonContainer.setWidth("150px");editButtonContainerGridData.setColSpan(2);editButtonContainerGridData.setPaddingTop("15px");editButtonContainerGridLayout.setColCount(2);

//Create Edit Button --------------------------------IWDButton editButton =

(IWDButton) view.createElement(IWDButton.class,"editButton_" + i);

editButton.setText(view.getComponent().getTextAccessor().getText("Edit"));

editButton.setOnAction(view.getAction("Edit"));editButton.mappingOfOnAction().addParameter("index", i);editButton.setWidth("50px");IWDGridData editButtonGridData =

(IWDGridData) editButton.createLayoutData(IWDGridData.class);editButtonGridData.setPaddingRight("10px");editButton.setDesign(WDButtonDesign.NEXT);//bizcard.addChild(editButton);editButtonContainer.addChild(editButton);

Part 3 Part 4//Create Delete Button --------------------------------if (hasDeleteButton(recordElement,

subtypes,subtypeFieldName,defaultBegda)) {IWDButton deleteButton =

(IWDButton) view.createElement(IWDButton.class,"deleteButton_" + i);

deleteButton.setText(view.getComponent().getTextAccessor().getText("Delete"));

deleteButton.setOnAction(view.getAction("Delete"));deleteButton.mappingOfOnAction().addParameter("index", i);deleteButton.setWidth("50px");IWDGridData deleteButtonGridData =

(IWDGridData) deleteButton.createLayoutData(IWDGridData.class);

deleteButtonGridData.setPaddingRight("15px");//bizcard.addChild(deleteButton);editButtonContainer.addChild(deleteButton);

}//Add EDIT Button container to Bizcardbizcard.addChild(editButtonContainer);

//Add this Bizcard to bizcardContainerbizcardContainer.addChild(bizcard);

}int newButtonCount = 0;for (int subtypeCount = 0;

subtypeCount < subtypes.size();subtypeCount++) {IWDNodeElement subtypeElement = subtypes.getElementAt(subtypeCount);

if (hasNewButton(records, subtypeElement, subtypeFieldName)) {//Create NEW buttonString subtypeName =

subtypeElement.getAttributeValue("Stext").toString();String subtypeNumber =

subtypeElement.getAttributeValue("Subtype").toString();IWDButton newButton =

(IWDButton) view.createElement(IWDButton.class,"newButton_" + subtypeNumber);

newButton.setText(view.getComponent().getTextAccessor().getText(

"New",new String[] { subtypeName }));

newButton.setWidth("150px");newButton.setOnAction(view.getAction("New"));newButton.mappingOfOnAction().addParameter(

"subtype",subtypeNumber);

IWDGridData newButtonGridData =(IWDGridData) newButton.createLayoutData(IWDGridData.class);

newButton.setDesign(WDButtonDesign.NEXT);newButtonGridData.setPaddingBottom("10px");newButtonCount++;

Page 90: Custom development of web dynpro ess applications using floor plan manager

90

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 90

Source code: BizCard Helper class: Part 5 & Part 6

Part 5 Part 6//Create Cancel button-----------------------------------if (newButtonCount == 1) {

newButtonGridData.setColSpan(1);

IWDButton cancelButton =(IWDButton) view.createElement(

IWDButton.class,"cancelButton");

cancelButton.setText(view.getComponent().getTextAccessor().getText(

"Cancel"));cancelButton.setWidth("50px");cancelButton.setOnAction(view.getAction("Cancel"));IWDGridData cancelButtonGridData =

(IWDGridData) cancelButton.createLayoutData(IWDGridData.class);

cancelButtonGridData.setPaddingLeft("30px");buttonContainer.addChild(newButton);buttonContainer.addChild(cancelButton);

} else {newButtonGridData.setColSpan(2);buttonContainer.addChild(newButton);

}

}}if (newButtonCount == 0) {

IWDButton cancelButton =(IWDButton) view.createElement(IWDButton.class, "cancelButton");

cancelButton.setText(view.getComponent().getTextAccessor().getText("Cancel"));

cancelButton.setWidth("50px");cancelButton.setOnAction(view.getAction("Cancel"));IWDGridData cancelButtonGridData =

(IWDGridData) cancelButton.createLayoutData(IWDGridData.class);buttonContainer.addChild(cancelButton);

}}

private static boolean hasNewButton(IWDNode records,IWDNodeElement subtypeElement,String subtypeFieldName) {boolean hasNewButton = true;

String usecase = (String) subtypeElement.getAttributeValue("Case");if (usecase.equals("B3")) {

// New button is needed for case B3----------------------hasNewButton = true;

} else {if (subtypeFieldName.equals("") & records.size() > 0) {

hasNewButton = false;} else {

// Other cases, check whether there is record with same subtypefor (int i = 0; i < records.size(); i++) {

IWDNodeElement recordElement = records.getElementAt(i);if (recordElement

.getAttributeValue(subtypeFieldName)

.equals(subtypeElement.getAttributeValue("Subtype"))) {hasNewButton = false;//}break;

}}

}}return hasNewButton;

}

private static boolean hasDeleteButton(IWDNodeElement recordElement,IWDNode subtypes,String subtypeFieldName,Date defaultBegda) {boolean hasDeleteButton = false;if (((Date) recordElement.getAttributeValue("Begda"))

.after(defaultBegda))hasDeleteButton = true;

else {String usecase = "";if (subtypeFieldName.equals("")) {

for (int j = 0; j < subtypes.size(); j++) {IWDNodeElement subtype = subtypes.getElementAt(j);if (subtype

.getAttributeValue("Subtype")

.equals(subtypeFieldName)) {usecase = (String) subtype.getAttributeValue("Case");break;

}}

} else {for (int j = 0; j < subtypes.size(); j++) {

IWDNodeElement subtype = subtypes.getElementAt(j);if (recordElement

.getAttributeValue(subtypeFieldName)

.equals(subtype.getAttributeValue("Subtype"))) {usecase = (String) subtype.getAttributeValue("Case");break;

}}

}//if ((usecase.substring(1).equals("2")) || (usecase.substring(1).equals("3")))if ((usecase.equals("A2"))

|| (usecase.equals("B2"))|| (usecase.equals("B3"))) {hasDeleteButton = true;

}}

return hasDeleteButton;}

} //HR082206 Set closing bracket! Use Organize Imports to get import statements!/** * HR082206 all code below has been deleted as it is not necessary anymore! * */

// public static void CreateOverview(// IWDNode records,// IWDNode subtypes,// IWDView view,// BizcardFieldInfo[] fieldInfo,// Date defaultBegda,// String subtypeFieldName, // java.util.Locale locale) {// view.resetView();////

Page 91: Custom development of web dynpro ess applications using floor plan manager

91

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 91

Source code: VcAddressOverview: CC: create & delete

//@@begin create()//Hide/Display Emergency Contact Container on next screen based on selected subtypewdThis.wdGetFcAddressInterface().setUI_EMCVisible(subtype);//Populate drop down field: CountrywdThis.wdGetFcAddressInterface().getCountries();//Populate drop down field: Priority//Only execute for Emergency contactif (subtype.equalsIgnoreCase("4")){

wdThis.wdGetFcAddressInterface().getPriorities(wdThis.wdGetFcEmployeeServicesInterface().getEmployeenumber(),"");

}//Next perspectiveselectedSubtype = subtype;fpm.raiseEvent(IFPM.EVENT_ADD, thisVAC);

//@@end

//@@begin delete()//Set new UI attribute values based on country of selected recordwdThis.wdGetFcAddressInterface().setUI(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getLand1());

//Hide/Display Emergency Contact Container on next screen for selected subtype recordwdThis.wdGetFcAddressInterface().setUI_EMCVisible(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getAnssa());

//Next perspectiveselectedRecord = index;fpm.raiseEvent(IFPM.EVENT_REMOVE, thisVAC);

//@@end

Page 92: Custom development of web dynpro ess applications using floor plan manager

92

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 92

Source code: VcAddressOverview: CC: edit //@@begin edit()

//Set new UI attribute values based on country of selected recordwdThis.wdGetFcAddressInterface().setUI(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getLand1());

//Hide/Display Emergency Contact Container on next screen for selected subtype recordwdThis.wdGetFcAddressInterface().setUI_EMCVisible(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getAnssa());

//Populate drop down field: CountrywdThis.wdGetFcAddressInterface().getCountries();//Set drop down to country of selected recordwdThis.wdGetFcAddressInterface().setDefaultCountry(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getLand1());

//Populate drop down field: StatewdThis.wdGetFcAddressInterface().getStates(

wdContext.currentCountryRecordsElement().getLand1());//Set drop down to state of selected recordwdThis.wdGetFcAddressInterface().setDefaultState(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getState());

//Populate drop down field: Priority//Only execute for Emergency contactif (wdContext

.nodeInfotypeList()

.getInfotypeListElementAt(index)

.getAnssa()

.equalsIgnoreCase("4")){

wdThis.wdGetFcAddressInterface().getPriorities(wdThis.wdGetFcEmployeeServicesInterface().getEmployeenumber(),wdContext

.nodeInfotypeList()

.getInfotypeListElementAt(index)

.getZz_Cnt_Priority());//Set drop down to priority of selected recordwdThis.wdGetFcAddressInterface().setDefaultPriority(

wdContext.nodeInfotypeList().getInfotypeListElementAt(index).getZz_Cnt_Priority());

}//Next perspective selectedRecord = index;fpm.raiseEvent(IFPM.EVENT_EDIT, thisVAC);

//@@end

Page 93: Custom development of web dynpro ess applications using floor plan manager

93

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 93

Source code: VcAddressOverview: CC: onEvent

//@@begin onEvent()String event = fpm.getEventData().getEventName();if (event.equals(IFPM.EVENT_ADD)){

wdThis.wdGetFcAddressInterface().newRecord(selectedSubtype);wdThis.wdGetFcPersInfoInterface().setModeCreate(selectedSubtype);

} else if (event.equals(IFPM.EVENT_EDIT)){

wdThis.wdGetFcAddressInterface().selectRecord(selectedRecord);wdThis.wdGetFcPersInfoInterface().setModeEdit(

wdContext.currentSelectedInfotypeElement().getAnssa());} else if (event.equals(IFPM.EVENT_REMOVE)){

wdThis.wdGetFcAddressInterface().deleteRecord(selectedRecord);wdThis.wdGetFcPersInfoInterface().setModeDelete(

wdContext.currentSelectedInfotypeElement().getAnssa());}

//@@end

Page 94: Custom development of web dynpro ess applications using floor plan manager

94

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 94

Source code: VcAddressDetail: CC: isConsistent

//@@begin isConsistent()if (fpm.getEventData().getEventName().equals(IFPM.EVENT_REVIEW)){

if (wdThis.wdGetFcPersInfoInterface().check(wdContext.currentSelectedInfotypeElement())== true)

{//return Veto.NO_VETO;return true;

} else{

//return Veto.VETO;return false;

}} else{

//return Veto.NO_VETO;return true;

} //@@end

Page 95: Custom development of web dynpro ess applications using floor plan manager

95

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 95

Source code: VcAddressDetail: CC: onFlush

//@@begin onFlush()Date record_Begda =

wdContext.currentSelectedInfotypeElement().getBegda();Date default_Begda =

wdContext.currentContextElement().getDefault_Begda();if (record_Begda == null || record_Begda.equals("")){

record_Begda = default_Begda;}if (wdContext.nodeAs_of_radiobutton().getLeadSelection() == 0){

wdContext.currentSelectedInfotypeElement().setBegda(default_Begda);} else{

// check future date, if not future, set to default_date + 1if (record_Begda.before(default_Begda)

|| record_Begda.equals(default_Begda)){

// issue error message? GregorianCalendar calendar_Default = new GregorianCalendar();calendar_Default.setTime(default_Begda);calendar_Default.add(Calendar.DAY_OF_MONTH, 1);Date next_Date = new Date(calendar_Default.getTime().getTime());wdContext.currentSelectedInfotypeElement().setBegda(next_Date);

}}//wdThis.wdGetFcAddressInterface().modifyRecord();

//@@end

Page 96: Custom development of web dynpro ess applications using floor plan manager

96

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 96

Source code: Backend conversion class: INPUT_CONVERSION

METHOD if_hrpa_standard_conversions~input_conversion .

FIELD-SYMBOLS <r0006> TYPE zhcmt_bsp_pa_r0006. FIELD-SYMBOLS <p0006> TYPE p0006.

is_ok = true.

ASSIGN screen_structure TO <r0006>. ASSIGN pnnnn TO <p0006>. MOVE-CORRESPONDING <r0006> TO <p0006>.

*--Country specific conversions CASE <r0006>-land1. WHEN 'US' OR 'CA'. "US/CA specific MOVE '10' TO <p0006>-itbld.*--Convert phone number CALL METHOD me->convert_usca_telnr EXPORTING i_area = <r0006>-areac i_telnr = <r0006>-telnr i_message_handler = message_handler IMPORTING e_telnr = <p0006>-telnr.

WHEN 'GB'. "UK specific MOVE '08' TO <p0006>-itbld. WHEN OTHERS. "International version MOVE '99' TO <p0006>-itbld. ENDCASE.

ENDMETHOD.

Page 97: Custom development of web dynpro ess applications using floor plan manager

97

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 97

Source code: Backend conversion class: OUTPUT_CONVERSION

Part 1 Part 2METHOD if_hrpa_standard_conversions~output_conversion .

* data definitions FIELD-SYMBOLS: <r0006> TYPE zhcmt_bsp_pa_r0006, <p0006> TYPE p0006.

DATA lenzip TYPE i. DATA lennum TYPE i. DATA remainnum TYPE i. DATA lv_telnr TYPE telnr. DATA lv_area TYPE p10_ui_areac.

*--For priority text DATA: ld_value TYPE dd07v-domvalue_l, ld_dd07v_wa TYPE dd07v.

is_ok = true.* Global field assignments ASSIGN pnnnn TO <p0006>. ASSIGN screen_structure TO <r0006>.

* Fill UI Structure MOVE-CORRESPONDING <p0006> TO <r0006>.

*--Process country specific content CASE <r0006>-land1. WHEN 'US' OR 'CA'. "US/CA specific

*--Phone number IF <p0006>-telnr IS NOT INITIAL. CLEAR: lv_telnr, lv_area.

CALL METHOD me->convert_to_usca_phone EXPORTING i_telnr = <p0006>-telnr IMPORTING e_areac = lv_area e_telnr = lv_telnr.

*--For BizCard only CONCATENATE lv_area lv_telnr INTO <r0006>-telnr_biz SEPARATED BY space. ENDIF.

WHEN OTHERS.*--Phone number*--For BizCard only MOVE <p0006>-telnr TO <r0006>-telnr_biz.

ENDCASE. "case <r0006>-land1.

*--Country text CLEAR: <r0006>-land1_text. IF <p0006>-land1 IS NOT INITIAL. SELECT SINGLE landx FROM t005t INTO <r0006>-land1_text WHERE spras = sy-langu AND land1 = <p0006>-land1. ENDIF.

*--Region/State/County/Province text CLEAR: <r0006>-state_text. IF <p0006>-state IS NOT INITIAL. SELECT SINGLE bezei FROM t005u INTO <r0006>-state_text WHERE spras = sy-langu AND land1 = <p0006>-land1 AND bland = <p0006>-state. ENDIF.

*--Priority Text for Emergency Contact CLEAR: <r0006>-priority_text. IF <p0006>-zz_cnt_priority IS NOT INITIAL. ld_value = <p0006>-zz_cnt_priority.

CALL FUNCTION 'DDUT_DOMVALUE_TEXT_GET' EXPORTING name = 'ZPA_CNT_PRIORITY' value = ld_value langu = sy-langu IMPORTING dd07v_wa = ld_dd07v_wa EXCEPTIONS not_found = 1 illegal_input = 2 OTHERS = 3.

*--Check RC IF sy-subrc NE 0. CLEAR <r0006>-priority_text. ELSE. <r0006>-priority_text = ld_dd07v_wa-ddtext. ENDIF. ENDIF. "if <p0006>-zz_cnt_priority is not initial.ENDMETHOD.

Page 98: Custom development of web dynpro ess applications using floor plan manager

98

© SAP AG 2006, SAP TechEd ’06 / SDN Day / 98

Source code: Backend conversion class: FILL_DROPDOWN_LISTBOX

METHOD if_hrpa_screen_control~fill_dropdown_listbox .*--Data definitions*--Key/Description definition for Language drop down TYPES BEGIN OF ts_language_data. TYPES langy TYPE zspras. TYPES langt TYPE sptxt. TYPES END OF ts_language_data. DATA: lt_language_data TYPE STANDARD TABLE OF ts_language_data. DATA: ls_language_data LIKE LINE OF lt_language_data.

*--Drop down handling FIELD-SYMBOLS <ddlb> TYPE crmt_dropdownlistbox_data. FIELD-SYMBOLS <ddlb_data_tab> TYPE STANDARD TABLE.

*--Initialize CLEAR: ls_language_data. REFRESH: lt_language_data.

LOOP AT dropdownlb_datas ASSIGNING <ddlb>. CASE <ddlb>-fieldname. WHEN 'ZZ_CNT_LANGU'. <ddlb>-keycolumnname = 'LANGY'. <ddlb>-valuecolumnname = 'LANGT'.

CREATE DATA <ddlb>-data TYPE STANDARD TABLE OF ts_language_data. ASSIGN <ddlb>-data->* TO <ddlb_data_tab>.*--Get language records from custom table ZLANGUT SELECT zspras sptxt INTO TABLE lt_language_data FROM zlangut WHERE spras EQ sy-langu.

*--Check RC IF sy-subrc NE 0.*--TO DO EXIT. ENDIF.*--Assign records to output structure LOOP AT lt_language_data INTO ls_language_data. APPEND ls_language_data TO <ddlb_data_tab>. ENDLOOP.

ENDCASE. ENDLOOP.ENDMETHOD.