Skip to Content
avatar image
Former Member

using dot net connector in VS-2005 and in VB

I have been using dotnet connector 2.0 in VS-2003 . When installed it gets added in tool box and It allows only development of proxies in C# .

Now I would like to use it in VS-2005 in VB .

Can anyone pl Help me in this regard

Thanks in advance

Bhat

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    May 15, 2007 at 05:00 AM

    Hai,

    I am suggesting u to use webservice to connect to .net.Web services is the best way to connect between SAP and .Net. SAP even came up with.NET connector. .NET connector works well with vs2003 as it was developed in around 2003. but it has certain complication when working with vs2005. Web services will be good option as it does not need any .net connectors to deal with.

    check this link for more details about .net and sap connection using web services

    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/1615ef47-0a01-0010-a7a8-b8a2a7b78776 [original link is broken]

    Regards

    Nissy

    Please reward me points if this is useful

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for the help extended

      I have written webservice using sap dot net connecto 2.0 in VS2003 . It is working fine all WIN2003 servers except in production where it is not giving any error , but not fetching data from SAP .

      My webservice code is as under

      Can you please analyse and tell where is the mistake ...

      Which port sap dot net connector uses to connect to SAP ?

      Strange thing is ..If I give wrong password , iT gives error (i.e it is connecting to SAP ) . However why it is not fetching data ?

      using System;

      using System.Collections;

      using System.ComponentModel;

      using System.Data;

      using System.Diagnostics;

      using System.Web;

      using System.Web.Services;

      namespace sapwebapplication

      {

      /// <summary>

      /// Summary description for SapWebService.

      /// </summary>

      [WebService(Namespace="http://Bharatpetroleum.com/SAPwebservices/")]

      public class SapWebService : System.Web.Services.WebService

      {

      protected sapwebapplication.SAPProxy2 sapProxy21;

      //protected sapwebapplication.SAPProxy1 VendornameCls;

      protected sapwebapplication.SAPProxyVendDetails VendornameCls;

      protected sapwebapplication.SAPProxyTourAdvance VendorLineItems;

      protected sapwebapplication.SAPProxyKeyDateBalance VendorKeyBalance;

      public SapWebService()

      {

      //CODEGEN: This call is required by the ASP.NET Web Services Designer

      InitializeComponent();

      sapProxy21=new SAPProxy2(Application.Get("ConnectionStringSapRetail").ToString());

      //VendornameCls=new SAPProxy1(Application.Get("ConnectionStringSapRetail").ToString());

      VendornameCls=new SAPProxyVendDetails(Application.Get("ConnectionStringSapRetail").ToString());

      //new methods from Bhat on 13/3/07

      VendorLineItems =new SAPProxyTourAdvance(Application.Get("ConnectionStringSap").ToString());

      VendorKeyBalance= new SAPProxyKeyDateBalance(Application.Get("ConnectionStringSap").ToString());

      }

      #region Component Designer generated code

      //Required by the Web Services Designer

      private IContainer components = null;

      /// <summary>

      /// Required method for Designer support - do not modify

      /// the contents of this method with the code editor.

      /// </summary>

      private void InitializeComponent()

      {

      }

      /// <summary>

      /// Clean up any resources being used.

      /// </summary>

      protected override void Dispose( bool disposing )

      {

      if(disposing && components != null)

      {

      components.Dispose();

      }

      base.Dispose(disposing);

      }

      #endregion

      // WEB SERVICE EXAMPLE

      // The HelloWorld() example service returns the string Hello World

      // To build, uncomment the following lines then save and build the project

      // To test this web service, press F5

      [WebMethod(Description="Vendor Existance Check ...Returns true/false",EnableSession=true , CacheDuration=0 , BufferResponse=true )]

      public bool Bapi_Vendor_Existencecheck(string VendorCode )

      {

      int VendorCodeLength = VendorCode.Length;

      int BalanceZeros =10-VendorCodeLength;

      int pad =0;

      for (pad=0;pad < BalanceZeros ; pad=pad+1)

      VendorCode="0" + VendorCode;

      sapwebapplication.BAPIRET1 returnobj=new BAPIRET1();

      sapProxy21.Bapi_Vendor_Existencecheck( "1000" , VendorCode ,out returnobj);

      if (returnobj.Message.Length>0)

      return false;

      else

      return true;

      }

      [WebMethod(Description="Vendor Name for Vendor Code ...Returns Vendor Name for vendor code (If vendor code doesn't exists it will return 'Not Found' ",EnableSession=true , CacheDuration=0 , BufferResponse=true )]

      public string Bapi_Vendor_Getdetail_name(string VendorCode )

      {

      int VendorCodeLength = VendorCode.Length;

      int BalanceZeros =10-VendorCodeLength;

      int pad =0;

      for (pad=0;pad < BalanceZeros ; pad=pad+1)

      VendorCode="0" + VendorCode;

      sapwebapplication.BAPIRET1 returnobj=new BAPIRET1();

      sapProxy21.Bapi_Vendor_Existencecheck( "1000" , VendorCode ,out returnobj);

      if (returnobj.Message.Length>0)

      return "Not Found";

      else

      {

      sapwebapplication.BAPIVENDOR_05 companydetail;

      sapwebapplication.BAPIVENDOR_04 generaldetail;

      sapwebapplication.BAPIRET1 returntbl=new BAPIRET1();

      sapwebapplication.BAPIVENDOR_06Table tbl6=new BAPIVENDOR_06Table();

      VendornameCls.Bapi_Vendor_Getdetail("1000",VendorCode,out companydetail,out generaldetail,out returntbl,ref tbl6);

      return generaldetail.Name;}

      }

      }

      }

  • avatar image
    Former Member
    May 15, 2007 at 05:09 AM

    i have already developed a .net project with SAP. for that if u r using .net connector

    it is supporting VS2003 but in the case of VS2005 it will not work properly.. so better you use webservice, it will support in both cases.. if you want further help you can contact me..

    go through this link

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5bc7e899-0e01-0010-cca9-84f45118dd17

    if this points helped you,give me reward point..

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks for the help extended

      I have written webservice using sap dot net connecto 2.0 in VS2003 . It is working fine all WIN2003 servers except in production where it is not giving any error , but not fetching data from SAP .

      My webservice code is as under

      Can you please analyse and tell where is the mistake ...

      using System;

      using System.Collections;

      using System.ComponentModel;

      using System.Data;

      using System.Diagnostics;

      using System.Web;

      using System.Web.Services;

      namespace sapwebapplication

      {

      /// <summary>

      /// Summary description for SapWebService.

      /// </summary>

      [WebService(Namespace="http://Bharatpetroleum.com/SAPwebservices/")]

      public class SapWebService : System.Web.Services.WebService

      {

      protected sapwebapplication.SAPProxy2 sapProxy21;

      //protected sapwebapplication.SAPProxy1 VendornameCls;

      protected sapwebapplication.SAPProxyVendDetails VendornameCls;

      protected sapwebapplication.SAPProxyTourAdvance VendorLineItems;

      protected sapwebapplication.SAPProxyKeyDateBalance VendorKeyBalance;

      public SapWebService()

      {

      //CODEGEN: This call is required by the ASP.NET Web Services Designer

      InitializeComponent();

      sapProxy21=new SAPProxy2(Application.Get("ConnectionStringSapRetail").ToString());

      //VendornameCls=new SAPProxy1(Application.Get("ConnectionStringSapRetail").ToString());

      VendornameCls=new SAPProxyVendDetails(Application.Get("ConnectionStringSapRetail").ToString());

      //new methods from Bhat on 13/3/07

      VendorLineItems =new SAPProxyTourAdvance(Application.Get("ConnectionStringSap").ToString());

      VendorKeyBalance= new SAPProxyKeyDateBalance(Application.Get("ConnectionStringSap").ToString());

      }

      #region Component Designer generated code

      //Required by the Web Services Designer

      private IContainer components = null;

      /// <summary>

      /// Required method for Designer support - do not modify

      /// the contents of this method with the code editor.

      /// </summary>

      private void InitializeComponent()

      {

      }

      /// <summary>

      /// Clean up any resources being used.

      /// </summary>

      protected override void Dispose( bool disposing )

      {

      if(disposing && components != null)

      {

      components.Dispose();

      }

      base.Dispose(disposing);

      }

      #endregion

      // WEB SERVICE EXAMPLE

      // The HelloWorld() example service returns the string Hello World

      // To build, uncomment the following lines then save and build the project

      // To test this web service, press F5

      [WebMethod(Description="Vendor Existance Check ...Returns true/false",EnableSession=true , CacheDuration=0 , BufferResponse=true )]

      public bool Bapi_Vendor_Existencecheck(string VendorCode )

      {

      int VendorCodeLength = VendorCode.Length;

      int BalanceZeros =10-VendorCodeLength;

      int pad =0;

      for (pad=0;pad < BalanceZeros ; pad=pad+1)

      VendorCode="0" + VendorCode;

      sapwebapplication.BAPIRET1 returnobj=new BAPIRET1();

      sapProxy21.Bapi_Vendor_Existencecheck( "1000" , VendorCode ,out returnobj);

      if (returnobj.Message.Length>0)

      return false;

      else

      return true;

      }

      [WebMethod(Description="Vendor Name for Vendor Code ...Returns Vendor Name for vendor code (If vendor code doesn't exists it will return 'Not Found' ",EnableSession=true , CacheDuration=0 , BufferResponse=true )]

      public string Bapi_Vendor_Getdetail_name(string VendorCode )

      {

      int VendorCodeLength = VendorCode.Length;

      int BalanceZeros =10-VendorCodeLength;

      int pad =0;

      for (pad=0;pad < BalanceZeros ; pad=pad+1)

      VendorCode="0" + VendorCode;

      sapwebapplication.BAPIRET1 returnobj=new BAPIRET1();

      sapProxy21.Bapi_Vendor_Existencecheck( "1000" , VendorCode ,out returnobj);

      if (returnobj.Message.Length>0)

      return "Not Found";

      else

      {

      sapwebapplication.BAPIVENDOR_05 companydetail;

      sapwebapplication.BAPIVENDOR_04 generaldetail;

      sapwebapplication.BAPIRET1 returntbl=new BAPIRET1();

      sapwebapplication.BAPIVENDOR_06Table tbl6=new BAPIVENDOR_06Table();

      VendornameCls.Bapi_Vendor_Getdetail("1000",VendorCode,out companydetail,out generaldetail,out returntbl,ref tbl6);

      return generaldetail.Name;}

      }

      }

      }

  • avatar image
    Former Member
    May 31, 2007 at 11:28 PM

    Check this, SAP Explorer Tool Window for VStudio 2005:

    SAPToolshttp://www.rafaelc.net/saptools.aspx">SAPTools>

    Add comment
    10|10000 characters needed characters exceeded