Skip to Content

Create a Customer Detail Page in an MDK App

Create a new page for displaying customer details in an MDK app.
You will learn
  • How to create a new page and add some controls to display customer information
  • How to navigate from one page to another page
jitendrakansalJitendra KansalJanuary 29, 2023
Created by
jitendrakansal
October 4, 2022
Contributors
maximilianone
jitendrakansal

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
MDK
  • 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.

    1. In SAP Business Application Studio project, Right-click the Pages folder | MDK: New Page | Section | Next.

      MDK
    2. In the Base Information step, enter the Page Name Customers_Detail and click Finish to complete the page creation process.

      MDK
    3. In the Properties pane set the Caption to Details.

      MDK
    4. 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.

      MDK
    5. 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 BodyText property.

      Double click the DateOfBirth property of the Customer entity to set it as the binding expression and click OK.

      MDK
    6. Repeat the above steps binding below Properties:

      Property Value
      Description {CustomerId}
      DetailImage sap-icon://customer
      FootNote{EmailAddress}
      HeadlineText{LastName}
      Status {PhoneNumber}
      Subhead {FirstName}
      Substatus Remove the default property

      DetailImage property is referencing to the 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,

      MDK

      Page should look like below.

      MDK
    7. 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.

      MDK
    8. 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.

      MDK
    9. 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.

      MDK
    10. Select the upper left Key Value Item and set the KeyName to Address.

      MDK
    11. 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 HouseNumber to set it as the first part of the binding. Don’t click OK as you will set second part of the binding too.

      MDK

      Be careful not to select HouseNumber from 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.

      MDK

      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.

    12. Repeat the process and set the upper right Key Value Item KeyName to City and bind the value to the City entity property.

    13. Repeat the process and set the lower left Key Value Item KeyName to Postal Code and bind the value to the PostalCode entity property.

    14. Repeat the process and set the lower right Key Value Item KeyName to Country and bind the value to the Country entity property.

      Be careful not to select City, Postal Code & City from Customer.Address (ESPM.Address) collection.

      The page design should look like as below screenshot.

      MDK
  • Step 2

    Now, you will create a Navigation action that opens the Customers_Detail.page when called.

    1. Navigate to Pages | Customers_List.page, select the Contact Cell Table control, navigate to the Events tab. Click the 3 dots icon for the OnPress property and select the Create a rule/action.

      MDK
    2. Keep the default selection for the Object Type as Action and Folders path.

      MDK
    3. Choose UI in Category | click Navigation | Next.

      MDK
    4. In the Base Information step, provide the below information and click Finish to complete the action creation process.

      Field Value
      NameNavToCustomers_Detail
      PageToOpen Select Customers_Detail.page from the dropdown
      MDK

      when an end-user selects a customer, the Customer Detail page will open. MDK automatically passes the selected customer to the detail page.

  • Step 3

    Deploy the updated application to your MDK client.

    1. Right-click Application.app and select MDK: Deploy.

      MDK
    2. Select deploy target as Mobile & Cloud.

      MDK

      You should see success message for both deployments.

      MDK

      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.

      MDK

  • Step 4

    Make sure you are choosing the right device platform tab above.

    Are you wondering how exactly MDK knew that clicking on a record in list page would display respective record in detail page?

    The MDK sets the current object to the selected record when running the on press action on the list. The detail page then just needs to reference the correct properties assuming they are part of the object from the list page. You can look at documentation for more details.


    What value was entered for DetailImage property of the Object Header control in Customers_Detail.page?

Back to top