cancel
Showing results for 
Search instead for 
Did you mean: 

Problems while retrieving data records in a workflow using new Java APIs

Former Member
0 Kudos

Hi All,

iam facing problems while retrieving records assigned to a workflow, am able to get the Record Ids of a work flow. Now am trying to retrieve Records using RetrieveRecordsByIdCommand , am getting run time exception. Please check the code and suggest if any modification have to be made.

RetrieveRecordsByIdCommand retRecById= new RetrieveRecordsByIdCommand(connPool);

retRecById.setSession(session);

retRecById.setIds(workId);

ResultDefinition resultDefinition = new ResultDefinition(tId);

retRecById.setResultDefinition(resultDefinition);

// retRecById.getResultDefinition();

RecordResultSet recResultSet = retRecById.getRecords();

try {

retRecById.execute();

System.out.println("SESSION Execute");

} catch (CommandException e) {

String errMsg = "Failed to authenticate the repository session!";

System.out.println("SESSION Not Execute");

throw new RuntimeException(errMsg);

}

// Run Time Expception //

java.lang.NullPointerException: Parameter 'lookupId' must not be null

at com.sap.mdm.valuetypes.LookupValue.<init>(Unknown Source)

at com.sap.mdm.data.commands.RetrieveRecordsByIdCommand.execute(Unknown Source)

at sap.mdm.GetWorkflows.main(GetWorkflows.java:177)

Exception in thread "main"

Pls provide Solution

Thanks

Praveen K

Accepted Solutions (0)

Answers (2)

Answers (2)

AndreasSeifried
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Praveen,

you must specify what to retrieve from the found records in the resultDefinition. For example:

resultDefinition.setSelectFields(fields);

where fields is an array for field ids.

For complete examples see:

http://help.sap.com/saphelp_mdm550/helpdata/en/46/281bc8218b14dbe10000000a155369/frameset.htm

Kind regards,

Andreas

Greg_Austin
Active Participant
0 Kudos

I would guess that your workId is null. Check that it has a valid value before running these lines.