SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Implement Create Entity and Linking Entities in an MDK App

Create relationship between two OData entities.

Overview

You will learn

  • How to create relationship between parent and child entities
  • How to create a child entity to an existing parent entity
  • How to create a parent entity first and then a child entity
  • How to implement dynamic data subscription
Jitendra Kansal J Jitendra Kansal August 21, 2026
Created on October 4, 2022
Contributors

More from Jitendra Kansal

See all 34 tutorials by Jitendra Kansal →

Prerequisites

Steps

Intro

You may clone an existing metadata project from the MDK Tutorial GitHub repository to start with this tutorial.


For this tutorial, you will use Mobile Services sample backend (step 3) which has parent-child relationship setup among entities. For example, A customer can have n (>=0) number of sales orders.

To create an entity and then link it to another entity, you need to carry out the following tasks:

  • Create a new page for creating an order
  • Add an action bar item to the new page for cancelling the current activity
  • Create a new CreateRelatedEntity OData action to create a new sales order
  • Create a new message action for displaying failure message if order creation fails
  • Create a navigation action to show order creation page from Customer detail page
  • Implement data subscription to update count value when a new sales order is created

Create Entity And Link Entities App Demo
Create Entity And Link Entities App Demo

Step 1 Create new page for new Sales order record

In this step, you will create a Section page with a Form Cell Section to contain the Form Cell controls. You will then add the fields that will be editable by the end-user.

  1. Right-click the Pages folder | MDK: New Page | Section | Next.

    Pages Folder New Section Page Menu
    Pages Folder New Section Page Menu

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

    SalesOrderHeaders Create Page Base Information
    SalesOrderHeaders Create Page Base Information

  3. Once the page opens in the page editor, click on the white area to select it’s Action Bar, and set the Caption to Create Order.

    Action Bar Caption Set To Create Order
    Action Bar Caption Set To Create Order

  4. Now, you will add the fields (like Currency Code, Net Amount, Tax Amount, Gross Amount, Life cycle status, Life cycle status name and order creation date) for creating a new sales order record by the end-user. In the Layout Editor, expand the Static Container group. Drag and drop Form Cell section onto the Page area.

    Form Cell Section Dragged To Page Area
    Form Cell Section Dragged To Page Area

    Form Cell section is used to contain Form Cell controls in a section page.

  5. You will now add Form Cell controls in the Form Cell Section. Expand the Form Cell Controls group, drag and drop a Simple Property onto the Page area.

    Simple Property Control Added To Form Cell
    Simple Property Control Added To Form Cell

  6. Drag and drop five additional Simple Property controls and one Date Picker control onto the page so you have seven total controls.

    Seven Form Controls Added To Page
    Seven Form Controls Added To Page

  7. Select the first Simple Property control and provide the below information:

    PropertyValue
    NameFCCreateCurrencyCode
    CaptionCurrency Code
    ValueEUR

    Currency Code Simple Property Control Properties
    Currency Code Simple Property Control Properties

    Under Value property, you can set some default values.

  8. Select the second Simple Property control and provide the below information:

    PropertyValue
    NameFCCreateNetAmount
    CaptionNet Amount
    Value18.010

    Net Amount Simple Property Control Properties
    Net Amount Simple Property Control Properties

  9. Select the third Simple Property control and provide the below information:

    PropertyValue
    NameFCCreateTaxAmount
    CaptionTax Amount
    Value108.010

    Tax Amount Simple Property Control Properties
    Tax Amount Simple Property Control Properties

  10. Select the forth Simple Property control and provide the below information:

    PropertyValue
    NameFCCreateGrossAmount
    CaptionGross Amount
    Value126.02

    Gross Amount Simple Property Control Properties
    Gross Amount Simple Property Control Properties

  11. Select the fifth Simple Property control and provide the below information:

    PropertyValue
    NameFCCreateLifeCycleStatus
    CaptionLifecycle Status
    ValueN

    Lifecycle Status Simple Property Control Properties
    Lifecycle Status Simple Property Control Properties

  12. Select the sixth Simple Property control and provide the below information:

    PropertyValue
    NameFCCreateLifeCycleStatusName
    CaptionLifecycle Status Name
    ValueNew

    Lifecycle Status Name Simple Property Control
    Lifecycle Status Name Simple Property Control

  13. Select the last control Date Picker and provide the below information:

    PropertyValue
    NameFCCreatedate
    CaptionCreation Date
    ModeSelect Datetime from the dropdown if not selected by default

    Creation Date Date Picker Control Properties
    Creation Date Date Picker Control Properties

Step 2 Add cancel button on create Sales Order page
+
Step 3 Store the created data locally
+
Step 4 Navigate to the Customer Create page
+
Step 5 Add data subscription to Customer detail page
+
Step 6 Deploy the Project
+
Step 7 Run the Project
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 7
1. Create new page for new Sales order record 2. Add cancel button on create Sales Order page 3. Store the created data locally 4. Navigate to the Customer Create page 5. Add data subscription to Customer detail page 6. Deploy the Project 7. Run the Project