on 08-19-2006 2:54 AM
Dear All,
I try to explore the .NET Connector recently.
There is a need to build a legacy software that used BAPI
mining the data from SAP.
I follow the instruction to generate proxy in VS2003 and used it in VS2005.
But i stuck in some problem in proxy generation is VS2003.
This is the step and problems i had :
1. I create a new VB project in VS2003
2. I add an item SAPProxy1.sapwsdl
3. I check it in Object browser and found it
4. I test it in my coding with :
dim myProxy as SAPProxy1
5. It works fine
6. I drag n drop the BAPI Node to the design form of
SAPProxy1.sapwsdl
7. Then I got message :
The SAPProxy1 is not define
8. I check the object browser and it's gone
9. Everytime I add the BAPI to design, or save, or compile
The SAPProxy1 class become unusable.
Please help me.
Any help would be very appreciated.
Best Regards,
Harry.P
the problems is solved
add the API methode to designer not the bapi object
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think SAP Proxy coding should be there in C# laguage.
Try it.
Thanks & Regards,
Govind.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Govindaraju A
As I examine the SAPProxy1.vb code i found something strange
Here is the first newly added SAP Proxy
As we can see there is
Public Class SAPProxy1
Inherits SAPClient
The full code :
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a SAP. NET Connector Proxy Generator Version 2.0
' Created at 8/22/2006
' Created from Windows
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
Imports System
Imports System.Text
Imports System.Collections
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Imports System.Xml.Serialization
Imports System.Xml.Schema
Imports System.Web.Services
Imports System.Web.Services.Description
Imports System.Web.Services.Protocols
Imports SAP.Connector
'@ <summary>
'@ Client SAP proxy class
'@ </summary>
<WebServiceBinding(Name:="dummy.Binding", Namespace:="urn:sap-com:document:sap:rfc:functions")> _
Public Class SAPProxy1
Inherits SAPClient
'@ <summary>
'@ Initializes a new SAPProxy1.
'@ </summary>
Public Sub New()
End Sub
'@ <summary>
'@ Initializes a new SAPProxy1 with a new connection based on the specified connection string.
'@ </summary>
'@ <param name="connectionString">A connection string (e.g. RFC or URL) specifying the system where the proxy should connect to.</param>
Public Sub New(ByVal ConnectionString As String)
MyBase.New(ConnectionString)
End Sub
'@ <summary>
'@ Initializes a new SAPProxy1 and adds it to the given container.
'@ This allows automated connection mananged by VS component designer:
'@ If container is disposed, it will also dispose this SAPClient instance,
'@ which will dispose a contained connection if needed.
'@ </summary>
'@ <param name="Cont">The container where the new SAPClient instance is to be added.</param>
Public Sub New(ByVal Cont As Container)
MyBase.New(Cont)
End Sub
End Class
After I add some bapi to the designer
The code become
'------------------------------------------------------------------------------
' <autogenerated>
' This code was generated by a SAP. NET Connector Proxy Generator Version 2.0
' Created at 8/22/2006
' Created from Windows
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------
Imports System
Imports System.Text
Imports System.Collections
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Imports System.Xml.Serialization
Imports System.Xml.Schema
Imports System.Web.Services
Imports System.Web.Services.Description
Imports System.Web.Services.Protocols
Imports SAP.Connector
'@ <summary>
'@ Client SAP proxy class
'@ </summary>
<WebServiceBinding(Name:="dummy.Binding", Namespace:="urn:sap-com:document:sap:rfc:functions")> _
Public Class ZBapiForBill
Inherits SAPClient
'@ <summary>
'@ Initializes a new ZBapiForBill.
'@ </summary>
Public Sub New()
End Sub
'@ <summary>
'@ Initializes a new ZBapiForBill with a new connection based on the specified connection string.
'@ </summary>
'@ <param name="connectionString">A connection string (e.g. RFC or URL) specifying the system where the proxy should connect to.</param>
Public Sub New(ByVal ConnectionString As String)
MyBase.New(ConnectionString)
End Sub
'@ <summary>
'@ Initializes a new ZBapiForBill and adds it to the given container.
'@ This allows automated connection mananged by VS component designer:
'@ If container is disposed, it will also dispose this SAPClient instance,
'@ which will dispose a contained connection if needed.
'@ </summary>
'@ <param name="Cont">The container where the new SAPClient instance is to be added.</param>
Public Sub New(ByVal Cont As Container)
MyBase.New(Cont)
End Sub
'@ <summary>
'@ Remote Function Module Z_BAPI_GRDOC.
'@ BAPI Function - BillTrack - GR Document
'@ </summary>
'@ <param name="Return0"></param>
'@ <param name="Grdocno"></param>
'@ <param name="Grdocyear"></param>
'@ <param name="Grdocdata"></param>
<RfcMethod(AbapName := "Z_BAPI_GRDOC"), _
SoapDocumentMethodAttribute("http://tempuri.org/Z_BAPI_GRDOC", _
RequestNamespace := "urn:sap-com:document:sap:rfc:functions", _
RequestElementName := "Z_BAPI_GRDOC", _
ResponseNamespace := "urn:sap-com:document:sap:rfc:functions", _
ResponseElementName := "Z_BAPI_GRDOC.Response")> _
Public Overridable Sub ZBapiGrdoc ( _
<RfcParameter(AbapName := "GRDOCNO", RfcType := RFCTYPE.RFCTYPE_CHAR, Optional := false, Direction := RFCINOUT.IN, Length := 10), _
XmlElement("GRDOCNO", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByVal Grdocno As String, _
<RfcParameter(AbapName := "GRDOCYEAR", RfcType := RFCTYPE.RFCTYPE_NUM, Optional := false, Direction := RFCINOUT.IN, Length := 4), _
XmlElement("GRDOCYEAR", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByVal Grdocyear As String, _
<RfcParameter(AbapName := "RETURN",RfcType := RFCTYPE.RFCTYPE_STRUCTURE, Optional := true, Direction := RFCINOUT.OUT), _
XmlElement("RETURN", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByRef Return0 As BAPIRETURN, _
<RfcParameter(AbapName := "GRDOCDATA",RfcType := RFCTYPE.RFCTYPE_ITAB, Optional := false, Direction := RFCINOUT.INOUT), _
XmlArray("GRDOCDATA", IsNullable := False, Form := XmlSchemaForm.Unqualified), _
XmlArrayItem("item", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByRef Grdocdata As ZBAPI_GRDOC_STRTable)
Dim results As Object()
results = SAPInvoke("ZBapiGrdoc", new Object() { _
Grdocno,Grdocyear,Grdocdata })
Return0 = CType(results(0), BAPIRETURN)
Grdocdata = CType(results(1), ZBAPI_GRDOC_STRTable)
End Sub
'@ <summary>
'@ Overload of Remote Function Module Z_BAPI_GRDOC.
'@ BAPI Function - BillTrack - GR Document
'@ </summary>
'@ <param name="Grdocno"></param>
'@ <param name="Grdocyear"></param>
'@ <param name="Grdocdata"></param>
Public Overridable Sub ZBapiGrdoc ( ByVal Grdocno As String, ByVal Grdocyear As String, ByRef Grdocdata As ZBAPI_GRDOC_STRTable)
Dim results As Object()
results = SAPInvoke("ZBapiGrdoc",new Object() { _
Grdocno,Grdocyear,Grdocdata })
BapiReturn = CType(results(0), BAPIRETURN)
Grdocdata = CType(results(1), ZBAPI_GRDOC_STRTable)
End Sub
'@ <summary>
'@ Remote Function Module Z_BAPI_MMPL_GET_INHOUSE_STOCK.
'@ Function Module BAPI to Get InHouse Stock in Pick List Program
'@ </summary>
'@ <param name="Return0">Return Parameters</param>
'@ <param name="Matnr">Import PN</param>
'@ <param name="Sloc">Import Storage Location</param>
'@ <param name="TInhousestock">Inhouse Stock Data</param>
<RfcMethod(AbapName := "Z_BAPI_MMPL_GET_INHOUSE_STOCK"), _
SoapDocumentMethodAttribute("http://tempuri.org/Z_BAPI_MMPL_GET_INHOUSE_STOCK", _
RequestNamespace := "urn:sap-com:document:sap:rfc:functions", _
RequestElementName := "Z_BAPI_MMPL_GET_INHOUSE_STOCK", _
ResponseNamespace := "urn:sap-com:document:sap:rfc:functions", _
ResponseElementName := "Z_BAPI_MMPL_GET_INHOUSE_STOCK.Response")> _
Public Overridable Sub ZBapiMmplGetInhouseStock ( _
<RfcParameter(AbapName := "MATNR", RfcType := RFCTYPE.RFCTYPE_CHAR, Optional := false, Direction := RFCINOUT.IN, Length := 18), _
XmlElement("MATNR", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByVal Matnr As String, _
<RfcParameter(AbapName := "SLOC", RfcType := RFCTYPE.RFCTYPE_CHAR, Optional := true, Direction := RFCINOUT.IN, Length := 4), _
XmlElement("SLOC", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByVal Sloc As String, _
<RfcParameter(AbapName := "RETURN",RfcType := RFCTYPE.RFCTYPE_STRUCTURE, Optional := true, Direction := RFCINOUT.OUT), _
XmlElement("RETURN", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByRef Return0 As BAPIRETURN, _
<RfcParameter(AbapName := "T_INHOUSESTOCK",RfcType := RFCTYPE.RFCTYPE_ITAB, Optional := false, Direction := RFCINOUT.INOUT), _
XmlArray("T_INHOUSESTOCK", IsNullable := False, Form := XmlSchemaForm.Unqualified), _
XmlArrayItem("item", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByRef TInhousestock As ZBAPI_PL_INHOUSE_STOCK_STRTable)
Dim results As Object()
results = SAPInvoke("ZBapiMmplGetInhouseStock", new Object() { _
Matnr,Sloc,TInhousestock })
Return0 = CType(results(0), BAPIRETURN)
TInhousestock = CType(results(1), ZBAPI_PL_INHOUSE_STOCK_STRTable)
End Sub
'@ <summary>
'@ Overload of Remote Function Module Z_BAPI_MMPL_GET_INHOUSE_STOCK.
'@ Function Module BAPI to Get InHouse Stock in Pick List Program
'@ </summary>
'@ <param name="Matnr">Import PN</param>
'@ <param name="Sloc">Import Storage Location</param>
'@ <param name="TInhousestock">Inhouse Stock Data</param>
Public Overridable Sub ZBapiMmplGetInhouseStock ( ByVal Matnr As String, ByVal Sloc As String, ByRef TInhousestock As ZBAPI_PL_INHOUSE_STOCK_STRTable)
Dim results As Object()
results = SAPInvoke("ZBapiMmplGetInhouseStock",new Object() { _
Matnr,Sloc,TInhousestock })
BapiReturn = CType(results(0), BAPIRETURN)
TInhousestock = CType(results(1), ZBAPI_PL_INHOUSE_STOCK_STRTable)
End Sub
'@ <summary>
'@ Remote Function Module Z_BAPI_SODOC.
'@ BAPI Function - BillTrack - SO Document
'@ </summary>
'@ <param name="Return0"></param>
'@ <param name="Sodocno"></param>
'@ <param name="Sodocdata"></param>
<RfcMethod(AbapName := "Z_BAPI_SODOC"), _
SoapDocumentMethodAttribute("http://tempuri.org/Z_BAPI_SODOC", _
RequestNamespace := "urn:sap-com:document:sap:rfc:functions", _
RequestElementName := "Z_BAPI_SODOC", _
ResponseNamespace := "urn:sap-com:document:sap:rfc:functions", _
ResponseElementName := "Z_BAPI_SODOC.Response")> _
Public Overridable Sub ZBapiSodoc ( _
<RfcParameter(AbapName := "SODOCNO", RfcType := RFCTYPE.RFCTYPE_CHAR, Optional := false, Direction := RFCINOUT.IN, Length := 10), _
XmlElement("SODOCNO", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByVal Sodocno As String, _
<RfcParameter(AbapName := "RETURN",RfcType := RFCTYPE.RFCTYPE_STRUCTURE, Optional := true, Direction := RFCINOUT.OUT), _
XmlElement("RETURN", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByRef Return0 As BAPIRETURN, _
<RfcParameter(AbapName := "SODOCDATA",RfcType := RFCTYPE.RFCTYPE_ITAB, Optional := false, Direction := RFCINOUT.INOUT), _
XmlArray("SODOCDATA", IsNullable := False, Form := XmlSchemaForm.Unqualified), _
XmlArrayItem("item", IsNullable := False, Form := XmlSchemaForm.Unqualified)> _
ByRef Sodocdata As ZBAPI_SODOC_STRTable)
Dim results As Object()
results = SAPInvoke("ZBapiSodoc", new Object() { _
Sodocno,Sodocdata })
Return0 = CType(results(0), BAPIRETURN)
Sodocdata = CType(results(1), ZBAPI_SODOC_STRTable)
End Sub
'@ <summary>
'@ Overload of Remote Function Module Z_BAPI_SODOC.
'@ BAPI Function - BillTrack - SO Document
'@ </summary>
'@ <param name="Sodocno"></param>
'@ <param name="Sodocdata"></param>
Public Overridable Sub ZBapiSodoc ( ByVal Sodocno As String, ByRef Sodocdata As ZBAPI_SODOC_STRTable)
Dim results As Object()
results = SAPInvoke("ZBapiSodoc",new Object() { _
Sodocno,Sodocdata })
BapiReturn = CType(results(0), BAPIRETURN)
Sodocdata = CType(results(1), ZBAPI_SODOC_STRTable)
End Sub
End Class
The sapproxy constructor is missing.
So when i write :
dim myProxy as SAPProxy1
it generates error SAPProxy1 is not define
But i found the SAPProxy1.vb in solution explorer
The solution explorer for the SAPProxy like this :
-SAPProxy1.sapwsdl
|-SAPProxy1.vb
|-SAPProxy1.resx
|-ZBAPI_GRDOC_STR.vb
|-ZBAPI_GRDOC_STRTable.vb
|-ZBAPI_PL_INHOUSE_STOCK_STR.vb
|-ZBAPI_PL_INHOUSE_STOCK_STRTable.vb
|-ZBAPI_SODOC_STR.vb
|-ZBAPI_SODOC_STRTable.vb
Please help and advise
regards
Harry Poernomo
User | Count |
---|---|
76 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.