This section describes how to create a base model that displays details for a specified buyer. It covers how to:
Create the model
Search for a data service
Define the logic and flow of the application
Define the layout
Deploy and view the runtime application
Create the model:
Create a new Composite View named SalesOrderByBuyer in the tutorials development component that we created in the previous tutorial lesson. The Design board is displayed with a tab at the top left showing the model name.
Discover and define the first data service:
We are going to search in the Services Registry for the data service that we need. The Services Registry is a listing of Web services that is located centrally within a SOA landscape. It contains information about services provided in the landscape, with references to the services’ relevant WSDL metadata and to the locations of the callable service endpoints.
Note
Services that are published to the Services Registry are automatically available for use in Visual Composer Storyboard. However, the physical systems in which the services reside must still be defined as destinations in NetWeaver Administrator in order to be able to access them at runtime.
You define destinations for the physical systems using the same procedure that you used in the Before You Begin section of the first tutorial. More information: Creating the Base Model for Retrieving Product Information
Click the Search button in the task-panel toolbar. The Search task panel is displayed.
From the Search in dropdown list, choose Services Registry and click the Search… button. The Services Registry Wizard is displayed.
In the Find field, enter BusinessPartnerByID* and click Next. The WSDL PortType Name that we need – BusinessPartnerByIDQueryReponseIn – is displayed.
Click Next to display the endpoints defined for the service. The service we selected has a single endpoint with a single operation.
Click Finish to add the operation to the Search task panel.
Drag the operation onto the Design board. The Define Ports dialog box is displayed.
To select the input port and fields, in the left pane, highlight the BusinessPartnerByIDQuery node under In Ports. In this case, we only need one field as input - in the right pane, expand the BusinessPartnerSelectionByID complex field and select the checkbox next to the ID field. Note that the complex field is also selected automatically.
To select the output port and fields, perform the following under Out Ports:
Highlight the BusinessPartnerByIDResponse node and in the right pane, expand the BusinessPartner complex field. Select the following fields for output:
CompanyName (under the Organization complex field)
Firstname (under the Person complex field)
Lastname (under the Person complex field)
In the left pane, expand the BusinessPartnerByIDResponse node and select the checkbox of the BusinessPartner_Address node. All of the fields are selected by default. Clear the checkboxes of the following fields:
Building
Type
Click OK.
Save your model.
Define the input and output logic:
To define the input UI element for the model, drag out from the BusinessPartnerByIDQuery port and choose Form View from the context menu. The Define Data dialog box is displayed.
In the right pane of the dialog box, click the (Delete all controls defined for fields in the view) button and then click in the (Add/Remove Control) column to the left of the ID field to add a control to the form for that field.
Click Close. A new input form with an input field control for the ID field and a Submit button is added to Storyboard.
Note
Note that a data share connector is automatically connected to the form, because the dataset is clustered (complex). You can see that the dataset is clustered because the port on the data service is star-shaped. (Ports with flat (simple) datasets are square-shaped.) The data share connector holds a copy of the complex dataset. All the UI elements connected to the data share connector share the same data, so that the changes in the data on the UI elements are automatically reflected in the data share.
To define the output UI element, a form, drag out from the BusinessPartnerByIDResponse port and choose Form View from the context menu. The Define Data dialog box is displayed.
In the right pane of the dialog box, click the (Delete all controls defined for fields in the view) button and then click in the left-most column under (Add/Remove Control) to add controls to the form for the Companyname, Firstname, and Lastname fields. We need to do this because by default the complex fields are also selected, and we do not want to add controls for them to the form.
Click Close. A new output form with three input fields is added to Storyboard. Your model should look similar to this:
(Sales Order By Buyer Base Model)
Save your model.
Define the layout of the UI:
Click the Layout button at the bottom left of the workspace. The UI elements that you defined are displayed, showing a control for each field that you selected in the input and output forms.
To revise the UI of the S1 input form, right-click the form and choose Configure from the context menu. In the Configure Form View task panel, do the following:
In the Title field, change the form name to Define Buyer.
On the Layout board, rename the Id field Buyer ID. At runtime, this is the field in which the user specifies the ID of the buyer whose sales order information should be displayed.
Click the same field again and drag the right border to the left to shorten the field width.
Shorten the height of the form by clicking it and moving the bottom border up towards the Submit button.
Save your model. It should look similar to this:
(Sales Order By Buyer Original Layout)
To revise the UI of the output form, do the following:
Rename the form to Buyer Details.
Rename the fields of the form as follows:
Companyname |
Company |
Firstname |
First name |
Lastname |
Last name |
Add controls to display the address fields, as follows:
Change the layout of the form to have two columns: select the form and in the Configure task panel, specify 2 in the Columns field.
Drag a Plain Text control from the Compose task panel to the output form, into the top cell of the new (empty) column.
Drag four Input Field controls directly below the Plain Text control.
In the Configure task panel, assign fields to the new input field controls, as follows:
Select the first input field control, and from the dropdown list in the Value field, choose Define expression.
In the Dynamic Expression Editor dialog box, expand the Data Fields group, and then expand the BusinessPartnerByIDQueryResponseIn.BusinessPartnerByIDResponse node.
Expand the BusinessPartner_Address (Address) node, and double-click the Street field to add it to the expression pane.
Click Check to check that the expression syntax is valid and then click OK. Note that the label of the field on the Layout board is updated automatically.
Define fields for the remaining controls in the same way, using the City, PostalCode, and CountryCode fields respectively.
Rename the new fields as follows:
Text1 |
Address |
PostalCode |
Postal code |
CountryCode |
Country |
Make the Address text bold as follows:
Select the Plain Text control on the Layout board.
In the Configure task panel, click the browse button to the right of the Styles field. The Define Styles dialog box is displayed.
In the Font Style column, select Emphasized.
Keep the remaining default selections and click OK.
Shorten the height of the form by clicking it and moving the bottom border up towards the input field controls.
Save the model.
The Layout board should look similar to this:
(Sales Order By Buyer Revised Layout)
Deploy and view the model:
Deploy the model and run the application.
In the Buyer ID field, enter the value 15 and click Submit. The results should be similar to this:
(Runtime Application)
You have now created the base model. In the next section, Adding a Second Data Service and Preparing for Reuse, you will model another component that retrieves a list of sales orders for a specific buyer.