Creating Relationships Between Mobile Business Objects

Use the New Relationship wizard to create relationships between two or more mobile business objects.

Prerequisites

At least two mobile business objects and at least one attribute must be defined for either mobile business object before you can create a relationship between them (also called an MBO graph, object graph, or composite object graph for composite relationships). You can also create relationships between MBOs through load arguments.

Task

Use relationships to associate related data between MBOs and maintain data synchronization on the mobile application.

  1. Launch the New Relationship wizard from the Mobile Application Diagram by selecting the Relationship icon from the palette, then make a connection between two mobile business objects by clicking in the name or attribute section of one mobile business object (parent/source), and then dragging the line to the other (child/target).
    You cannot create relationships between local business objects and MBOs bound to a data source.
  2. Follow the wizard instructions to define a relationship between the mobile business objects. Include:
    • Source object – read-only and automatically filled in. Enter the source object Attribute name, which identifies the name of the source of the relationship, and is independent of any MBO attribute.
    • Target object – select a target of the relationship from the drop-down list. Enter the target object Attribute name, which identifies the name of the target of the relationship, and is independent of any MBO attribute.
    • Comment – (Optional)
    • Relationship type – either:
      • One to many – the source for this relationship is one-to-many (default). For example, one manager manages multiple employees.

        oneToManyRelationship

      • One to one – a one-to-one relationship between the target and the source. For example, a manager manages only one department.

        onetoOneRelationship

      • Many to one – the source of this relationship is many-to-one. For example, many employees work in one department.

        manyToOneRelationship

    • Bi-directional – indicates a two-way relationship. That is, changes can be propagated in either direction.

      biDirectionalRelationship

    • Composite – create, update and delete operations on a parent MBO automatically cascades changes to the child entity. For example, deleting the parent Customer MBO cascades directly to the child MBO Sales Order. This option is disabled for many-to-one relationships.
  3. Create the mappings from the source mobile business object to the target by selecting a source object attribute, load argument, or structured load argument and dragging it to the corresponding target to which you want to map. Structured load argument relationships are not true relationships, but allows mapping of structures. SAP Mobile WorkSpace also supports attribute-to-load argument, load argument-to-attribute, and load argument-to-load argument mappings.
  4. Click OK when finished.
    Relationships are identified in the Mobile Application Diagram by a line connecting the related MBOs, with a different type of arrow for each type of relationship (one-to-one, one-to-many, or many-to-one).

One to many, unidirectional, composite

This example illustrates a relationship between the Order MBO and Item MBO:
  • One to many – a single order can contain many items. The orderId identifies the order, and the Item includes the orderId attribute, whose value identifies the order to which it belongs.
  • Composite – changes to the order are propagated to the Item MBO. For example, a new item is added to the order.
  • Unidirectional – updates flow from Order to Item only.

uniDirectionalRelationship
Related information
Composite Operations
Defining Output Mappings