Can You Export Data From Sharepoint to Sap
- Updated engagement Jul xv, 2015
- 16.1k
- 0
In this article you will learn how to integrate SharePoint using .NET.
Contents
- Introduction
- Pre-requisites
- Process
- Web.config 2
- User_Control.cs two
- Fetch Data from SAP two
- Submit the data to SAP 3
- Exceptions Expected and solution to information technology 4
Introduction
There tin exist a scenario where we need to fetch data from SAP and submit the updates to SAP using the functions given by the SAP squad from the SharePoint screen.
To enable the preceding we will exist writing .Net code using NCo3015_Net40_x64 MSI.
Pre-requisites
- Ensure the following ports are opened from the entore SharePoint front end and app servers to the SAP Server:
3200, 3201, 3300, 3301, 3600, 3601
- SQL port 1433 to be opened between SharePoint front finish and app servers to SQL Server.
- Download SAP NCO 3.0 bundle (NCo3015_Net40_x64 MSI) and install it on all servers (Development, UAT, Production [Front Cease, App, Distributed Enshroud and and so on (if any) servers]). One time installed, the following folder would be created and four DLL files are copied to that
C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net40_x64
Procedure
- Open Visual Studio 2012.
- Create an Empty SharePoint Project.
- Add a User Control then phone call the user command in the Visual Web Part.
- Copy the four DLL files from C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net40_x64 to the awarding's bin folder (C:\inetpub\wwwroot\wss\Virtualdirectories\<Port Number>\bin).
- Add a reference of sapnco.dll and sapnco_utils.dll to the project from the bin folder.
- Write lawmaking in the User Command. The following lawmaking volition just connect to SAP and fetch/submit the data. No Business logic is covered here.
- Deploy / Public the WSP file on the App server (or respective server) and web application.
Web config
Add the following entry in the appsettings of the web.config file location at the application bin folder (C:\inetpub\wwwroot\wss\Virtualdirectories\<Port Number>\web.config).
Note: For product, these entries are required on all Front end Stop server'due south web.config file.
- <add key= "SAPIP" value= "20.Xxx.20.XX" />
- <add key="SAPUSERID" value= "XXXX" />
- <add fundamental="SAPPWD" value= "XXXX" />
- <add key="SYSTEMNO" value= "XX" />
User_control.cs
Fetch information from SAP
- RfcConfigParameters rfc =new RfcConfigParameters();
- rfc.Add(RfcConfigParameters.Proper noun,"mySapName" );
- rfc.Add(RfcConfigParameters.AppServerHost, ConfigurationManager.AppSettings["SAPIP" ].ToString());
- rfc.Add(RfcConfigParameters.Customer,"700" );
- rfc.Add together(RfcConfigParameters.User, ConfigurationManager.AppSettings["SAPUSERID" ].ToString());
- rfc.Add(RfcConfigParameters.Countersign, ConfigurationManager.AppSettings["SAPPWD" ].ToString());
- rfc.Add(RfcConfigParameters.SystemNumber, ConfigurationManager.AppSettings["SYSTEMNO" ].ToString());
- rfc.Add(RfcConfigParameters.Language,"EN" );
- rfc.Add(RfcConfigParameters.PoolSize,"5" );
- rfc.Add(RfcConfigParameters.PeakConnectionsLimit,"10" );
- rfc.Add(RfcConfigParameters.ConnectionIdleTimeout,"500" );
- RfcDestination rfcDest = RfcDestinationManager.GetDestination(rfc);
- RfcRepository rfcRep = rfcDest.Repository;
- IRfcFunction function = rfcRep.CreateFunction("<<SAP Function Name>>" );
- IRfcTable UserInfo = function.GetTable("<<SAP Table to Read>>" );
- function.SetValue("Field1" , txtTextBox.ValidationDate);
- function.SetValue("Field2" , Page.Request.QueryString[ "xxx" ].ToString());
- function.SetValue("Field3" , txtTextBox3.Text.ToString());
- function.Invoke(rfcDest);
Submit the data to SAP
- RfcConfigParameters rfc = new RfcConfigParameters();
- rfc.Add(RfcConfigParameters.Proper name,"mySapName" );
- rfc.Add(RfcConfigParameters.AppServerHost, ConfigurationManager.AppSettings["SAPIP" ].ToString());
- rfc.Add together(RfcConfigParameters.Client,"700" );
- rfc.Add(RfcConfigParameters.User, ConfigurationManager.AppSettings["SAPUSERID" ].ToString());
- rfc.Add together(RfcConfigParameters.Countersign, ConfigurationManager.AppSettings["SAPPWD" ].ToString());
- rfc.Add(RfcConfigParameters.SystemNumber, ConfigurationManager.AppSettings["SYSTEMNO" ].ToString());
- rfc.Add together(RfcConfigParameters.Linguistic communication,"EN" );
- rfc.Add(RfcConfigParameters.PoolSize,"5" );
- rfc.Add(RfcConfigParameters.PeakConnectionsLimit,"ten" );
- rfc.Add(RfcConfigParameters.ConnectionIdleTimeout,"500" );
- RfcDestination rfcDest = RfcDestinationManager.GetDestination(rfc);
- RfcRepository rfcRep = rfcDest.Repository;
- IRfcFunction function = rfcRep.CreateFunction("<<SAP submit Role Name>>" );
- IRfcTable tabular array = function.GetTable("<<SAP Tabular array to update>>" );
- DataTable dtmodified = (DataTable)Session["xxxxx" ];
- foreach (DataRow row in dtmodified.Rows)
- {
- table.Append();
- table.SetValue("field1" , "Value1");
- table.SetValue("field2" , "Value2");
- table.SetValue("field_n" , "Value_n");
- }
- function.Invoke(rfcDest);
Exceptions expected and solution to it
- Could not load a file or associates sapnco.dll / sapnco_utils.dll.
Solution
Ensure to re-create the four DLLs from C:\Program Files (x86)\SAP\SAP_DotNetConnector3_Net40_x64 to the application bin folder (C:\inetpub\wwwroot\wss\Virtualdirectories\<Port Number>\bin).
- SharePoint 2013 layouts pages breaking with "Exception 'Microsoft.ApplicationServer.Caching.DataCacheException: ErrorCode:SubStatus:The asking timed out".
SolutionRun the following Power Beat script to increase the response time.
First run the following commands to see the health of the distributed cache that includes the status.
- $SPFarm = Get-SPFarm
- $cacheClusterName ="SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
- $cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
- $cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName)
- $cacheClusterInfo
- $settings = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
- $settings.ChannelOpenTimeOut =10000
- $settings.RequestTimeout=10000
- Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache -DistributedCacheClientSettings $settings
- $settingsverify = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
- $settingsverify
- $settingsa = Become-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
- $settingsa.ChannelOpenTimeOut = 10000
- $settingsa.RequestTimeout=10000
- Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache -DistributedCacheClientSettings $settingsa
- $settingsaverify = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
- $settingsaverify
- $set = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
- $set.MaxBufferSize = 33554432
- Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache -DistributedCacheClientSettings $set up
- Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
- $set = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
- $set.MaxBufferSize = 33554432
- Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache -DistributedCacheClientSettings $set
- Go-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
- SAP.Middleware.Connector.RfsCommunicationException: Location CPIC (TCP/IP) on the local host with Unicode Error Partner "xx.thirty.twenty.30:3301" not reached time. Connexion timeout counter.
Solution
Ensure the following ports are opened from the Front end Finish, App Servers to the SAP Server.
3200, 3201, 3300, 3301, 3600, 3601
Source: https://www.c-sharpcorner.com/UploadFile/krishna21e/sap-sharepoint-integration-using-net/
0 Response to "Can You Export Data From Sharepoint to Sap"
Enregistrer un commentaire