In April 2005, I had written two weblogs titled Execute BW query using ABAP Part I & Execute BW query using ABAP Part II . Since then the function module (Y_EXECUTE_QUERY) explained in Execute BW query using ABAP Part I has gone for major change to handle performance and to provide some additional features. The changed code is provided in this document.
UPDATE (9th July 2008): you may be interested in this as well https://wiki.sdn.sap.com/wiki/display/BI/Expose+BI+Query+as+RESTful+Service
- Time consuming validations (query variable) are taken away. Now it’s the responsibility of the developer to pass proper variable/variable value.
- Display attributes were not supported in the earlier version of Y_EXECUTE_QUERY and the same is fixed in this version.
- Restricted key figures with multiple column headers which were not supported in the earlier version is fixed in this version.
If you are on BW3.5 you can use standard function module RRW3_GET_QUERY_VIEW_DATA to execute BW query and get the data. The difference between RRW3_GET_QUERY_VIEW_DATA and Y_EXECUTE_QUERY is that the standard FM returns the data as separate tables for AXIS_INFO , CELL_DATA , AXIS_DATA and TXT_SYMBOLS where as using Y_EXECUTE_QUERY you can get the output in XML format and the same can be converted to a two dimensional itab using the XSLT program provided in Execute BW query using ABAP Part II. As far parameter passing for RRW3_GET_QUERY_VIEW_DATA you have to pass parameters to it like passing it for web query URL parameters. ( VAR_NAME_1= &VAR_VALUE_EXT_1=&etc…(more info)). RRW3_GET_QUERY_VIEW_DATA is the one which is used when you call BW query as webservice.