cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve a record and modify it using Java API

Former Member
0 Kudos

Hi,

I'm trying the following scenario using Java API in MDM.

I query a MDM MAIN table called "Vendors". I get a result set.

Now, i try to pick a particular record to modify one of the fields called "Vendor Number". My objective is to Update a field called Vendor Number in that table with a text.

Can you provide the code snippet to Capture a record and Update a particular field alone?

Thanks in advance,

regards,

Ak.

PS: Points assured for good responses...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Ak,

Please have a look at my <a href="/people/community.user/blog/2007/11/06/sap-netweaver-mdm--using-the-mdm-java-api">blog</a>. It contains all kinds of code samples one of which is to create and update records.

Cheers,

Richard

Former Member
0 Kudos

hi Namrata,

I'm using Java API 2.

hi Richard,

i saw your code samples. They helped me. But the problem is that i'm still not able to achieve the task.

my exact task at hand is as follows.

-> query vendor master table and get all records.

-> select a particular record by recordID and update the Vendor Number field in that record with a number.

besides that, your code CRUDMainTable.java calls a method called updateRecord which i was not able to locate. Can you pl. give me specific pointers to achieve my objective?


//get metadata
		TableSchema productsTableSchema = repository.getSchema().getTableSchema(MDMAPISamples.Products.TABLE);
		//get the field value pairs to create the record
		FieldValuePair[] fieldValuePairs = getFieldValuePairs(productsTableSchema);	
		//Create a product record and get the record id
		RecordId productRecordID = createRecord(productsTableSchema, fieldValuePairs); 
		//Read
		Record productRecord = getRecordByID(productsTableSchema, productRecordID);
		//get the updated field value pair array
		FieldValuePair[] updatedFieldValuePairs = getUpdatedFieldValuePairs(productsTableSchema);
		//Update
		updateRecord(productRecord, updatedFieldValuePairs);

Thanks in advance,

Regards

Ak.

Former Member
0 Kudos

Hi,

I managed to solve it.

using the following snippet form the one of the forum thread.


CatalogData.UpdateRecord(TableName, recordId, resultset.GetChangeStampAt(0), fields);

Thanks for your replies.

Regards

~a.k.

namrata_d
Active Participant
0 Kudos

Hi Arun,

Are you intending you use JAVA API 1 or JAVA API 2??

Thanks

Namrata