cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Query on MDM API

Former Member
0 Kudos

Someone know how can i make the next query using the MDM Api? How can i make this sentence using classes as FreeFormTableParameters, FreeFormFieldParametes...?

SELECT FIELD1, FIELD2 FROM PRODUCTS WHERE FIELD1="HELLO"

I dont speach english good... Sorry about that.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Giancarlo,

something like this:


        TableId mainTableId = new TableId(1);
 
        // Define the result
        ResultDefinition rd = new ResultDefinition(mainTableId);
        
        // select all records
        Search search = new Search(mainTableId);
 
        // retrieve the records
        RetrieveLimitedRecordsCommand limitingCommand = new RetrieveLimitedRecordsCommand(connections);
        limitingCommand.setSession(sessionId);
        limitingCommand.setResultDefinition(rd);
        limitingCommand.setSearch(search);
        //limitingCommand.setPageSize(10);
        try {
            limitingCommand.execute();
        } catch (CommandException e) {
            e.printStackTrace();
            return;
        }        
        System.out.println("Record count is " + limitingCommand.getRecords().getCount());


// To get fields....
Record[] rec= limitingCommand.getRecords().getRecords();
 
For i to rec.length
RecordId objrecId = taxoSubClassRecs<i>.getId();

Hope this help you.

Regards,

Vito

Former Member
0 Kudos

Hey Thanks!!

i have only 2 questions more:

how can i obtain the var "connections"?

sessionID. What is it?

Thanks!!!

Edited by: Giancarlo Sereni on May 22, 2008 7:26 PM

Former Member
0 Kudos

Hi Giancarlo,

please, read this post:

Here you can find how to get connections and sessionID.

Besides, you can read about MDM Java API here:

http://help.sap.com/javadocs/MDM/SP06/overview-summary.html

Hope this help.

Regards,

Vito

Answers (0)