cancel
Showing results for 
Search instead for 
Did you mean: 

How to get ALL records

Former Member
0 Kudos

Hi,

do we have any command in SAP MDM API for the following

To fetch all the records which are 'In progress' (MDM status)?

or

To fetch all record ids?

I am looking for the above information for initial correction for the products.

Regards

Shiva

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Yogesh,

Please follow these steps to retrieve records with status 'In progress'.

Step1 : Create ResultDefinition and set the fields which are to be displayed as given below

(a) ResultDefinition resdef = new ResultDefinition(TableId tableId);

(b) resdef.setSelectFields(FieldId[] fieldIds);

Step2 : Create Search and set the search criteria

(c) Search search = new Search(tableId);

(d) FieldSearchDimension fieldSearchDimension = new FieldSearchDimension(fieldId);// Specify the fieldId of the field to be searched

(e) TextSearchConstraint textSearchConstraint = new TextSearchConstraint("In progress", TextSearchConstraint.EQUALS);

(f) search.addSearchItem(fieldSearchDimension,textSearchConstraint);

Step3 : Create RetrieveLimitedRecordsCommand and set the parameters

(g) RetrieveLimitedRecordsCommand retrieveLimitedRecordsCommand = new RetrieveLimitedRecordsCommand(repository.getConnection());

(h) retrieveLimitedRecordsCommand.setResultDefinition(resdef);

retrieveLimitedRecordsCommand.setSearch(search);

Step4 : Execute the command and retrieve Records

(j) retrieveLimitedRecordsCommand.execute();

(h) retrieveLimitedRecordsCommand.getRecords();

Hope it helps.

Regards,

Neeharika

Former Member
0 Kudos

Hi Neharika,

I am able to filter using Search class and API you have given.

Thanks a lot for the right pointers.

I am getting only 1000 records when repository has 8000+ records.

Is this a limitation on 'RetrieveLimitedRecordsCommand'?

Can we change this limitation?

Regards

Shiva

Former Member
0 Kudos

use the following code

retrieveLimitedRecordsCommand.setPageSize(pageSize);

Former Member
0 Kudos

Or

retrieveLimitedRecordsCommand.setPageIndex(pageIndex);

and execute retrieveLimitedRecordsCommand many times incrementing pageIndex.

Former Member
0 Kudos

Hi shiva,

since you have 8000 + records;

you are left with two options here ;

if you are passing pagesize from your request object , use that page size number as follows;

cmd.setPageSize(pageSize); // pageSize is integer number which is pased from Request

else if you want to get all the records from repository , use the following approach;

cmd.setPageSize(Integer.MAX_VALUE);

hard coding pageSize is not right approach;

if you any furthur help on this , let me know;

Regards

Rajasekhar K

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Use the below class

DATA: LT_RESULT TYPE MDM_SEARCH_RESULT_TABLE.

CALL METHOD LR_API->MO_CORE_SERVICE->QUERY

EXPORTING

IV_OBJECT_TYPE_CODE = 'PRODUCTS'

IMPORTING

ET_RESULT_SET = LT_RESULT.

IV_OBJECT_TYPE_CODE = 'PRODUCTS' here you can use CODE

of products.

Thanks,

Anil.

Former Member
0 Kudos

Hi Anil,

I did not understand the below code, Can you give me more pointers on how to use the below in java program?

Use the below class

DATA: LT_RESULT TYPE MDM_SEARCH_RESULT_TABLE.

CALL METHOD LR_API->MO_CORE_SERVICE->QUERY

EXPORTING

IV_OBJECT_TYPE_CODE = 'PRODUCTS'

IMPORTING

ET_RESULT_SET = LT_RESULT.

IV_OBJECT_TYPE_CODE = 'PRODUCTS' here you can use CODE

of products.

Thanks,

Shiva