cancel
Showing results for 
Search instead for 
Did you mean: 

MDM java api search on Main table

Former Member
0 Kudos

Hi All,

I am developing MDM Web dynpro custom application using MDM java API 2. I am having difficulty while searching on main table by date field. The fields type in MDM as u201CTime Stampu201D how I make my search constraints. Please point me if there is any tutorial or sample code.

Thanks

John.

.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hi Mandeep,

I am not quite understood from the Article. Because i am trying to search on Main table using whatever date i selected from Web dynpro UI.

My scenario is i am trying to pass the date i selected (MM/DD/YYYY) but mdm we are using time stamp so when i looked at the search constraints API i found one Timeserachconstraints (Calendar, int) so how i convert my date into calendar and pass it to corresponding search constraints.

Really appreciate your help.

Thanks

John.

Former Member
0 Kudos

Hi John,

I haven't got opportunity to work with mdm java api but i hoped that link in above post can help you.

Please refer as you want search on Main table of mdm repository: hope this helps

http://wiki.sdn.sap.com/wiki/display/SAPMDM/SearchInaMDMRepository

http://wiki.sdn.sap.com/wiki/display/WDJava/HowtoconnectMDMusingWebDynpro+Java

If i get anything to convert date into calendar, will get back to you.

Regards,

Mandeep Saini

Former Member
0 Kudos

Hi John,

Try using the following code snippet.


TableId tableId = schema.getTable("Products").getId();
FieldId fieldId = schema.getField("Products", "Update_Date").getId();
FieldSearchDimension searchDimension = new FieldSearchDimension(fieldId);
Calendar cal = Calendar.getInstance();
cal.set(2009, 11, 24);
DateTimeSearchConstraint dateConstraint = new DateTimeSearchConstraint(cal, DateTimeSearchConstraint.GREATER_THAN);
Search search = new Search(tableId);
search.addSearchItem(searchDimension, dateConstraint);

Here "Products" is the name of the table on which the search is done. "Update_Date" is a field of type Timestamp. I've hard-coded the date currently. You can use the various Date constructors to set the date dynamically.

Regards,

Anil Madhavan

Former Member
0 Kudos

Hi Anil,

Thanks for your response and your code explains me quite well. In my situation that I need to put search criteria between dates, not sure how your code will give me the opportunity.

Thanks

John.

Former Member
0 Kudos

Hi John,

I couldn't find a range search functionality for Date. I'm still trying out that.

Meanwhile, you can get all the records from the lower date range, and filter out the ones above the higher date range using the java.util.Date class, after() method, comparing the record date and the higher date range.

For huge datasets, this could definitely pose a problem, as we are bringing in all the records, and then filtering it out.

Regards,

Anil Madhavan