We can use the example case of notification and equipments to illustrate the steps for creation of node associations .For this first we need to set up the SWCv’s and data objects as given in the below link.
http://www.sdn.sap.com/irj/scn/weblogs?blog=/cs/junior/view/wlg/16958
Once we have created the two data objects and activated it.We can create the association between the nodes of the data objects.
Our requirement now,is to associate the equipments with the equipments available in the notifications.
That is we have equipment master data object and the notification data object.th notification data object contains equipments also.
Our requirement is:
We should have equipment data from equipment data object in the device for the equipments(alone ) in the notification data object only.
ie if a equipment is present in the equipment master data object, and the equipment does not flow along with the notifcation, then this particular equipment from the equipment data object should not flow to the object,
ie we make the notifcation as leading object and equipments as following objects.(this we will make it clear while learning “dependency”)
Node Association: Node Association can be done for nodes of different data objects
Node association is done for associating two data objects by a particular field attribute. This node association can be used at data distribution stage to devices.
How to create Node Associations:
We are now going to create a node association between the notification data object and equipment data object.
For complete Node association there are some prerequisites:
- (Node association is done when the 2 data objects have the same field values (we should be able to equate the values in the two fields).
- The fields which need to be equated should be available in the two nodes. One field from either of the two nodes should be a backend key field
- For e.g. notif_header- equipment = equi_header- equipment.
For that first we select, notif_header node (in change mode), node association tab. The screen will look as follows:
When “Create Association” Button is clicked, a pop-up (association wizard) appears as shown above. Enter the details like
Association Name, Description, Data Object Name (data object to which the notif_header node does not belong to).In our case EQUIP_DO
The header node from the data object (Equipment data object contains EQUIPMENT field as the backend key field which in turn we are going to equate with the EQUIPMENT field of notif_header node.
The EQUIPMENT field (key filed of equi_header of EQUIP_DO and the corresponding sync key will be populated automatically. We need to select the equipment field from the notif_header node from search help.
Click on the “Generate Sync Key” Button. On clicking this button, the system gives an association sync key.
Press “continue” and finish the process.
Once Association is created, we can find the data object to be inactive. Activate the data object again.
Once activation is done, we can see one more new field added up in the notif_header named with auto generated association key.(in our case its N2E_SYNCKEY_MMW)
NOW CLEANUP THE DATA IN MIDDLEWARE USING T-CODE “SDOE_CLEANUP” and TRIGGER BACKEND LOAD AGAIN by USING “SDOE_LOAD”.
If both the DATA OBJECTS (Notification and Equipments Contain the similar equipments then, the “N2E_SYNCKEY_MMW” will be populated automatically by a system generated number as seen below.
The 15 entries for the notification is shown below
The EQUI_HEADER Values are also shown below:
With all the above steps we have modeled our data objects. Now we need to do steps for distributing data to devices. Distribute data means, to distribute the data readily available in the middleware to different devices.
Here comes the use of distribution model.
Here, we need to create a NEW SWCV specific for Distribution Model. It is not mandatory that a separate SWCV is required for creating SWCV but it is always recommended to do so for the purpose of reusability.
Now we will create a NEW SWCV named “NOTIF_EQUIP_SWCV_DM , 1.0 of DEV.COM”
Go to the “Uses” tab and fill the SWCV name and check the “inherit do” check box. This means that this SWCV uses the NOTIF_EQUIP_SWCV and therefore all the Data Objects associated with SWCV.
Create Distribution Model for a particular Data Object as follows:
Save
Now create a dependency using the wizard for the created distribution model.
Enter the relevant details like
Dependency name, Description
When the “use association” button is clicked the system shows the node associations created in this DATA OBJECT (In our case notification data object: we have created a node association for notification data object and equipment data object earlier).
Select the association from the help. The screen will be as follows. Now we are going to create a dependency by using the node association. Here comes the use of node association.
Press continue and finish the process. Now we can see that
Leading Data Object is Notification
Following Data Object is Equipment.
AN EQUIPMENT WILL FLOW TO THE DEVICE FROM THE EQUIP DATA OBJECT ONLY IF THAT PARTICULAR EQUIPMENT HAS FLOWN TO THE DEVICE FROM THE NOTIFCATION-EQUIPMENT.
No equipment will flow to the device from the equip_do if the same equipment is not available to flow from the notification header –equipment.
Distribution Rules:
Distribution Rules are used for making the data flow from middleware to devices. We need to create a normal distribution rule for notification using the wizard.
We can take the notif_header node from the help and assign noti_type as a condition to distribute data.
Select “Device Attribute Mapping” radio button. When this radio button is selected we need to assign the notif_type field to a device attribute in the RMM( Receiver Meta Model).The notif_type attribute should be created as an attribute in an RMM Customizing Group Before creating the Distribution Rule.
The DEVICE ATTRIBUTE is assigned to notif_header-notif_type attribute
Press “Continue”
Activate the distribution Model.
After the generation process is over, we can go to the DOE Admin Portal and proceed with the Device Creation process.
When the device is created, and the device is assigned to the DM_SWCV (In our case its NOTIF_EQUIP_SWCV_DM, 1.0 of DEV.COM. The device attribute is given as M1 for notif_type.
There were 15 notifications, and 2 equipments in the SWCV Metadata (see the middle ware database tables above). We had given the rule with condition that notifications with notification type “M1” should only flow to the device. Since all notifications are of TYPE M1-Maintainenance Request we expect all the 15 equipments to flow to the device.
There are 15 notifications found in the pending extracts of the Device(DEM007).But out of 2 equipments only one is flown into the device.
But we can see one equipment has also flown into the device.We had not defined a distribution rule for equipment in the DM SWCV. But still equipment has flown to the device .But again,we can notice that only one equipment has flown rather than 2.
This is as a result of the dependency that we have created (notification –leading object, and equipment following object)
If a notification which flows to the device contains the equipment ,available in the equipment metadata ,then that equipment will also flow to the device .
Here example is : The 15 notifcations together have 2 equipments: 10000000 and 10000001.
But the equipment data object contains two equipment entries: 10000000 and 10000002
So ,the device will only have 10000000 from equipment data object as the equipment data object is defined as a following data object to the notification data object which in turn is the leading data object.
This is the concept of dependency. The outbound queue of the device after executing trigger extract is shown below.(Contains only equipment: 10000000)
The above shown figure is the device outbound queue,