cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove selection from ResultSet using Java API?

0 Kudos

Hi!

I have a problem that I can't solve myself.

I have created a Web Dynpro application that uses the SAP delivered WD components for Search, ResultSet and ItemDetails. When I first load the application the ResultSet table contains all records and none is selected. The ItemDetails then displays "No records selected". When the user selects a record it is displayed in the ItemDetails as usual.

I have some custom search coding where I send the found record ids to the result set component for display which works as well but when a search returns 0 rows I want the result set to be empty and Item details to display "no records selected" again. The problem is that I can't send 0 records or null to the resultset component so old record (from previous search) remains displayed. It is possible to remove selection using ctrl-click on the selected records and then the item details is cleared again but I want to use the same function from Java API.

Any idea how to solve this?

1) I've tried sending null and an empty array to the component

using "wdThis.wdGetSearcResultInterface().setRecordIds(recordIds);"

but then it doesn't refresh at all.

2) Remove selection using context mapping to the recordsInput node and the following commands:

wdContext.nodeRecordsInput().clearSelection();
wdContext.nodeRecordsInput().setLeadSelection(-1);

wdContext.nodeRecordsInput().invalidate()

3) the current solution which works somewhat is to destroy the component usage each time a seach is performed and create the component instance again using

wdThis.wdGetLocationResultComponentUsage().deleteComponent();

wdThis.wdGetLocationResultComponentUsage().createComponent();

wdThis.wdGetLocationResultInterface().setRepositoryBean(_repositoryBean);

wdThis.wdGetLocationResultInterface().setConfiguration(project, locationResult);

but then i get a warning when I select a search returns zero records and I try to destroy the component that a previous record is checked out (despite only being read and not edited before).

Help me Obi-Wans, you're my only hope

Best regards,

Richard

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

i don't know how you use the wd component.

resultset is not updated automatically when you do the search?

0 Kudos

I simplified my question a bit. What I have is two main tables, customer and location. The customer table uses the standard components for search, resultset and item details.

When the user selects one customer record that customer ID is used to search for locations for that customer. That search is hidden from the user and is done using the java API and the resulting record ids are set in the resultset component for location.

This far it works fine but the problem is that if the user first selects a customer with one or more locations, those are displayed correctly but if the user then selects a customer with no locations the resultset for location is not refreshed so the previous customers locations are shown.

[Customer] 1..N [Location]

junwu
Active Contributor
0 Kudos

I have been away from mdm for a while, did you try [-1] with wdThis.wdGetSearcResultInterface().setRecordIds?

0 Kudos

THANK YOU!

It worked when I set "-1" on the item details component like this

wdThis.wdGetLocationDetailsInterface().setRecordId("-1");
wdThis.wdGetLocationDetailsInterface().refreshComponent();
junwu
Active Contributor
0 Kudos

there is a constent in recordid if u don't want to hardcode "-1"

recordid.empty_record, I can't remember the detail

0 Kudos

Thanks, I use this now that looks alot better

wdThis.wdGetLocationResultInterface().setRecordIds(new Integer[] { RecordId.EMPTY_ID });
wdThis.wdGetLocationResultInterface().refresh();
wdThis.wdGetLocationDetailsInterface().setRecordId(Integer.toString(RecordId.EMPTY_ID));
wdThis.wdGetLocationDetailsInterface().refreshComponent();
Former Member
0 Kudos

Hello All,

is there any way I can copy internal ids of all the records in the resultset.

I tried mapping the nodeRecordsInput to my local context but no luck

Thanks in advance,

Priya

Answers (0)