Skip to Content
author's profile photo
Former Member

Setting initial values on structures

I have written a middle-ware wrapper which allows me to call a SAP RFC from SQL Server stored procedures. I am upgrading it from the DCOM to the .Net connector so I can run it on Windows 2003 Server.

When I set a string value (SAP C type) to initial I get the error "Object reference not set to an instance of an object." raised in the proxy object. This error does not happen for non-initial values, and also does not happen on my development workstation. It happens if I set the string to "" or to " ". It occurs on two servers - Windows 2000 and Windows 2003.

I can't figure out how to debug this, and can't find anything in this forum or on SAP Notes. Has anyone else found this error?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Aug 19, 2004 at 09:23 AM

    Setting a value to a string member will always work if the containing structure is a valid object. Please check if the structure reference is null?

    Can you paste a piece of your code?

    Regards,

    Guanwgei

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      A clear head in the morning makes all the difference. There was no problem with the .Net Connector.

      The problem lay with SQL Server's sp_OAMethod procedure, or possibly in the .Net component's CCW. If you pass an empty string in as an argument, your component gets a Nothing. I therefore fixed it in the component with:

      If Value Is Nothing Then Value = ""

      Thanks,

      Derek