Building Queries in Netweaver Mobile 7.1 – Laptop Perspective
The Mobile Applications for Laptop perspective provides a single point of entry to mobile projects through the Laptop UI explorer unlike the Mobile Applications for Handheld perspective which provides three dedicated explorers, reflecting the three types of mobile components: Service Explorer, Handhelds UI Explorer and Application Explorer. However, we will develop our application by creating independent Development Components (DC), one for holding the Model and the other for User Interfaces.
We will create a service DC which will have a query to get the Notification Details of Maintenance Notifications (Type ‘M1′) from the Local Instance of the Database.
- SWCV NOTIF_EQUIP_SWCV is created with the Data Objects EQUIP_DO and NOTIF_DO.
- Necessary connection parameters are provided in the Netweaver Developer Studio
Create a DC servicecomp and follow the steps below:
- Expand WebDynpro in the servicecomp DC. Now, Right Click on the Model and create the ServiceModel Model and select the SWCV NOTIF_EQUIP_SWCV and import both the Data Object Objects EQUIP_DO and NOTIF_DO.
- Expand ServiceModel. Right-Click Model Classes and select Create Query / Composite Model Class. Our query will return with a set of values as a QueryResult. To get values in QueryResult we need to give a QueryInput.
- To create a QueryInput, right click the Create Query / Composite Model Class and name the QueryInput as QueryNotificationInput. Specify the attributes for the QueryInput. Click on the add button to specify from which model node we need to add the attribute(s). Here, in our scenario, we will use the NOTIF_DO_NOTIF_HEADER-NOTIF_TYPE.
- After creating the QueryInput, we will now create a QueryResult, QueryNotificationOutput, by Right clicking the Create Query / Composite Model Class. Click on the query tab and in the “Query Details” section we need to specify the Result model class (this will give the result). If we need to fetch all the details from NOTIF_DO_NOTIF_HEADER we can specify the DoNode itself. If required, we can also specify the attributes for the QueryResult.
- After specifying the Result Model Class we need to specify the Input Model Class. If we specify the Input model class, the query result will be based on this; otherwise entire data will be fetched from the NOTIF_DO_NOTIF_HEADER.
- Now we need give the conditions for getting the result. For this, in the conditions section, we need to give the filter criteria and condition :
In the left side of the operator we need to specify the node and the attribute. In the right side of the operator we need to specify the attribute (this is from the QueryInput). The actual value ‘M1’ of the Notification Type can be set in the DC which is consuming this DC.
- We can sort the QueryResult by specifying in the ‘Sort Conditions’ editor. We will now sort the QueryResult by Ascending order of Notification Number and Notification Date.
- Build the servicecomp DC
We can consume this DC in other DCs by Adding the ServiceModel to the public part.