Environment: Webdynpro Java Portal and SAP MDM
Scenario 1: Create
3. Use CreateRecordCommand create = new CreateRecordCommand(<user session context>); to create the Binary Object Record (B1)
CreateRecordCommand (MDM Java API Library)
4. Set the value and Update the Main Table Record (R1) with the Link (B1) Result : We have a record (B1) in the Binary Object table linked to the main table* record (R1).
*Can be table of any type
Scenario 2: Update
To update the BLOB object of that particular Binary Object record (B1).Steps:
ModifyRecordCommand (MDM Java API Library)
Result: The Binary Object is updated and hence there is no need to re-link again.
**For the details about the different Parameters of Binary Objects - Working with Binary Large Objects (BLOBs) - SAP NetWeaver Master Data Management (MDM) 7.1 - SAP Lib...
to set the setDataGroupId(Mandate for all types of BLOBs)
RetrieveGroupTreeCommand tree = new RetrieveGroupTreeCommand(<usersession context>););
tree.setGroupType(GroupTypes.DATA_GROUP_TYPE);
tree.execute();
HierGroupNode node = tree.getGroupTree();
//As per our requirement we just placed all the BLOBs in the first leaf of the node
//you can various options in the HierGroupNode (MDM Java API Library) to traverse and select the relevant leaf.
GroupNodeId gID = node.getAllLeafs()[0].getId();
blob_instance.setDataGroupId(gID);
to set the setDataLocationId (Mandatory only for Binary Objects)
RetrieveGroupTreeCommand location = new RetrieveGroupTreeCommand(<usersession context>);
location.setGroupType(GroupTypes.DATA_LOCATION_TYPE);
location.execute();
HierGroupNode lTree = location.getGroupTree();
//As per our requirement we just placed all the BLOBs in the first leaf of the node
//you can various options in the HierGroupNode (MDM Java API Library) to traverse and select the relevant leaf.
GroupNodeId lID = lTree.getAllLeafs()[0].getId();
blob_instance.setDataLocationId(lID);
Scenario 3: Deletion
Note : we can delete a Binary Object only if it is not linked anywhere.
Delete the orphaned or the unused records from the Binary Objects table.
Using the RetrieveLimitedRecordsExCommand objExCommand_allData = new RetrieveLimitedRecordsExCommand(<UserSessionContext>); Command.
2. Use the below code to get usage of the Binary Object Record (B1).
RetrieveBinaryObjectUsageCommand objUsageCommand =new RetrieveBinaryObjectUsageCommand(<UserSessionContext>);
RepositoryItemUsageResult objUsageResult = objUsageCommand .getUsageResult();
RepositoryItemUsage[] repoUsage=objUsageResult.getUsages();
Refer the link for the return values : Constant Field Values (MDM Java API Library)
If the length of repoUsage is 0 then the Binary Object Record (B1) has no usage. And therefore can be erased.
3.Use the
DeleteRecordsCommand objDeleteBLOBRecordsCommand = new DeleteRecordsCommand((<UserSessionContext>);
DeleteRecordsCommand (MDM Java API Library)
To delete the Record.
Note : Trying to delete Binary Object records which are linked will result into an Exception .
FYI: For your information you can use the Pagination technique for searching Pagination of MDM search result in Java
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
9 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |