This blog complements the blog “Easy queries on SAP Netweaver” written by Uwe Fisher giving detailed information about a SOAP based consumption of ‘Easy Query’ as delivered with SAP NetWeaver BW 7.30 SP5.
An easy way to consume the data from ‘Easy Query’ is to use an automatically generated Web service via SOAP. The Simple Object Access Protocol is a common and well known protocol. which can be used by several other programs and languages. Due the fact that SOAP is XML based it is possible to use it several ways e.g. calling the Web Service via JAVA to display the data.
The first thing to do is to download the WSDL for the Web Service of the query you want to use. Therefore you have to go to the Easy Query Management (Transaction ‘EQMANAGER’). There you can select the specific Query and jump to the SOA Manager via the button “Start SOA MANAGER” in the toolbar.
Within the SOA Manager you have to choose a binding you want to use (or create a new one) and after that you have to open the WSDL document for your selected binding. You can now ether download the WSDL and store them on your computer or save the URL. (Note: If you want to use the URL directly please implement note 1649833)
The WSDL document contains the whole information about the Web Service you want to use. Let’s have a closer look to the document itself. Use the Internet Explorer to open it. Within this document you find the fields which the Web Service returns. It also mentions the type of the parameters so that you can implement you application in the right way.
Each Web Service defines a couple of tables which he returns:
This Table contains the query information. Here you will find all values of your query. The columns were dynamically built out of the structure of your Query. So you will find the characteristics and key figures plus the formatted once here. The rows contain the specific values. The type of this table changes with every Web Service.
This table includes the technical name the type and also the description for every characteristic and key figure you use in the query.
This table contains specific information for each cell in the query. A cell is specified via RowID and ColumnID. For this cell you can retrieve information if this value is a sum or if this value is part of a hierarchy. If there is a hierarchy you also receive information about the parent and the hierarchy level this cell belongs to.
This table contains messages if they occur in the call stack. You can handle errors which you receive in this table so that your application becomes more stable or you can simply display them so that the user knows that something doesn’t work right.
This structure contains information about the query e.g. owner or creation date.
When this flag is true, something is wrong with the query.
It is also possible to use input variables. If you want to use them you have to provide the values for Sign (normally ‘I’ – Including), Option (‘EQ’ – Equal, ‘BT’ – Between, ‘CP’ – Contains Pattern), Low (value) and high (value if needed). The parameters need to be passed to the Web Service so that they can send to the backend. Feel free to visit the ‘Easy Query API’ (http://help.sap.com/saphelp_nw73/helpdata/en/27/02f6e4306346f3baad0cfd4af56bf0/content.htm) documentation to gain more information about it.
At the end of the WSDL you find the information about the binding. You will find a web address in the binding section. This is the information you need to connect to the system which the Web Service wants to call for Function Module to retrieve the data.
With this information you should be able to understand the Web Service. You can now use it in your application. Of cause you have to implement the connection and internal structures by yourself.
Let’s verify the result of the Web Service by using Microsoft Office InfoPath2007©. You can open a new form which is based on a Web Service.
On the next screen you have to choose if your service receive or send data or does both. On the next screen you need to provide the location of your service. You can ether choose an URL or if you download the WSDL to your computer you can use the location on your directory or you enter the URL from the Web Service directly. Select an operation you want to use and enter a name for the connection and continue.
Now you see a simple template. On the right sight under the folder ‘dataFields’ you can find the well known structures mentioned above. Drag and drop the ‘item’ folder under ‘ETGridData’ into the lower box. Select ‘Repeating Table’ in the context menu.
Now run your template via ‘Preview’ in the toolbar.
In the preview click ‘Run Query’ to start the Web Service and receive the data. After logging into the system you will see that the data occur in a table like format.
You build your first application which uses a Web Service based on ‘Easy Query’. Of course the table is the easiest way to show the data. However there are a lot of other options to display the result in a nice way. Just try it out!