Start of Content Area

Procedure documentation Adding a Second Data Service  Locate the document in its SAP Library structure

Use

In this example, you add a second data service to the model, create a dynamic expression and lay out the model.

Prerequisites

You have created the model in Creating the Base Model and it is open in Storyboard.

Procedure

...

       1.      Add a second data service to the model:

                            a.      With the model open in the Design board, click the Find Data button in the task-panel toolbar and drag BAPI_SALESORDER_GETSTATUS onto the workspace.

                            b.      In the Define Data Service dialog box, add the STATUSINFO output port.

                            c.      You can test the functionality of the Salesorder Getstatus data service (selecting Test Data Service from the right-click context menu) using 0000005650 as input to the Salesdocument field.

       2.      Define the input to the second data service:

                            a.      To enable the user to select a document and get all of its details, the table created in the first example (Sales Orders Grid) must serve as input to the second data service: Salesorder Getstatus. Therefore, connect the out port of the table to the Input port of Salesorder Getstatus.

                            b.      If not already displayed, open the Configure Element task panel and click the select line to the Input port of Salesorder Getlist. As you can see in the table at the bottom of the task panel, the SALESDOCUMENT field of the Salesorder Getstatus data service must receive data from the table. To map the data, assign @SD_DOCto the SALESDOCUMENT field, by clicking in the Assigned Value column and choosing it from the drop-down menu (you will need to scroll down in the menu).

       3.      Define the output from the second data service:

                            a.      In order to view the details of the selected document, the output can be displayed in a second table. First, drag out from the Statusinfo out port on Salesorder Getstatus, release and from the context menu, choose Add Table View. The Select Display Fields dialog box is displayed.

                            b.      Select the following fields to be displayed in the table: CURRENCY, MATERIAL, NET_PRICE and REQ_QTY. These are the details of the selected sales order. Click OK.

                            c.      Save the model. It should now look similar to the following:

This graphic is explained in the accompanying text

                            d.      Add a field with a dynamic expression:
This section explains how to add a “virtual field” to the second table (StatusInfo Grid), in order to dynamically describe the order size of the selected material.

                                                  i.       On the Design board, double-click StatusInfo Grid. The Configure Element task panel is displayed, showing the properties of the table itself and listing the columns displayed in the table.

                                                ii.       Under the table at the bottom, click the Add (plus) button. The New UI Control dialog box is displayed.

                                               iii.       From the Select control type list, choose Expression Box. In the Field name field, type Order_Size (you can leave Text as the Data type) and click OK. Note that the Order_Size field is added to the list. The blue text indicates that the field is editable.

                                               iv.       Double-click the Order_Size row in the table to display the Control Properties dialog box.

                                                 v.       Click the General tab and to the right of the Expression  field at the bottom, click Formula. The Computed Value dialog box is displayed, to enable you to create your formula for the computed field.

                                               vi.       In the list of functions in the right pane, expand the Conditional Functions group and double-click the IF option. The following expression is displayed in the left pane:

IF(test,expr1,expr2)

                                              vii.       In the left pane, edit the formula as follows:

IF(@REQ_QTY*@NET_PRICE>100000,@REQ_QTY*@NET_PRICE,'Small')

This graphic is explained in the accompanying text

When creating your formula, you can expand the Data Fields option in the right pane and select the field names from the list, in order to assist you in data entry.

This graphic is explained in the accompanying text

This formula indicates that if the value of the order – requested quantity (REQ_QTY) multiplied by net price (NET_PRICE) – is greater than 100,000, the exact value will be displayed in the table. Otherwise (if the resulting value is less than 100,000) the word Small will be displayed in the list rather than the actual amount.

                                            viii.       Click Check to ensure that the formula is valid. The following message should be displayed: Formula is valid.

                                              ix.       Click OK. The formula you created is displayed in the Expression  field.

                                                x.       Click Close to enter the dynamic expression in the Order_Size field of the table.

                                              xi.       Save the model.

       4.      Rearrange the iView layout by clicking the Layout tab and clicking the Configure button in the task-panel toolbar (if not already selected).

                            a.      Organize the iView as needed. The first table (Sales Orders Grid) should be below the Input Form. The second table (Statusinfo Grid) should be at the top right of the layout.

                            b.      Click the edge of the Input Form, and do the following:

                                                  i.       To accommodate the long text labels of the fields, from the Align contents drop-down list in the Configure Element task panel, choose Vertical. All of the form’s fields and controls are lined up vertically.

                                                ii.       From the Place labels drop-down list, choose Above. Labels are placed above the fields. Adjust the height of the form accordingly to accommodate all fields and controls.

                                               iii.       From the Size frame drop-down list, choose Fit. This ensures that the form shrinks or expands at runtime so that it tightly fits around the fields and controls.

                            c.      Change the Customer Number label as follows:

                                                  i.       Select the field, right-click it, and from the context menu, choose Properties. The Control Properties dialog box is displayed.

                                                ii.       Click the Display tab. In the Label field, change the label to “Customer No.“.

                                               iii.       Click Close.

                            d.      Rename the tables as follows:

                                                  i.       Click the edge of the Sales Orders Grid (below the Input Form) and in the Table title field at the top of the Configure Element task panel, select the text Sales Orders Grid and overwrite it with Salesorders.

                                                ii.       Click the Statusinfo Grid (at the top right) and rename it Details.

                            e.      Save the model. It should look similar to the following:

This graphic is explained in the accompanying text

       5.      Deploy the model by clicking the Deploy Model ( This graphic is explained in the accompanying text ) button in the toolbar. The model is compiled and deployed to the portal to which you are connected.

Result

Your runtime model should look similar to the following:

This graphic is explained in the accompanying text

 

End of Content Area