Muchas gracias Ka0stj ya logre que mi codigo funcione, solo hize una pequeña modificacion. Dejo el ejemplo por si alguien mas tiene el mismo problema:
Código vb:
Ver originalImports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports SAP.Middleware.Connector
' Para permitir que se llame a este servicio Web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la siguiente línea.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class CallRFC
Inherits System.Web.Services.WebService
Private _ecc As RfcDestination
<WebMethod()> _
Public Function GetCompayName(ByVal companyID As String) As String
Try
_ecc = RfcDestinationManager.TryGetDestination("ECDCLNT140")
If (_ecc Is Nothing) Then
RfcDestinationManager.RegisterDestinationConfiguration(New ECCDestinationConfig())
_ecc = RfcDestinationManager.GetDestination("ECDCLNT140")
End If
Catch ex As Exception
System.Console.WriteLine(ex.Message)
System.Console.ReadLine()
End Try
' System.Console.WriteLine(String.Format("Successfully connected to System {0} Client {1}.", _ecc.SystemID, _ecc.Client))
' System.Console.WriteLine("Enter a company ID:") ' Ingresar el ID: 000880
' Dim companyID As String = System.Console.ReadLine()
While Not String.IsNullOrEmpty(companyID.Trim)
Dim companyAPI As IRfcFunction = _ecc.Repository.CreateFunction("BAPI_COMPANY_GETDETAIL")
companyAPI.SetValue("COMPANYID", companyID)
companyAPI.Invoke(_ecc)
Dim companyName As String = companyAPI.GetStructure("COMPANY_DETAIL").GetString("NAME1")
If String.IsNullOrEmpty(companyName.Trim) Then
companyName = "Not found 1"
End If
Return companyName
companyID = System.Console.ReadLine()
End While
End Function
End Class