Skip to Content
author's profile photo Former Member
Former Member

Exception: "Method xyz can not be reflected." in .Net Connector 2.0

Hi,

I have generated a proxy class with two RFC's. The first RFC has a table parameter with the same name and type as an export parameter of the second RFC.

When I create an object of the proxy class with "SAPProxy sap = new SAPProxy();" I get an exception "Method SAPProxy.Z_Rfc_Aenr_Suchen_Via_Ccart can not be reflected." where "Z_Rfc_Aenr_Suchen_Via_Ccart" is the name of the first RFC and the following inner exception

"The XML element named 'AENR_--5fRFC' from namespace '' references distinct types ZAENR_RFC and ZAENR_RFCTable. Use XML attributes to specify another XML name or namespace for the element or types.".

The generated code for the parameter of the first RFC is:

[RfcParameter(AbapName = "AENR_RFC",RfcType=RFCTYPE.RFCTYPE_ITAB, Optional = false, Direction = RFCINOUT.INOUT)]

[XmlArray("AENR_--5fRFC", IsNullable=false, Namespace="")]

[XmlArrayItem("item", IsNullable=false)]

ref ZAENR_RFCTable Aenr_Rfc)

and for the second RFC:

[RfcParameter(AbapName = "AENR_RFC",RfcType=RFCTYPE.RFCTYPE_STRUCTURE, Optional = true, Direction = RFCINOUT.OUT)]

[XmlElement("AENR_--5fRFC", IsNullable=false, Namespace="")]

out ZAENR_RFC Aenr_Rfc)

now when I change one of the XML Names from "AENR_ 5fRFC" to "AENR_ 5fRFC1" in the generated proxy class, the proxy class instantiates correctly, but that should not be the solution.

Is this a bug in .Net Connector 2.0? In Version 1 I didn't get this exception although the parameters where generated with the same name "AENR_RFC" (not "AENR_--5fRFC")

Thanks!

Markus

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Oct 07, 2004 at 07:53 AM

    Yes, sorry again a bug.

    I was fixing a special case where you have strange characters in ABAP names that are not supported in XML and forgot "_" which is an allowed char.

    In the moment you can fix it by replacing "_--5f" with "_", which should be perfectly Ok.

    I'll try posting a fix soon.

    Add a comment
    10|10000 characters needed characters exceeded

    • A fix for the problem is now available in OSS / SAP Service Marketplace note 506603. As the note is maintained in german, it might need time until the english version is up-to-date. In the meantime just open the german version of the note, take the attached ZIP files and extract it to your "%program files%\Microsoft Visual Studio .NET 2003\Common7\IDE" directory.

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2004 at 08:20 AM

    Hello Reiner,

    that explains the strange XML-Names, but it didn't solve my problem. When changing the xml name of one parameter to a unique name it works, but in NCO 1 it worked without changing the name.

    Markus

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 07, 2004 at 08:55 AM

    Hi,

    when comparing the proxy classes generated with NCO 1 and version 2, I found the difference that probably causes the problem.

    Each parameter of a RFM in Version 2 is marked with [XmlElement("XYZ", IsNullable=false, Namespace="")]. In the proxy class generated with version 1 "Namespace="" " is missing.

    Removing the Namespace property solves the problem. Under some circumstances the Namespace property in combination with my special RFM's - parameter obviously causes the reflection problem.

    What is the difference between setting the Namespace to "" and omitting it?

    Thanks!

    Markus

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.