Skip to Content
0
Former Member
Jul 17, 2009 at 01:42 PM

UDT -1120 "Ref count for this object is higher than 0"

2853 Views

Hi,

I am inserting new table and I get error -1120 "Ref count for this object is higher than 0"

I have read following ticket: [meaning-of-error-msg-ref-count-for-this-object-is-]

But I get the error on my first Table???

The code is below.

Thank you,

Rune

SAPbobsCOM.UserTablesMD oUserTablesMD = (SAPbobsCOM.UserTablesMD)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserTables);

                oDataTable_TABLE = o_DataSet_XML_UdtUdfData.Tables["TableName"];

                vm_ROW_Count_int = oDataTable_TABLE.Rows.Count - 1;

                for (vm_ROW_Counter_int = 0; vm_ROW_Counter_int <= vm_ROW_Count_int; vm_ROW_Counter_int++)
                {
                    o_DataRow_TABLE = oDataTable_TABLE.Rows[vm_ROW_Counter_int];
                    oUserTablesMD.TableName = o_DataRow_TABLE["Name"].ToString();
                    oUserTablesMD.TableDescription = o_DataRow_TABLE["Description"].ToString();

                    if (oUserTablesMD.TableName != "")
                    {
                        vm_Error_Message_string = "Import of Table Failed: " + o_DataRow_TABLE["Name"].ToString();

                        vc_ADD_MessageNumberResult_Int32 = oUserTablesMD.Add();

                        if (vc_ADD_MessageNumberResult_Int32 == 0)
                        {
                            #region Log Import of Table Sccessed 
                            

                            #endregion
                        }
                        else
                        {
                            #region Log Import of Table Failed

                            oCompany.GetLastError(out vmp_B1_Error_Code_int, out vmp_B1_Error_Message_string);
                            string Test = vmp_B1_Error_Message_string;

                            #endregion
                        }
                    }
                }

                System.Runtime.InteropServices.Marshal.ReleaseComObject(oUserTablesMD);
                oUserTablesMD = null;