日期:2014-05-17 浏览次数:20903 次
package cr;
import com.crystaldecisions.sdk.exception.SDKException;
import com.crystaldecisions.sdk.framework.CrystalEnterprise;
import com.crystaldecisions.sdk.framework.IEnterpriseSession;
import com.crystaldecisions.sdk.framework.ISessionMgr;
import com.crystaldecisions.sdk.occa.infostore.IInfoObject;
import com.crystaldecisions.sdk.occa.infostore.IInfoObjects;
import com.crystaldecisions.sdk.occa.infostore.IInfoStore;
import com.crystaldecisions.sdk.occa.managedreports.IReportAppFactory;
import com.crystaldecisions.sdk.occa.report.application.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
public class AlwaysRequiredSteps {
public ReportClientDocument Required() throws SDKException{
String cms = "fams-full";
String username = "famsdev";
String password = "fams123";
String auth = "secEnterprise";
String reportName = "bookTest";
IEnterpriseSession enterpriseSession = null;
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
boolean loggedIn = true;
ReportClientDocument clientDoc = null;
if (enterpriseSession == null){
try{
sessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = sessionMgr.logon(username, password, cms, auth);
} catch (Exception error){
loggedIn = false;
}
if (!loggedIn){
System.out.println("------------Sorry!you could not be logged on to this server!-----------");
return null;
}else{
IInfoStore iStore = (IInfoStore) enterpriseSession.getService("InfoStore");
IInfoObjects infoObjects = iStore.query("Select SI_ID From