Create a Customer Detail Page in an MDK App
- How to create a new page and add some controls to display customer information
- How to navigate from one page to another page
To enhance your MDK app with customer details information, you need to carry out the following tasks:
- Create a new customer details page
- Add some controls to the page to display information like id, name, email, phone, address
- Create a new navigation action to the customer details page
- Navigate from customer list page to details page
- Deploy the app metadata to SAP Mobile Services & Cloud Foundry
- Update the app with new changes
- Step 1
This page will show related details for a customer. In this page, you will add an Object Header control that is used to display information (like first name, last name, date of birth, email address & phone number) about the header of an object and Static Key Value control to display key value pair items like address, city, postal code & country.
In SAP Business Application Studio project, Right-click the Pages folder | MDK: New Page | Section Page | Next.
Enter the Page Name
Customers_Detailand click Next and the Finish on the Confirmation step.
In the Properties pane set the Caption to Customer Detail.
Next, you will add an Object Header container to display information like first name, last name, date of birth, email address & phone number.
In the Layout Editor, expand the Controls | Static Container group, drag and drop the Object Header control onto the page area.
Now, you will replace the default values of the control’s properties with the values from customer entity.
In the Properties pane, click the link icon to open the Object Browser for the
Double click the
DateOfBirthproperty of the Customer entity to set it as the binding expression and click OK.
Repeat the above steps binding below Properties:
DetailImageproperty is referencing SAP font icon.
Make sure to select values for the mentioned properties only from Customer Entity. You may find similar values from other entities. For example,
As enough fields have been selected to be displayed on the detail page,
Tagsare not required for this tutorial. In a real use case, you may need these properties.
Remove the default value for
Also, delete items under
Page should look like below.
In the main area of the page, let’s display some other details like; address, city, postal code, county.
Drag and drop a Static Key Value container onto the page under the Object Header.
Expand the Static Items section of the Controls palette and drag and drop a Key Value Item onto the Static Key Value container on the page.
Repeat the process and drag three more Key Value Items onto the Static Key Value section so you have a total of four when you are done.
Select the upper left Key Value Item and set the
For this tutorial, you will set the value as a combined binding of house number and street. You can find more details about Target Path.
Start with first part of the binding for Address property.
Click the link icon next to the Value field to display the Object Browser and double click
HouseNumberto set it as the first part of the binding. Don’t click OK as you will set second part of the binding too.
Be careful not to select
Address (ESPM.Address), final expression should be as per above animation.
Now, set second part of the binding.
The cursor will be at the end of binding in the Expression field. Add a space and then select Street property and click Insert.
Click OK to set the binding.
Be careful not to double click Street as that will replace the existing expression with just the Street property.
Street should be selected from Customer entity.
Repeat the process and set the upper right Key Value Item
KeyNameto City and bind the value to the
Repeat the process and set the lower left Key Value Item
KeyNameto Postal Code and bind the value to the
Repeat the process and set the lower right Key Value Item
KeyNameto Country and bind the value to the
Be careful not to select City, Postal Code & City from Customer.Address (ESPM.Address) collection.
The page design should look like as below screenshot.
- Step 2
Now, you will create a Navigation action that opens the
In SAP Business Application Studio project, right-click the Actions folder | MDK: New Action | choose MDK UI Actions in Category | click Navigation Action | Next.
Provide the below information, click Next and then Finish on the confirmation step.
Customers_Detail.pagefrom the dropdown
- Step 3
Customers_List.page, you will set the
OnPressevent of the Contact Cell table control. You will link the Contact Cell table control to the
NavToCustomers_Detail.actionso that when an end-user selects a customer, the Customer Detail page will open. MDK automatically passes the selected customer to the detail page.
Customers_List page, select the Contact Cell Table control, click the 3 dots icon under the Events tab for the
OnPressproperty to click the Object Browser.
Double click the
NavToCustomers_Detail.actionand click OK to set it as the
- Step 4
Deploy the updated application to your MDK client.
Application.appand select MDK: Deploy.
Select deploy target as Mobile & Cloud.
You should see success message for both deployments.
Alternatively, you can select MDK: Redeploy in the command palette (View menu>Find Command OR press Command+Shift+p on Mac OR press Ctrl+Shift+P on Windows machine), it will perform the last deployment.
- Step 5
Make sure you are choosing the right device platform tab above.
What is the value set for DetailImage property in Customers_Detail.page?