cancel
Showing results for 
Search instead for 
Did you mean: 

How to update field of MDM table with Java MDM4j?

Former Member
0 Kudos

Hello,

Can anyone please provide an example of how to modify/update a field of an MDM table using java MDM4j?

I'm not trying to update a record just a field of a table.

Thanks

BR Olof

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Olof,

For updating a field in a record, below procedure needs to be followed:

First of all you need to have the Record Id for the record where you want to update the field. If you dont have the Record Identifier then you need to get it based on some search.

Secondly use the below code for performing update on the field value:

Create an objec of RetrieveRecordsByIdCommand and set the Record Id

Prepare a ResultDefinition for the given table.

Add the required field using the addSelectField() method of ResultDefinition.

Add this result definition to the RetrieveRecordsByIdCommand an execute the command.

Get the record object from the above command (RetrieveRecordsByIdCommand.getRecords().getRecord(0))

Set the new value against the field that you wnt to update (use ExistingRecord.setFieldValue())

- use the ModifyRecordCommand to update the record by putting the above record (Use ModifyRecordCommand.setRecord(EXISTING RECORD) to set the updated record. Execute the command and you have updated the record.

Hope this helps!!

Cheers,

Arafat

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you for the helpful input. I found a solution.

Cheers

0 Kudos

Hi Olof,

Please refer the MDM Java API Guide:

https://websmp201.sap-ag.de/~sapidb/011000358700000549492008E

Also you will find additional java docs in the below link

http://help.sap.com/javadocs/MDM/index.html

Hope this helps.

Thanks,

SA