Skip to Content
avatar image
Former Member

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,


Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 31, 2006 at 08:59 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • One more remark (maybe usefull for somebody): Perhaps you haven't found the Add (and Delete, indexer and so on) method of the SAPTables, because they don't appear in the Documentation - but the do appear in Intellisense.


      Because they are not implemented in the base class


      , but in each table class as part of your proxy. This is because we want these methods to be strongly typed.

      AddNew is different, because it belongs to IBindingList, so it appears in the docu.

      All in all SAPTables should have all features you need, including sorting, filtering, databinding, indexed access and so forth.

  • avatar image
    Former Member
    Jan 31, 2006 at 09:01 AM


    probably you have left some new fields empty. Specially numeric fields (e.g. decimal) have to be filled.

    Gerhard Rausch

    P.S.: Reiner was a little bit faster 😉

    Message was edited by: Gerhard Rausch

    Add comment
    10|10000 characters needed characters exceeded