on 04-02-2008 6:24 AM
Hi,
I have written a Java Code to Modify the data using Java API's.
I have done the following:
Connected to Server
Connected to Repository
Created the User Session
User enters the Table Name - I have retrieved the corresponding Table id
User enters the Search Parameter(Condition on which update should be made).
I have retrieved all the records, matching the search criteria, using the Search function.
Now I wanted to modify the selected reocrds, I am using the following code to do this.
ModifyRecordCommand modRec = new ModifyRecordCommand(connections);
modRec.setSession(sessionId);
modRec.setRecord(resSet);
modRec.setModifyAnyway(false);
try
{
modRec.execute();
}
catch(CommandException e)
{
e.printStackTrace();
return;
}
In the above Code, I donot know how to pass the values of the fields, that should be updated.
Can anyone help me to solve this.
Thanks.
Hi Priya
Before passing Record object i.e resSet in your case.Use the following code:
resSet.setFieldValue(fields[0], new StringValue("Abc"));
resSet.setFieldValue(fields[1], new BooleanValue(true)); resSet.setFieldValue(fields[2], new IntegerValue(4567));
Thanks & Regards,
Jitesh Talreja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In resSet, I am passing the records, that I retrieved through Search.
Now, should i create another record set and pass that in the modify statement??
If I do, so then i am getting an error as
com.sap.mdm.commands.CommandException: Can not update record with modification status NEW
at com.sap.mdm.data.commands.ModifyRecordCommand.execute(Unknown Source)
at programs.ModifyRecord.main(ModifyRecord.java:116)
Can you tell what does error mean
Thanks,
Priya.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.