cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing MDO within a custom action block

0 Kudos

Hi,

is is possible to execute queries within a custom action block to a MDO? I'm using MII 15.0 SP4.

Thanks in advance for answering.

Regards,

Holger

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Holger,

Yes it is possible.

One of the possible ways is making a HTTP call to illuminator service of the MII.

Find more information about making http call from java code here:

html - How to send HTTP request in java? - Stack Overflow

More information about illuminator service can be found here:

URL Format for Queries - Content Development - SAP Library

Regards,

Rohit Negi.

0 Kudos

Hi Rohit Negi,

thanks for you hint. I have now one question left. Your mentioned link implies, that you're not only able to request a predefined MDO query, but also define your own query and send this instead. The question is how the URL has to look like in this case?

Regards

Holger

Former Member
0 Kudos

Hi Holger,

Yes you can create a dynamic query for your MDO.

Here is the format for MDO Query:

<protocol>://<server>:<port>/XMII/Illuminator?Server=<Name of the MDO Data server>&Mode=<Mode of the query>&MDO=<Path of the MDO>

Here in the URL you have to add the necessary parameter names and values expected by the query.

For checking the proper names of the parameters check the Link Editor of a MDO Query.

E.g.:

Suppose I want to do a select query on a MDO, then this will be my URL:

<protocol>://<server>:<port>/XMII/Illuminator?Server=MDOConnector&Mode=SelectMDO=<Path of the MDO>&Attributes=<name of the attribute>

Regards,

Rohit Negi.

0 Kudos

Hi, Rohit Negi,

thanks for your answer. That's the way it works for me. But what I want is to execute my own SQL-Query, written within the custom action block. The link URL Format for Queries - Content Development - SAP Library (see the Node) implies that it's also possible to query a SQL command directly with the Illuminator Service. But I dont't know how the syntax of the URL has to look in this case.

Regards,

Holger

Former Member
0 Kudos

Hi Holger,

Ir would be same as for MDO query:

http://<Server>:<Port>/XMII/Illuminator?Server=<Server Name>&Mode=FixedQuery&Query=<Write the Qeury here>&Content-type=text/xml

Also have a look at the characters you need to replace in your query to their hexadecimal equivalent:

Special Characters in HTML and HTTP - Content Development - SAP Library

Regards,

Rohit Negi.

0 Kudos

Hi Rohit Negi,

first of all thanks for your patience.

Sorry for asking again: what name have I to fill in for <Server Name> it seems not to be the <Server>. Up to now I was only successfull to use the following URL:

http://<server>:<port>/XMII/Illuminiator?QueryTemplate=<queryTemplateName>

Using your template I got a response with invalid servername


Regards,

Holger

Former Member
0 Kudos

Hi Holger,

Server name will be the name of the IDBC data server you would have created in Data server screen.

Regards,

Rohit Negi.

0 Kudos

Hello again,

for the sake of completeness, unfortunately a MDO Data Server does not allow dynamic queries at all. For other Data Servers you have to check the Allow Dynamic Queries to make it work.

Regards,

Holger

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Holger,

Another way would be connecting to the database of MII using the JDBC connection of Java.

You can find more information here:

Getting a Connection to the Database - Using Java - SAP Library

MII creates a JDBC datasource named "XMIIDatasource". You can use that or create your own also.

This is the path for JDBC datasources in the net-weaver server:

Configuration-->Infrastructure-->Application Resources

Once you get the connection object then you can query any table in the net-weaver/MII database.

Each MDO is a table created in the net-weaver/MII database thus you need to know the name of table generated by MII. Table for MDO will have names like MDO and a number.

The before mentioned approach of making http call to MII is better, clean and easy way to execute the queries.

Regards,

Rohit Negi.