Ejemplo Código Conexión .NET Con SAP

2

Click here to load reader

Transcript of Ejemplo Código Conexión .NET Con SAP

Ejemplo cdigo conexin Visual .NET con SAP Connector 3.0:Imports SAP.ConnectorImports SAP.Middleware.ConnectorPartial Class _DefaultInherits System.Web.UI.PageProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.ClickDim Conexion As RfcConfigParameters = New RfcConfigParameters()Conexion.Add(RfcConfigParameters.Name, TEST)Conexion.Add(RfcConfigParameters.AppServerHost, 192.168.10.11)Conexion.Add(RfcConfigParameters.SystemNumber, 00)Conexion.Add(RfcConfigParameters.User, User)Conexion.Add(RfcConfigParameters.Password, Pass)Conexion.Add(RfcConfigParameters.Client, 200)Conexion.Add(RfcConfigParameters.Language, EN)Conexion.Add(RfcConfigParameters.PoolSize, 10)Conexion.Add(RfcConfigParameters.IdleTimeout, 10)Dim ConxSap As RfcDestination = RfcDestinationManager.GetDestination(Conexion)TryDim repositorio As RfcRepository = ConxSap.Repositoryllamada a la funcion zrfc_Dim sd As IRfcFunction = repositorio.CreateFunction(ZRFC_EMP_SD_ESUCLI)Asignando valoressd.SetValue(I_NAME3, TextBox1.Text)sd.SetValue(I_NAME4, TextBox2.Text)Enviando valoressd.Invoke(ConxSap)Label1.Text = sd.GetString(E_KUNNR)Label2.Text = sd.GetString(E_NAME1)Label3.Text = sd.GetString(E_NAME2)Catch ex As ExceptionMsgBox(ex.Message.ToString)End TryEnd Sub