【问题标题】:SAP .NET Connector, Connect to a Single RFC destination using multiple SAP user accountsSAP .NET 连接器,使用多个 SAP 用户帐户连接到单个 RFC 目标
【发布时间】:2014-10-17 13:35:20
【问题描述】:

我有一个 .Net 应用程序,用于通过它创建 SAP 销售订单。当我使用(普通)单个 SAP 用户帐户创建 rfcDestination 时,它可以完美地与多个用户一起使用。 但是当我使用登录用户的用户帐户时,它会出现以下异常。

RfcInvalidStateException:Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.Provider.SapException: destination MAQ is invalid ---> SAP.Middleware.Connector.RfcInvalidStateException: destination MAQ is invalid
   at SAP.Middleware.Connector.RfcFunction.Invoke(RfcDestination destination)
   at Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.Provider.SapConectionProvider.Invoke[T](IDataRequet request, String username, String password, IRfcFunction& rfcFunction)
   --- End of inner exception stack trace ---
   at Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.Provider.SapConectionProvider.Invoke[T](IDataRequet request, String username, String password, IRfcFunction& rfcFunction)
   at Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.SapDataRepository2.Invoke[T](IDataRequet request, String user, String password)
08:20:52.016 [23] ERROR General - ATP Check Exception:Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.Provider.SapException: destination MAQ is invalid ---> SAP.Middleware.Connector.RfcInvalidStateException: destination MAQ is invalid
   at SAP.Middleware.Connector.RfcFunction.Invoke(RfcDestination destination)
   at Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.Provider.SapConectionProvider.Invoke[T](IDataRequet request, String username, String password, IRfcFunction& rfcFunction)
   --- End of inner exception stack trace ---
   at Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.Provider.SapConectionProvider.Invoke[T](IDataRequet request, String username, String password, IRfcFunction& rfcFunction)
   at Portal.Infrastructure.Data.BoundedContext.ScreenPop.SAP.SapDataRepository2.Invoke[T](IDataRequet request, String user, String password)

只有当多个用户同时调用一个 rfc 时才会发生这种情况。

SAP .Net 连接器是否支持多个 SAP 用户帐户??

【问题讨论】:

    标签: asp.net-mvc asp.net-mvc-4 sap-dotnet-connector


    【解决方案1】:

    您需要使用 RfcCustomDestination 进行多次登录:

    web.config

      <configSections>
        <sectionGroup name="SAP.Middleware.Connector">
          <sectionGroup name="ClientSettings">
            <section name="DestinationConfiguration" type="SAP.Middleware.Connector.RfcDestinationConfiguration, sapnco"/>
          </sectionGroup>
        </sectionGroup>
      </configSections>
    
    
      <SAP.Middleware.Connector>
        <ClientSettings>
          <DestinationConfiguration>
            <destinations>
              <!-- multiple ways to do this ... -->
              <add NAME="DEV" SYSID="DEV" ASHOST="mysapashost.com" SYSNR="00" CLIENT="0000" LANG="EN" MAX_POOL_SIZE="5" IDLE_TIMEOUT="10" USER="anything it is not used" PASSWD="anything it is not used"/>
    
            </destinations>
          </DestinationConfiguration>
        </ClientSettings>
      </SAP.Middleware.Connector>
    
    
    </configuration>
    

    应用代码:

    private static RfcCustomDestination mydestination()
    {
        //"DEV" is the name of the destination in the web.config
        RfcDestination rfcDest = RfcDestinationManager.GetDestination("DEV");
    
        RfcCustomDestination _customDestination = rfcDest.CreateCustomDestination();
        _customDestination.User = "LoggedOnSAPUserid";
        _customDestination.Password = "LoggedOnSAPPassword";
    
        return _customDestination;
    }
    
    public string runMyRFC(string myInput)
    {
        RfcCustomDestination _customDestination = mydestination();
        IRfcFunction Results = _customDestination.Repository.CreateFunction("Z_SOME_RFC");
    
        Results.SetValue("RFCInput", myInput);
    
        Results.Invoke(_customDestination);
    
        string threResult;
    
        //. . .
    
        return theResult;
    
    }
    

    【讨论】:

    • 感谢您的回答,我试过了,但使用不同的 SAP login 得到了相同的结果。所以我将这个 RfcCustomDestination 与我的普通 SAP 用户一起使用,看起来它工作正常......因为我以前的方法也遇到了普通用户的上述异常。
    猜你喜欢
    • 1970-01-01
    • 2017-05-16
    • 1970-01-01
    • 2016-06-03
    • 1970-01-01
    • 1970-01-01
    • 2016-11-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多