on 09-09-2011 7:37 PM
Hello,
I want to retrieve the Original Record id of the record selected in the Results Set iview in the Webdynpro java application using MDM Java API. I am using the following links for the same :
http://help.sap.com/saphelp_mdm71/helpdata/en/49/6bc4e153a03e90e10000000a42189c/content.htm
But when I try to print the value of the Original Record Id, it gives a value of -1. In the same way when I send the Material ID value from the iview using the same method , the correct value is displayed. Do we need to do anything else to display the Original RecordID.
Any help would be highly appreciated.
Thanks
Hi,
Try this command -
public class RetrieveOriginalsByCheckoutRecordCommand
extends AbstractRecordsByIdCommand
A command to retrieve the original record Ids given the checked out record Ids are known.
Thanks,
Shambhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Shambhu,
Thanks for the reply. I wrote the following code below to retrieve the Original Record Id :
try
{
usc = new UserSessionContext(servername,repositoryname,username);
// Create a Session Manager.
SessionManager sessionManager = SessionManager.getInstance();
// Authenticate user to the Session.
sessionManager.createSession(usc,SessionTypes.USER_SESSION_TYPE,password for the user);
retorig = new RetrieveOriginalsByCheckoutRecordCommand(usc);
}
catch(ConnectionException ce)
{
ce.printStackTrace();
}
GetTableListCommand tableListCommand = new GetTableListCommand(connections);
tableListCommand.setSession(sessionId);
try
{
tableListCommand.execute();
}
catch (CommandException e)
{
e.printStackTrace();
wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);
}
TableProperties[] tables = tableListCommand.getTables();
retorig.setSession(sessionId);
retorig.setRecordIds(new RecordId[]{new RecordId(recordid)});
retorig.setTableId(tables[0].getId());
try
{
retorig.execute();
wdComponentAPI.getMessageManager().reportSuccess("Success for Original");
}
catch(CommandException e)
{
e.printStackTrace();
wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);
}
RecordId[] rids = retorig.getOriginalRecords(new RecordId(recordid));
wdComponentAPI.getMessageManager().reportSuccess(rids.length+"");
}
Where recordid is the RecordId returned from the iview from the Parameters -Mapped Fields section which is coming fine as a number. But when I try to print the value for the length for the Record Ids Array rids , it returns a value of 0.
Please help.
Edited by: PortalPerson on Sep 12, 2011 6:18 PM
Refer this link pg 8 and see if the logic used here can be of any help to you - http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d09eaa01-f941-2c10-8d88-be7e05a85...
Thanks,
Shambhu.
You said that you were able to get the Original Record ID but not able to print the length of the array.
So I showed you an example where you can get the length of the array. Use this logic and enhance your code and not replace your code.
Include both the codes, the one with which you are getting Record ID and the other with which you are getting length.
Thanks,
Shambhu.
Shambhu,
I said that the RecordId retrieved from the iview is coming fine which is not the Original Record, so when I use that recordid as parameter in the Command RetrieveOriginalsByCheckoutRecordCommand I get an array of length 0 , as it does not have any Original Record Ids in it , so I am not able to get any Original recordIds.
Thanks
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
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.