Reputation: 4958
I have a .Net application which use to create SAP sales orders through it. When I used a (common)single SAP user account to create the rfcDestination it works perfectly with multiple users. But when I use user accounts of the logged in user it gives following exception.
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)
And this only happened when multiple users calling a rfc at the same time.
Does SAP .Net connector supports for multiple SAP user accounts??
Upvotes: 0
Views: 5945
Reputation: 41
You'll need to use RfcCustomDestination for multiple logons:
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>
app code:
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;
}
Upvotes: 2