Skip to Content
0
Former Member
May 12, 2008 at 03:19 PM

Creating record usinf Java API

17 Views

Hi All,

I am using MDM 5.5 SP6. I have created repository. In that repository, Products is a main table as default. It has two fileds as Name(Type --> Text) and Category(Type --> Lookup(Taxonomy)). I tried to add a record in the main table through belown code(Using java API).

Record r1 = RecordFactory.createEmptyRecord(new TableId(1));

FieldId fld1, fld2;

fld1 = new FieldId(2);

fld2 = new FieldId(3);

r1.setFieldValue(fld1, new StringValue("M1002"));

r1.setFieldValue(fld2, new StringValue("Mobile"));

createRecordCommand.setSession(userSessionCommand.getUserSession());

createRecordCommand.setRecord(r1);

try {

createRecordCommand.execute();

} catch (CommandException e2) {

e2.printStackTrace();

}

But it is getting Field not found exception. Here I realised , tableid = 1(for table 'products') and Field id = 2 (For field 'Name') is correct. I couldn't findout what is the field id for 'Category' field.

And also, Here How can I realize table id and field id?

I followed this article also.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/803e9e80-21f4-2a10-8cbf-bcf6a8060be3

Please help to solve this.

Thanks,

Venkatesh