Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tables in the RFC web serice from .net

I am trying to call the RFC webservice in SAPWS 6.2, calling from .NET using the Web Reference functionality not the .NET adaptor. I get the the simple function module calls with imports and export working just fine, however when I try to call a service that returns a table, like

SD_RFC_CUSTOMER_GET, the web reference creates a public sub instead of a public function, and I cannot get the data returned. I trace the call on the ICM in SAP and actually see the data coming in in a different, I actually think the issue is in the way I am calling the

web service from .NET.

Does anyone have sample code of a call to a RFC web service receiving and returning a table?

Thanks

Stephen Taylor

Former Member
replied

Hello Stephen,

sorry for the long delay. I had to test this in detail.

It seems that I was going into the wrong direction: The WSDL that I get from our internal test System is the same and also doesn't contain any of the "unqualified" schema tags. But the following code nicely works:

RfcCustomerGet.SD_RFC_CUSTOMER_GETService service = new TestIndexedProperty.RfcCustomerGet.SD_RFC_CUSTOMER_GETService();
            service.Credentials = new System.Net.NetworkCredential("user", "password");
            RfcCustomerGet.RFCCUST[] result = new RfcCustomerGet.RFCCUST[0];
            service.SD_RFC_CUSTOMER_GET(ref result, "", "A*");
            this.dataGridView1.DataSource = result;
        }

The important line here is "RfcCustomerGet.RFCCUST[] result = new RfcCustomerGet.RFCCUST[0];", which initializes the result array as empty array. I don't know the exactly VB syntax for it, but I'm sure that you find it out.

If I don't do it, but initilize the array to null / Nothing as in your code snipped, the Application Server doesn't return any information.

Hope that solves the problem.

Regards,

Reiner.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question