Show TOC Entering content frame

Procedure documentation Creating a Business Object Relationship  Locate the document in its SAP Library structure

Use

You can use this procedure to create a dependency between two business objects (BOs). The relationship allows one BO (source) to access data from the other BO (target).

Note

You must create the relationship at the source BO level. You can create multiple relationships for a source BO with multiple target BOs. However, you must repeat this procedure for creating multiple relationships.

Prerequisites

You have:

·        Identified the source and target BOs for which you want to create a relationship.

·        Modeled an additional BDoc segment for the target BO, if you want to create one-to-many relationship between the BOs.

Note

The BDoc segment that is associated already with the target BO retrieves records with complete details, as defined by the target BO. In some situations, however, you do not want to access records with complete details through the relationship you create. Therefore, we recommend that you model an additional BDoc segment for the target BO to retrieve records with limited details as per your requirement.

Procedure

...

       1.      In Solution Explorer, click the source business object with the secondary mouse button and choose View Relationship.

The Relationship Designer appears with a relationship grid and a figure indicating a relationship for the source BO. This figure updates automatically when you specify values for the relationship in the subsequent steps.

       2.      In the relationship grid, click the secondary mouse button and choose New.

The Properties window displays all attributes of the relationship. The relationship grid displays the important attributes of the relationship. 

       3.      Enter data as required for the relationship.

Note

Use the table below to determine the type of data you need to enter for the relationship attributes.

 Attribute

Purpose

Data

Name

Indicates the name of the relationship

A meaningful name

Description

Describes the purpose of creating the relationship

Short text

Associate parameters

Associates BDoc parameters with the necessary properties of source and target BOs

BDoc Parameter of source BO - BDoc parameter associated with the primary key of the source BO

Property of source BO - The %PARENTKEY% parameter that represents the primary key of the source BO

BDoc parameter of target BO – The %PARENTKEY% parameter that represents the BDoc parameter modeled for the foreign key of the target BO

Property of the target BO – Property that refers to the foreign key of the target BO

Share Record set

(Applicable only if the relationship type is ParentChild)

Determines whether or not the system must reuse an existing  business collection (when possible) to optimize the task of retrieving records through the relationship

True or False

Strong binding

Determines whether or not storing records in the memory is required

SourceStronglyBound - System stores the source BO records, which are retrieved using the relationship, in the memory. These records are reused when the source BO is accessed subsequently.

TargetStronglyBound - System stores the target BO records, which are retrieved using the relationship, in the memory. These records are reused when the target BO is accessed subsequently.

None – System does not store the source BO or target BO records, which are retrieved using the relationship, in the memory. In this case, the corresponding BDoc retrieves the records from the user database when the source BO or target BO is accessed subsequently.

Target optional (Applicable only if the relationship type is ParentChild)

Allows you to determine whether or not a parent record must contain child records

True or False

Cascade delete

Determines whether or not the relationship must exist if a BO in a relationship is deleted

DeleteTargetIfSourceDeleted or DeleteSourceIfTargetDeleted or None

Relationship type

Defines dependencies between the source and target BOs during deletion.

ParentChild or Normal

Cardinality

Determines whether the relationship is one-to-one or one-to-many       

Single (one-to-one relationship)

Multiple (one-to-many relationship)

If you select this value, you must enter the BDoc and segment values that you have modeled additionally for the target BO.

Join field Mappings

Overrides the segment field names of target BO properties if the segment field names do not match with the corresponding segment field names of the BDoc segment  

If there is no mismatch between the segment field names, select None.

If there is a mismatch between segment field names, then specify the join field mappings. To do this, click the button available in the field. For more information, see Overriding Segment Fields.   

       4.      Choose Save.

Example

A business partner can have multiple contact persons. In the standard mobile client application, the business objects such as BOCONGEN and BOACTCONTACT are modeled to define business partners and contact persons respectively. If you want to access all contact persons specific to a business partner, then you must model a relationship between the corresponding BOs.

 

Leaving content frame