Skip to Content

Use OData Annotations to Add CRUD Functionality to an MDK App

Generate a fully functional CRUD cross-platform application based on OData annotations.
You will learn
  • How MDK editor parses OData Annotations for a given OData service
  • How to create a fully functional cross-platform application
jitendrakansalJitendra KansalOctober 26, 2025
Created by
jitendrakansal
October 4, 2022
Contributors
maximilianone
jitendrakansal

Prerequisites

You may clone an existing metadata project from the MDK Tutorial GitHub repository and start directly with step 5 in this tutorial but make sure you complete step 2.

Mobile Development Kit brings OData annotations capabilities to your cross-platform applications. MDK editor supports generating List-Detail pages based on annotations. List-Detail pages are similar to a Master-Detail page, but it is two pages instead of one. The MDK editor parses existing annotations to give you a huge leap forward in your cross-platform applications.

MDK
  • Step 1

    SAP Fiori Elements is a framework comprising of templates for commonly used application patterns, for example List Report, Worklist, Object Page, Overview Page and Analytical list page. Predefined templates combined with OData service and annotations generates SAP Fiori application at startup.

  • Step 2

    Sample backend in SAP Mobile Services provides annotation functionality for Products.

    1. In SAP MDK Demo App configuration, click Sample OData ESPM.

      MDK
    2. Select Include Predefined Annotations option and click Save. This will add Product annotation to the sample backend destination.

      MDK
  • Step 3

    This step includes creating a mobile project in SAP Build Lobby.

    1. In the SAP Build Lobby, click Create > Create to start the creation process.

      MDK
    2. Click the Application tile and choose Next.

      MDK
    3. Select the Mobile category and choose Next.

      MDK
    4. Select the Mobile Application to develop your mobile project in SAP Business Application Studio and choose Next.

      MDK
    5. Enter the project name mdk_annotations (used for this tutorial) , add a description (optional), and click Review.

      MDK

      SAP Build recommends the dev space it deems most suitable, and it will automatically create a new one for you if you don’t already have one. If you have other dev spaces of the Mobile Application type, you can select between them. If you want to create a different dev space, go to the Dev Space Manager. See Working in the Dev Space Manager.

    6. Review the inputs under the Summary tab. If everything looks correct, click Create to proceed with creating your project.

      MDK
    7. Your project is being created in the Project table of the lobby. The creation of the project may take a few moments.

      MDK
    8. After you see a message stating that the project has been created successfully, click the project to open it. The project opens in SAP Business Application Studio.

      MDK

      When you open the SAP Business Application Studio for the first time, a consent window may appear asking for permission to track your usage. Please review and provide your consent accordingly before proceeding.

      MDK

  • Step 4

    The Storyboard provides a graphical view of the application’s runtime resources, external resources, UI of the application, and the connections between them. This allows for a quick understanding of the application’s structure and components.

    • Runtime Resources: In the Runtime Resources section, you can see the mobile services application and mobile destination used in the project, with a dotted-line connected to the External Resources.
    • External Resources: In the External Resources section, you can see the external services used in the project, with a dotted-line connection to the Runtime Resource or the UI app.
    • UI Application: In the UI Applications section, you can see the mobile applications.
    1. Click on + button in the Runtime Resources column to add a mobile services app to your project.

      MDK

      This screen will only show up when your CF login session has expired. Use either Credentials OR SSO Passcode option for authentication. After successful signed in to Cloud Foundry, select your Cloud Foundry Organization and Space where you have set up the initial configuration for your MDK app and click Apply.

      MDK
    2. Choose myapp.mdk.demo from the applications list in the Mobile Application Services editor.

      MDK
    3. Select com.sap.edm.sampleservice.v4 from the destinations list and click Add App to Project.

      MDK

      You can access the mobile services admin UI by clicking on the Mobile Services option on the right hand side.

      In the storyboard window, the app and mobile destination will be added under the Runtime Resources column. The mobile destination will also be added under the External Resources with a dotted-line connection to the Runtime Resource. The External Resource will be used to create the UI application.

      MDK
    4. Click the + button in the UI application column header to add mobile UI for your project.

      MDK
    5. In the Basic Information step, provide the below information and click Next. You will modify the generated project in next step and will deploy it later.

      Field Value
      MDK Template Type Base
      Enable Auto-Deployment to Mobile Services After Project Creation Select No
      MDK

      The Base template creates the offline or online actions, rules, messages and an empty page (Main.page). After using this template, you can focus on creating your pages, other actions, and rules needed for your application. More details on MDK template is available in help documentation.

    6. In the Data Collections step, provide the below information and click Finish. Data Collections step retrieves the entity sets information for the selected destination.

      Field Value
      Enter a path to service (e.g. /sap/opu/odata/sap/SERVICE_NAME) Leave it as it is
      Select the Service Type Leave the default value as OData
      Enable Offline Select No
      MDK

      Regardless of whether you are creating an online or offline application, this step is needed for app to connect to an OData service. When building an MDK Mobile application, it assumes the OData service created and the destination that points to this service is set up in Mobile Services.

      Data Collections step retrieves the entity sets information for the selected destination.

    7. After clicking Finish, the storyboard is updated displaying the UI component. The MDK project is generated in the project explorer based on your selections.

      MDK

    Which page is not part of generated pages in Products folder?

  • Step 5
    1. Right-click Application.app and select MDK:New Annotation Component.

      MDK
    2. In the Annotation Selection step, MDK editor fetches annotation details. Select Product Annotation and click Next.

      MDK
    3. In Template Customization step, select CRUD Template and click Finish.

      MDK

      In MDK project, you will see new pages, actions, and rules have been generated for Products.

      MDK

      You will also notice a button control has been generated on the Main.page to navigate to Product_List.page.

      Pages, actions and rules created are a starting point. You can edit those pages and make it your own. At this point the MDK editor is no longer reading the annotations from OData.

      If the OData designer updates the backend services data schema (annotations), the MDK pages will stay as originally created. It will not automatically update the pages or overwrite your changes. You are disconnected from the annotations at this point.

  • Step 6

    So far, you have learned how to build an MDK application in the SAP Business Application Studio editor. Now, you will Deploy the Project definitions to Mobile Services to run it in the Mobile client.

    1. Open the Application.app file, click the Deploy option in the editor’s header area, and then choose the deployment target as Mobile Services.

      MDK
    2. Select deploy target as Mobile Services.

      MDK

      If you want to enable source for debugging the deployed bundle, then choose Yes.

      MDK

      You should see Deploy to Mobile Services successfully! message.

      MDK

    What Entity Type was listed while adding a new MDK Annotation Component?

  • Step 7

    SAP Business Application Studio includes a feature that displays a QR code for onboarding in the mobile client. To view the onboarding QR code, click the Application QR Code icon in the editor’s header area.

    MDK

    The On-boarding QR code is now displayed.

    MDK

    Leave the Onboarding dialog box open for the next step.

  • Step 8

Back to top