SAP BO 报表和FineUI(ASP.NET)的无缝集成

本文介绍如何使用ASP.NET和SAP .net SDK在Web应用程序中集成并展示SAP BusinessObjects (SAPBO) 报表。通过具体代码示例,展示了如何创建登录令牌并利用该令牌构建查看报表的URL。

墙内jsp的例子比较多,asp的少,但是我已经用EF很顺手了,那必须要在ASP中实现展现SAP BO报表。

 

 

SAP BO 服务器版本: SBOP BI PLATFORM 4.1 SP07 SERVER WINDOWS 64B 1/2         51050532_1

SAP BO 客户端: SBOP BI PLATFORM 4.1 SP07 CLIENT TOOLS WINDOWS (32B)       51050532_3

SAP .net SDK版本: SBOP BI PLATFORM 4.1 SP07 ENTER .NET SDK RUNTIME WINDOWS    51050532_2

 

FineUI版本: 4.2.3  

开发环境:VS2010

 

 

 

using System.Configuration;
using CrystalDecisions.Enterprise;
using System.Diagnostics;
using System.Collections.Specialized;

 

 

 

 

 private void test2()
        {


            // Enterprise Session Manager Variables  
            SessionMgr cdSessionManager = new SessionMgr();
            EnterpriseSession cdSession;
            String cdToken;
            String redirectURL;

            string url = "http://10.23.1.22:8080/BOE/OpenDocument/opendoc/openDocument.jsp";

            String documentCUID = "8013";
            NameValueCollection qsCollection = HttpUtility.ParseQueryString(Request.Url.Query);
            if (qsCollection["DocCUID"] != null)
                documentCUID = qsCollection["DocCUID"];
            // Create Logon Token for use with Open Document method  
            try
            {
                // logon to CMS & return the active session  
                cdSession = cdSessionManager.Logon("wc01", "123456", "10.23.1.22:6400", "secEnterprise");
                // create the security token for this logon  
                // The createLogonToken method allows you to specify the machine that can use the token (which  
                // can be empty to allow any user to use the token), the number of minutes the token is valid for, and  
                // the number of logons that the token can be used for as parameters.  
                cdToken = cdSession.LogonTokenMgr.CreateLogonTokenEx("", 5, 1);
                cdSession.Logoff();
                // now we use the token to build a URL to view the document with OpenDocument  
                // Response.Redirect("http://<InfoviewServer>/OpenDocument/opendoc/opendocument.aspx?token=" + ceToken + "&iDocID=" + reportid)  
                redirectURL = url + "?&iDocID=" + HttpUtility.UrlEncode(documentCUID) + "&sIDType=ID&token=" + HttpUtility.UrlEncode(cdToken);
                //注意这里如果是CUID:  &sIDType=CUID , String documentCUID = "AfMNWtn2xv1Oli1JRVbnuXc";
                //注意这里如果是ID:    &sIDType=ID ,   String documentCUID = "8013";
                Response.Redirect(redirectURL, false);
                HttpContext.Current.ApplicationInstance.CompleteRequest();

            }
            catch (Exception err)
            {
                string errorMessage = "Error in: " + Request.Url.ToString() +
                "\nError Message:" + err.Message.ToString();
                EventLog.WriteEntry("DSOpenDOcBridge", errorMessage, EventLogEntryType.Error);
                Server.ClearError();
            }  

        }

 

 

 

 

 

注意事项:

一、VS2010需要应用2个SAP的DLL连接库,但是这2个dll,不要复制到项目中,让网站从系统目录取。

 

二、IIS的主机HOST文件中,一定要加入BO服务器名称和IP,才能顺利cdSessionManager.Logon 。这个问题困扰了我2天。

 

 

 

 

 

 


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

刘欣的博客

你将成为第一个打赏博主的人!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值