Skip to Content

Create a Customer List Page in an MDK App

test
0 %
Create a Customer List Page in an MDK App
Details

Create a Customer List Page in an MDK App

September 10, 2020
Created by
April 23, 2019
Use the mobile development kit page editor to create a new page for displaying a customer list.

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


To enhance your MDK app with customer list information, you need to carry out the following tasks:

  • Create a new customer list page
  • Add Contact Cell Table control to the page
  • Create a new navigation action to the customer list page
  • Add a new button on main page and navigate to customer list page when user clicks it
  • Deploy app metadata to SAP Cloud Platform Mobile Services
  • Update the app with new changes
MDK
Step 1: Create a new page for displaying customer list

This page is a searchable list that displays all customers.

To create the Customer List page, you will create a Section page and drag the Customer Contact Cell Table control onto the page. In the property palette, you will link the control to the Customer Collection and then map data and actions to different areas of the cell object in the property palette. One nice feature about the Contact Cell Table control is that it has icons that can activate device functionality such as phone, email, video and more.

  1. In SAP Business Application Studio project, right-click the Pages | MDK: New Page.

    MDK
  2. Select | Section Page and click Next.

    MDK

    You can find more details about section page.

  3. Enter the Page Name Customers_List and click Next and the Finish on the confirmation step.

    MDK
  4. In the Properties pane, set the Caption to Customers.

    MDK
  5. In the Layout Editor, expand the Controls | Compound section, drag and drop the Contact Cell Table control onto the Page area.

    MDK

    A Compound control contains a group of other controls. Unlike in a container control where you can add your own child controls (container items), the child controls in a compound control are fixed. You can populate each of its child control by defining its data binding, depending on which the child controls are created.

  6. In the Properties pane, select the previously added service from the Service drop down and then select Customers Entity Set from the dropdown. This way, the Object Table has been bound to Customers Entity.

    MDK
  7. In the Properties pane, click the link icon to open the Object Browser for the Description property. Double click the City property of the Customer entity to set it as the binding expression and click OK.

    MDK

    Be careful not to select City from Address (ESPM.Address).

    MDK
  8. Repeat the above steps for Headline and Subheadline properties binding to FirstName and LastName properties of the Customer entity respectively.

    You should have final results as below.

    MDK
  9. In the Search section of the Properties pane, change both the Search Enabled property and Barcode Scanner property to true.

    MDK
  10. In the Activity Items section of the Properties pane, change VideoCall on the first activity to Phone.

    MDK
  11. Click the link icon to open the Object browser for the Phone activity and bind it to the PhoneNumber property of the Customer entity.

    MDK
  12. Repeat the above step for Email activity and bind it to EmailAddress property of the Customer entity.

    MDK
  13. Click the trash can icon for the Detail activity to remove it from the Activity list.

    MDK
Which folder of the Mobile Development Kit (MDK) project contains the views of your application?
×
Step 2: Create navigation action

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

  1. In SAP Business Application Studio project, right-click the Actions | MDK: New Action.

    MDK
  2. Choose MDK UI Actions in Category | click Navigation Action | Next.

    MDK
  3. Provide the below information:

    Field Value
    Action Name NavToCustomers_List
    PageToOpen Select Customers_List.page from the dropdown
    MDK
  4. Click Next and then Finish on the confirmation step.

Log on to answer question
Step 3: Add a button to view customer list

Now, that the Customer List page is created, you will add a button to the Main page to display the Customers. You will use a Section Button Table control.

  1. In Main_page, drag and drop the Section Button Table container control onto the Page.

    MDK

    Container includes controls that act as containers for other controls, such as container items. A container is constant for all pages. The size of a container depends on the controls and contents included inside.

  2. Expand the Container Item section of the Controls palette.

    Drag and drop a Section Button onto the Section Button Table container on the page.

    MDK

    Each container type in a Section Page can contain specific controls (container items).

    You can find more details about Container and Container Item.

  3. In the Properties pane, set the Title of the button to Customer List.

    MDK
  4. Under Events tab, click the link icon for the OnPress Handler property to open the Object Browser. Double click the NavToCustomers_List action and click OK to set it as the OnPress Handler Action.

    MDK
Log on to answer question
Step 4: Deploy and activate the application

Deploy the updated application to your MDK client.

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

MDK

You should see Deploy Succeeded message.

MDK
What options do you see while creating a new page?
×
Step 5: Test the application

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

  1. Re-launch the app on your device, you may asked to authenticate with passcode or Fingerprint. You will see a Confirmation pop-up, tap OK.

    MDK
  2. You will notice, newly added button on the main page. Tap CUSTOMER LIST.

    MDK

    Here, you will see list of all the Customers. You can search a record by by First Name or Last Name or City. Controls are rendered natively on device, you can email to the customer, make a phone call etc.

    MDK
  1. Re-launch the app on your device, you may asked to authenticate with passcode or Touch ID. You will see a Confirmation pop-up, tap OK.

    MDK
  2. You will notice, newly added button on the main page. Tap Customer List.

    MDK

    Here, you will see list of all the Customers. You can search a record by by First Name or Last Name or City. Controls are rendered natively on device, you can email to the customer, make a phone call etc.

    MDK

    Here, you may notice that City is not showing up on screen, this is by design. Since in portrait mode, the device width is considered compact , if you change device orientation to landscape mode, you will see City.

    MDK

    If it was an iPad (where both portrait and landscape are considered regular instead of compact) you would see City on either orientation.

Congratulations! You have successfully created a Customer List page and you are now all set to Create a Customer Detail Page.

Log on to answer question

Next Steps

Back to top