You need to define a jdbc data source ( SYS_BICDB )on netweaver administration pages.
( Configuration -> Infrastructure -> Application Resources )
Then you will refer calculation view as follows :
String sql = "SELECT GROUP FROM \"_SYS_BIC\".\"MY_Business_Scenario/SPVR_MY_SCENARIO_CONTEXT\" where DEF = '" + rfxId + "' ";
MY_Business_Scenario : name of your scenario
SPVR_MY_SCENARIO_CONTEXT : name of your calculation view.
public String getProcGroup(String rfxId) throws Exception {
Connection con = null;
String sql = "SELECT GROUP FROM \"_SYS_BIC\".\"MY_Business_Scenario/SPVR_MY_SCENARIO_CONTEXT\" where DEF = '" + rfxId + "' ";
try {
InitialContext ctx = new InitialContext();
DataSource dsource = null;
dsource = (DataSource) ctx.lookup("jdbc/notx/SYS_BICDB");
con = dsource.getConnection();
PreparedStatement q = NativeSQLAccess.prepareNativeStatement(con, sql);
ResultSet rs = q.executeQuery();
String procGroup = "";
while (rs.next()) {
procGroup = (String) rs.getString(1);
}
con.close();
return procGroup;
} catch (SQLException e) {
e.printStackTrace();
logger.errorT("getProcGroupFail for " + rfxId + " : " + e.getMessage());
} finally {
if (con != null) {
con.close();
}
}
return null;
}
No comments:
Post a Comment