on 12-14-2007 10:59 AM
Hi expert,
i have a issue:
I create a record with
Record rec = RecordFactory.createEmptyRecord(mainTableId);
afert i set value in that record with
rec.setFieldValue
.
when i try to insert the record in table i have a exception:
when i use :
ModifyRecordCommand modifyRecord =
new ModifyRecordCommand(connection);
modifyRecord.setSession(session);
modifyRecord.setRecord(rec);
modifyRecord.setModifyAnyway(false);
modifyRecord.execute();
I get :
com.sap.mdm.commands.CommandException: Can not update record with modification status NEW
And when i use :
CreateRecordCommand create_command =
new CreateRecordCommand(connection);
create_command.setSession(session);
create_command.setRecord(rec);
create_command.execute();
I get :
com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: Nessun campo di ricerca qualificato
What i can do to insert a record in a table ?
Thanks.
Regards.
Andrea
Hi Andrea,
Could you send me the link of the wole code becuse I am not getting how i have to write code for setFieldValue() method of Record interface.
I have clicked over your provided links named code but they are not reaching at the code.
It'll be great help to me.
Please help me.
Thanks and Regards.
Tarun Sharma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i haven't a link for the code.
But i can help you to write the usage of setFieldValue.
You insert a record in the lookup table.
From this record you can get the id getId()
and then you add a field in the main table.
setFieldValue(fieldId,new LookupValue(the id of record of lookup Table))
I hope thi is usefull.
Regards
Andrea
//Create empty record from lookup tableId
try{
Record lookup_record = RecordFactory.createEmptyRecord(tableId);
//add value to the record
lookup_record.setFieldValue(<FieldId>, new MdmValue(<value>));
} catch (Exception e2) {
}
CreateRecordCommand create_command = new CreateRecordCommand(connection);
create_command.setSession(session);
create_command.setRecord(lookup_record);
try {
create_command.execute();
} catch (Exception e) {
System.out.println(e.toString());
}
RecordId record_id = create_command.getRecord().getId();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrea,
Could you send me the link of the wole code becuse I am not getting how i have to write code for setFieldValue() method of Record interface.
I have clicked over your provided links named code but they are not reaching at the code.
It'll be great help to me.
Please help me.
Thanks and Regards.
Tarun Sharma
Is it multivalued record?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.