Skip to Content

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

SAP .NET Connector, Method FromADOTable() crashed

Hi anyone,

I'm using SAP .NET Connector version 2.0 to access user tables and modify profile or group memberships with generated "USER" proxy object (i.e. RFC call to BAPI "USER") .

After calling the "USER.GetDetail" method I got a table with all activity group memberships of referenced user (type "SAP.Connector.SAPTable").

Then I try to convert this table into ADO datatable object using method "ToADODataTable". This works fine.

I add a new row to this table and have to save it into SAP.

myADOTable = myTable.ToADODataTable ();

currRow = myADOTable.NewRow ();

currRow["Agr_name"] = newMemberValue;

myADOTable.Rows.Add (currRow);

myTable.FromADODataTable (myADOTable);

If I try to convert ADO datatable back to corresponding SAPTable I get an exception like this "Der Objekttyp kann nicht zum Zieltyp konvertiert werden.".

Where is the mistake?

Thanks in advance for any ideas,


Former Member

ADO.NET tables are not typesafe, in contrast to SAPTables.

It can easily happen that you add something to ADO.NET table that cannot be casted to the type in the SAPTable.

Please check the new row with a debugger and check that all columns contain values with the type of the SAPStructure.

Another typical problem are colums that contain DBNull. This can never be casted to any target type (e.g. string).

BTW: Generally I would recommend to work directly with SAPTables instead of converting to and from DataTables.

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