on 11-10-2008 3:19 AM
Hello,
I installed SAP .net connector 2.0.
When I try to finish the demo project : Code project: "Using the SAP.NET Connector to Connect your .NET Applications to SAP", I cannot find "SAP" node in my vs2003's service explore, even after I refresh the "Data Connections".
Sorry for I cannot post the picture.
I removed and repaired the SAP .net Connector 2.0, but the node still disappear.
Fortunately, I created a web application and can access SAP server through SAP login Form.
What I want to do is to access SAP server and invoke one function then get desired data to present in the web page.
But because I cannot process the drag & drop operation through Server explore, I have to modify SAPProxy.cs code.
For instance:
Pass one "IN" parameter "Airline_no", and "Out" parameter "Data" to reture a data records. the function name is "Z_RFC_READTAB"
-
public SAPProxy1(System.ComponentModel.IContainer container) : base(container) {}
[RfcMethod(AbapName = "Z_RFC_READTAB")]
[SoapDocumentMethodAttribute("http://tempuri.org/RFC_READ_TABLE",
RequestNamespace = "urn:sap-com:document:sap:rfc:functions",
RequestElementName = "Z_RFC_READTAB",
ResponseNamespace = "urn:sap-com:document:sap:rfc:functions",
ResponseElementName = "Z_RFC_READTAB.Response")]
public void Z_RFC_READTAB (
[RfcParameter(AbapName = "ARILINE_NO",RfcType=RFCTYPE.RFCTYPE_CHAR, Optional = true, Direction = RFCINOUT.IN, Length = 3)]
[XmlElement("ARILINE_NO", IsNullable=false)]
string Ariline_no,
[RfcParameter(AbapName = "IN_SPFLI",RfcType=RFCTYPE.RFCTYPE_ITAB, Optional = false, Direction = RFCINOUT.INOUT)]
[XmlArray("IN_SPFLI", IsNullable=false)]
[XmlArrayItem("TAB512", IsNullable=false)]
ref TAB512Table Data
)
{
object[]results = null;
results = this.SAPInvoke("Z_RFC_READTAB",new object[] {
Ariline_no,Data });
Data = (TAB512Table) results[0];
return;
}
-
and also create the corresponding class "TAB512Table" and "TAB512" by hand.
-
public class TAB512Table : SAPTable
{
public static Type GetElementType()
{
return (typeof(TAB512));
}
public override object CreateNewRow()
{
return new TAB512();
}
public TAB512 this[int index]
{
get
{
return ((TAB512)(List[index]));
}
set
{
List[index] = value;
}
}
public int Add(TAB512 value)
{
return List.Add(value);
}
public void Insert(int index, TAB512 value)
{
List.Insert(index, value);
}
public int IndexOf(TAB512 value)
{
return List.IndexOf(value);
}
public bool Contains(TAB512 value)
{
return List.Contains(value);
}
public void Remove(TAB512 value)
{
List.Remove(value);
}
public void CopyTo(TAB512[] array, int index)
{
List.CopyTo(array, index);
}
}
-
[RfcStructure(AbapName ="TAB512" , Length = 512)]
public class TAB512 : SAPStructure
{
[RfcField(AbapName = "CONNID", RfcType = RFCTYPE.RFCTYPE_CHAR, Length = 512, Offset = 0)]
[XmlElement("CONNID")]
public string INSPFLICONNID
{
get
{
return _INSPFLICONNID;
}
set
{
_INSPFLICONNID = value;
}
}
private string _INSPFLICONNID;
[RfcField(AbapName = "COUNTRYFR", RfcType = RFCTYPE.RFCTYPE_CHAR, Length = 512, Offset = 0)]
[XmlElement("COUNTRYFR")]
public string INSPFLICOUNTRYFR
{
get
{
return _INSPFLICOUNTRYFR;
}
set
{
_INSPFLICOUNTRYFR = value;
}
}
private string _INSPFLICOUNTRYFR;
-
Unfortunately, what I get is the whole data records but only one column.
For example: I need data like the following:
CityFrom CountryFR AIRPFROM
NY USA AAA
HK Canada CCC
but current i get the data like
CityFrom CountryFR AIRPFROM
NY..USA..AAA NY..USA.AAA NY..USA..AAA
HK Canada...CCC HK.Canada.CCC HK.Canada.CCC
Thank you very much! The first problem is solved.
I alway click the "refresh" button of "Servers" and forget to click "refresh" button of "Server Explore"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I guess that is because the class that i created by hand (TAB512, TAB512Table) have some problems. However I don't know how to figure out it.
So my question is:
1. How to let the SAP node appear in the server explore of VS2003 ( I also install VS 2005 and SAP Logon )
2. How to create the SAPStructure file by hand.
Thanks in advance!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.