The sample code is located in the ERPConnect installation directory in the BWQuery directory
The following example shows a query being executed in .NET.
First a BWCube object is built with the help of the CreateCube function. Its name is made up of the cube name and query name.
The cube object offers a collection for all of contained dimensions (Dimensions) and key figures (Measures). The attribute SelectForFlatMDX defines whether or not each component should be contained in the query output. It is set to true in our example. Please note that the denomination of the key figures via the query generation in the designer does not follow from the original technical name, so the key figures in our example here are addressed by the ordinal number, not the name.
To fill the variables with values, they are addressed through the variables collection. There are always range tables behind each variable, as previously discussed in the SAP query chapter.
The BW query can be executed via Execute() and outputs a table of the DataTable type. The screenshot of our example shows the query output in the grid.
Click to open C# example.Click to open VB example.