Show TOC Start of Content Area

Procedure documentation Including Value Help  Locate the document in its SAP Library structure

Use

A value help item usually consists of a dropdown list of selectable items, among which the user of the client device can choose. The data populating the dropdown list is usually derived from a data source, such as a hard-coded list, or through some dynamic filling process that is either triggered by the application or automatically through a foreign-key relationship to some data source. Mobile Applications for Handhelds support all three options through two fundamentally different programming techniques:

·        Within the data model of a Mobile Service Component, the attribute of some client data object A can define a value help relationship to another client data object B.

Example

In a customer creation form, a field is offered in which the end user defines the customer’s country code. From a usability perspective, it is obviously preferable, that the end user is offered a value help containing a list of valid, human-readable country names (such as United States of America instead of US). Therefore a value help relationship of the customer’s country code attribute is established to the client data object Country that contains attributes for both the country key (Value help key) and the country text (Display value).

Through this procedure, a hidden client data object attribute country___text is created within the customer client data object. On import of the Mobile Service Component as a Web Dynpro (WD)  model, a dedicated WD model class of the same name is created. This will then typically be used to create the context (now containing node fields for both country and country___text. The form field can then be bound directly against country__text. On selection, both context nodes country and country__text are getting filled automatically.

      Developers can define dictionary simple types for which they then fill the enumerations statically in the Simple Type Editor (on the Enumeration tab page) or programmatically. This procedure conforms to standard WD practices.

The diagram shows the value help relationships in the Mobile Service and UI Components with the attributes from the example above:

This graphic is explained in the accompanying text

Prerequisites

·        You have created a Mobile Service Component containing two client data objects:

       Client data object A has a node attribute <A.key>. This node attribute is to be filled automatically with values coming from a second attribute.

Example: Client data object CUSTOMER with node attribute COUNTRY_KEY

       Data object B has at least two nodes, <B.key> and <B.value>. The value help will later show a list of <B.value> entries. On selection, the corresponding <B.key> of the selected value is piped into data object node <A.key>.

Example: Client data object COUNTRY with node attributes COUNTRY_KEY and COUNTRY_TEXT.

·        You have created a Mobile UI Component with the following properties:

       A dependency towards the Mobile Service Component

       A WD model of type Mobile Service Component Model containing model classes for both data objects

       A WD component containing at least one view

Procedure

...

       1.      In the Service Explorer, open client data object A (Example: CUSTOMER) and open the Attributes tab page of the Editor.

       2.      Select attribute <A.key>, such as COUNTRY_KEY for the country code and edit the Value Help.

       3.      In the dialog box, select a data object attribute as value help key, here <B.key>, in our example, node attribute COUNTRY_CODE of client data object COUNTRY, and choose Next.

       4.      Select a data object attribute as the display value, here <B.value>, in our example, node attribute COUNTRY_TEXT of client data object COUNTRY, and choose Finish.

       5.      Create a new WD model of type Mobile Service Component Model.

More information: Creating a Web Dynpro Model

       6.      Reimport the WD model in the Handhelds UI Explorer by right-clicking on the WD model instance, and choose Reimport Model.

       7.      In the dialog box, choose node attributes for COUNTRY and COUNTRY___TEXT of model class CUSTOMER.

 This creates a new context node in the view controller context through model binding.

       8.      In the view layout, open the palette for selection and drop a DropDownByKey onto the view layout.

       9.      In the control properties, bind the property value against context node attribute COUNTRY___TEXT.

Result

In the example, on selection of a value in the dropdown box (in the developed application running on the Mobile Client for Handhelds), context nodes COUNTRY and COUNTRY___TEXT will be filled automatically with the correct values.

 

End of Content Area