Now that my scope of work has shifted, I found new things to play with. Good bye ABAP-ing in ECC 6.0. Welcome ABAP-ing in SAP BI, kekekke. More than that, I am challenged to bring out SAP BI data to the world company. Like what my seniors and I have been doing in R3, we abused brought out the precious information to Web Services and SQL Servers. And the result are dynamic heart beats of transactions and reports that have the spirit of single source of truth. Speaking of information in our company is speaking of SAP data. No other. Of course, without having to remember a T-Code.
Years passed through. My interest got hooked on SAP BI. With all massive storage and OLAP techniques that makes reporting finally got its attention in the first place. To communicate with SAP BI from outside, I've tried the hard way and currently using the easy way. The hard way, learn MDX Query and pass it to BI by calling a BAPI. I can't remember the BAPI name, I don't want to discuss that now. Me feels too hard to coupe with MDX query. The easy way, using a web service that SAP BI provide. For doing this, you have to work with some one who have access to SAP BI GUI and can operate SAP Query Designer. Ask the dude to follow the steps to prepare the web service in SAP BI here. That document is a starter, the journey to have a ready-to-call web service has just begun my friend. This is tricky, you thought you got the web service link, but when you tried to access it, BUM! Failed. Well if that's the case, kindly contact me. See if I can help you. Been there, me. Sorry but I really need to skip so that I can finish this fast.
Specify your output data to SAP BI dude so that they can build that into a query, of course from the Query Designer. As a result, you will get query name and info provider name.
Now it's web application's turn. The service you need to call is GetQueryViewData. When testing, use a simple query without any variable screen. Because dealing with variable screen is the second confusing thing. Explanation from SAP on how to pass parameter to variable screen in this service is veeery hard. It is far away from plain. I have to google and google again until accidentally met the same programmer with the same problem. And this is how GetQueryViewData is called using parameter:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Collections.Generic;
using System.Net;
using WSDashboardEnterprisePortal.SAPBIProxy.GetQueryData;
//That was the class of the web reference
public static GetQueryViewDataResponse GetQueryData() {
NetworkCredential login = new NetworkCredential();
GET_QUERY_DATA BWQuery = new GET_QUERY_DATA();
login = new NetworkCredential();
login.UserName = "UserName";
login.Password = "Password";
BWQuery.Credentials = login;
BWQuery.PreAuthenticate = true;
GetQueryViewData gqvd = new GetQueryViewData();
gqvd.Infoprovider = "InfoProvider";
gqvd.Query = "QueryName";
ListlistParam = new List ();
W3query param;
for (int k = 0; k < arrParameter.Length; k++) {
VAR_NAME_1, VAR_NAME_2, and so on //If you only have one parameter, omit this loop
param = new W3query();
param.Name = string.Concat("VAR_NAME_",(k+1).ToString()); //
param.Value = "0CALMONTH";
listParam.Add(param);
param = null;
param = new W3query();
param.Name = string.Concat("VAR_VALUE_EXT_",(k+1).ToString());
//That was VAR_VALUE_EXT_1, VAR_VALUE_EXT_2, and so on
param.Value = "200909";
listParam.Add(param);
}
gqvd.Parameter = listParam.ToArray();
gqvd.ViewId = null;
GetQueryViewDataResponse response = BWQuery.GetQueryViewData(gqvd);
return response;
}
1 comments:
Thanks for this post! How do you deal with the data once you get it out? The GetQueryViewDataResponse is hard to work with. I want to just put it in a list, maybe a list of dictionaries...
How do you do it?
Post a Comment