Cannot remove user define fields

Hi,
I am trying to remove a user defined field (U_Prirev) in Table (OHEM) and am getting the following error:
Ref count for this object in higher then 0. Error No -1120
The code is as follows :
        Dim sRequete As String
        Dim errCode As Long
        Dim errMsg As String
        Dim IdField As Integer
        Dim oUFields As SAPbobsCOM.UserFieldsMD
        oUFields = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
        Dim oRecordSet As SAPbobsCOM.Recordset
        oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
        sRequete = "SELECT FieldID FROM CUFD where TableId = '" & pNomTable & _
                   "' and AliasID = '" & pNomChamp & "'"
        oRecordSet.DoQuery(sRequete)
        If (oRecordSet.EoF = False) Then
           IdField = CType(oRecordSet.Fields.Item(0).Value, Integer))
            If (oUFields.GetByKey(pNomTable, IdField) = True) Then
                If (oUFields.Remove() <> 0) Then
                    oCompany.GetLastError(errCode, errMsg)
                    Console.WriteLine("Erreur => Code = " & errCode.ToString + " Message = " + errMsg)
                End If
            End If
        End If
             System.Runtime.InteropServices.Marshal.ReleaseComObject(oUFields)
        oRecordSet = Nothing
    End Sub
Anyone knows why i am getting this error.
Thanks
Laurent.

Hi Laurent
That error you are getting is the error that you get is when there is more than one instance of meta data object open. You see only one metedata object can be open at a time.....if it's higher than zero it means others are available. I see you have,
System.Runtime.InteropServices.Marshal.ReleaseComObject(oUFields)
oRecordSet = Nothing
this is good and what closes the meta data object. But check that you have done this in previous funtions where you might of added other things.Also your recordset, close it before adding.....move oRecordSet = Nothing to before your Remove of the field. that has be the case for me before. Do it without the recordset as a test and you'll see it works.
Hope it helps

Similar Messages

  • How to remove User Defined field in programitically

    Hi,
           How to remove user defined field in programitically. send the code
    Thanks,
    P.Suresh Kumar

    Hi,
    Please take a look at this thread:
    Re: Can't remove a user defined field with DI API.
    Kind Regards,
    Owen

  • Cannot enable an user defined field as the type of link

    I created an user defined field and set it to the type of link. I want to link it to a external file.
    But only the "visible" checkbox of the UDF is available, the "enable" checkbox cannot be actived (displayed in grey).
    Can someone tell me how to do next?
    Thanks.

    I did a lot of tries but still failed.
    http://faculty.stut.edu.tw/~jywu/others/B1UDF1.JPG
    I want to know how to use the function marked in the red-box in the above link. What's that for?
    When i created a UDF using the setting, I can only set it visiable, cannot active it. 
    Furthermore, I cannot find any document expaining how to set these parameters in user defined field function.
    Can someone help me?
    Thanks.

  • User defined fields in Crystal layout

    Hi All,
    I want to add user defined field values in crystal  layout for Sales order, but its not listed in RDR1 tables there but it's available in SAP query manager view. How can i get that in Crystal reports. please suggest on this.
    Regards
    Sree

    You can then remove the key and the fields in the database will keep their correct definitions rather than varchar(max) which is causing the initial problems.
    Adding extra keys may uause performance issues if you leave them there for a large table.
    I have also had issues of varchar(max) fields causing database connection issues when running the reports in 8.81 PL07.
    Rob

  • Issue while deleting user defined field in oim 11.1.1.3

    All,
    Made a mistake while creating user defined field called "Profile for" (loing to OIM -> advanced -> configuration -> User configuration). We are trying to delete it. It appears to get deleted from user attributes screen. But when we run LDAP User Create and Update Reconciliation Task we get the following error below:
    oracle.iam.ldapsync.exception.ProcessLDAPReconDataException: oracle.iam.ldapsync.exception.ReconEventCreationException: Thor.API.Exceptions.tcAPIException: Profile for - LDAPUser object does not exists for resource object
    Is any thing else need to be deleted adn cleaned up?
    thanks in advance,
    Prasad.

    How do i check what resource object the recon task is running against. here is what i found so far.
    I cannot find LDAPUser resource object when i query Resource Management -> Resource Objects in design console. Same thing with Manage Resource and search (here i only find Xellerate User, Xellerate Organiztion, USERS_GTC, and Installation) in OIM advanced administration menu.
    The LDAP User Create and Update Reconciliation job itself has the following parameters (batch size, last change number, OIM employee type, OIM User organization name, OIM user type)
    I also decompiled LDAPUserChangesReconTask and it is looking for LDAPUser metadata from MDS directly.
    Prasad.

  • User-defined field assignment  in Contact object

    Good Day
    Experts:
    I guess this might apply to all SAP Business Objects.  Specifically, I am working with the oContact object.  A User-defined field has been added to the OCLG table.  I need to populate the field with the current logged on User.  I see that I can do the following with the intellisense but I am not sure where to go from here.
    vContact.UserFields.Fields.Item
    I tried but I get a message "Expression is a value and therefor cannot be the target of an assigment:
    vContact.UserFields.Fields.Item("U_Creator") = (GetUserCodeSess(g_B1Connection.Company.UserName))
    It feels like I should be able to set the User-defined variable through the object but I don't think I am doing it correctly.
    Any helpful hints?
    Thanks,
    Ed

    Hi Robert,
    I think the only supported way is to give full rights to the users and block changing field in the Item Master Data form through your addon.
    A non supported way is to use a query to update the item master fields
    Regards
    Ad

  • User Table Key set up in User defined field management

    Dear  Expert,
    what is use of User Table Key set up in User defined field management in SAP B1.
    Thanks.
    Sridharan.R
    Edited by: Sridharan.R on Oct 4, 2011 8:26 AM

    Hi,
    Once a UDF is created and a value is entered in it, the same cannot be retrieved in any of the layouts and reports unless a Key is generated for that UDF. By assigning a Key to that UDF, the same UDF can be used in Crystal Reports or any other Reporting tool to extract its values from SAP. These reporting tools searches the Uniqueness of the UDF Values with this Keys only.
    For eg.: When you develop a report and select a table from which you need the fields to be shown in the layout. In that, the only fields whose keys are generated are only available to use in the report.
    Hope its clear to you.
    Regards,
    Papil

  • OIM user defined field in process form

    I am trying to create a user defined field (UDF) in a process form. The UDF would be a drop down list of values for the status field.
    I've tried to do this by going to the Administration list, and double clicking on User Defined Field Definition. Then selecting the Form Designer. I can add a column but I cannot add values to the drop down. I know I'm probably doing this wrong.
    How do I add a UDF drop down and its values to a process form?
    Thanks!

    1. Create lookup table for the drop down contents.
    2.In the process form--->go to the properties tab-->select the User defined filed name-->add property--->property Name drop down list -->select lookup code-->in the property value-->provide the lookup table name-->save
    Edited by: user13513300 on Feb 24, 2011 1:45 AM

  • Binding a Check Box with a User Defined Field

    Hi everyone,
    i v created a user defined field (U_CheckPro)in the system table "OITM" with two values: Y for Yes and N for No. In relation to that i v also created a check box on the form "150" and would like to know how can i bind my checkbox with  my user defined field properly.
    The user would be than able to enable or disable the check box for each item (article). The user setting schould be than be active and valid in sbo-business logic, each time an item is selected. (for example in case of sales order ID 133, "OINV").
    Any helfpul hints? Samples would be welcome as well.
    Thanks and regards
    Alban

    > First of all you should remove the valid values
    > because checkboxes does not work with valid values...
    > Just give a default value.
    Hi Rasmus,
    thank you very much for your helpful hint. I guess my problem is solved by that - nevertheless here is my complete code sequence once again in case of possible errors.
    I would appreciate any additional suggestion for improvement of the same.
    Thanks and regards
    Alban
    >>>
    Private Sub AddItem()
            ' Test UserSource
            oForm.DataSources.UserDataSources.Add("U_CheckPro", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1)
            oItem = oForm.Items.Item("122")
            ' Adding a Static Text item
            oNewItem = oForm.Items.Add("StaticTxt2", SAPbouiCOM.BoFormItemTypes.it_STATIC)
            oNewItem.Left = oItem.Left + 20
            oNewItem.Width = 100
            oNewItem.Top = oItem.Top + 12
            oNewItem.Height = 25
            oNewItem.FromPane = oItem.FromPane
            oNewItem.ToPane = oItem.ToPane
            oNewItem.LinkTo = "CheckBox1"
            oStaticText = oNewItem.Specific
            oStaticText.Caption = "Test_Caption"
            ' Adding a Check Box item
            oNewItem = oForm.Items.Add("CheckBox1", SAPbouiCOM.BoFormItemTypes.it_CHECK_BOX)
            oNewItem.Left = oItem.Left
            oNewItem.Width = 20
            oNewItem.Top = oItem.Top + 15
            oNewItem.Height = 19
            oNewItem.FromPane = oItem.FromPane
            oNewItem.ToPane = oItem.ToPane
            oNewItem.DisplayDesc = False
            oCheckBox = oNewItem.Specific
            'binding check box to source
            oCheckBox.DataBind.SetBound(True, "OITM", "U_CheckPro")
        End Sub
    >>>

  • User defined Field Size limit

    Hi,
    would anyone know if there is a limit of the number of user defined fields that can be addeded to SAP Business One (2004A on SQL server 2000)?
    I think there is (in a diffrenet way). It looks like there is a maximmum byte size  - 8060.
    I have the following user fields already in the business partner master data screen .
    A - alphanumeric size = 50
    B - alphanumeric size = 20
    C - alphanumeric size = 20
    D - alphanumeric size = 20
    E - alphanumeric size = 254
    If I try to change B to size 254 ,This is the error message I get.
    "[CUFD] [Microsoft][ODBC SQL Server Driver][SQL Server] Warnning: The table 'ACRD' has been created but it's maximum row size 'User Fieds - Descr' (8522) exeeds the maximum number of bytes per row (8060)..."
    there is nothig else wqrong with the field exept I cannot make it size 254 (I can if I delete the field E though), so I definitely think it is SAP restricting the size. SQL Server does not have this size restriction. I can manually go and change the size using SQL Server Enterprise manager for example.
    I have managed to change the size directly on ACRD, and
    CUFD but dont thinks this is a very approprite way of handilng it.
    Is this an undocumented restriction/feature in SAP or have I missed reading about this ?
    Thanks in advance,
    Indika.

    Hi Spiros,
    I hope you are right. But I have experiences this with many atleast 3 other seperate installations. They were all SQL Server, ranging from Enterprise versio, to Developer version to standard.
    However I can directly change the size in SQL Server without an issue as I mentioned. This proves that this not an issue with SQL Server. Could it be some sort of a flag in the SAP? I get this on the SAP US demo company for example.
    If anyone else had the problem please do respond.
    Thanks,
    Indika

  • User Defined Fields greyed out for one user

    Hi Experts,
    One of our users is a Super User but on the Business Partner Master Data screen, the User Defined Fields are greyed out.
    This is user specific as the issue is happening for the same user on 2 seperate PCs.
    Other users can update these UDFs - any suggestions?
    Thanks
    Greig

    Hi
    take a look at this SAP Note :
    Cannot access settings for the user defined fields
    Symptom
    Cannot access settings for the User Defined Field(UDF)
    Other terms
    UDF, user defined field, sbo-udf, settings for UDF are inactive, the settings for the udf are greyed out.
    Reason and Prerequisites
    Need to use the Settings option to order the udf.
    In Tools -> User Defined fields -> Settings the option 'Settings' is greyed out and inactive.
    Solution
    If in Tools -> User Defined fields -> settings and this option is not available then return to the document and click anywhere in the main document window.
    Now return to Tools -> User Defined fields -> settings and this option will now be active.

  • User-Defined Fields Window

    Hi All,
    I have one issue with the User-Defined Fields window of the ACTIVITY form.
    I had added some user defined fields (UDF) to the Activities so that the User-Defined Fields are displaying in a separate window just near to the Activity window with Type (-651). All the UDFs are bound to the table, "OCLG".
    I want to initialize the values in the User defined fields controls with a text when the form is loading.
    I had tried to do this using
    oForm.Datasources.DBDatasources.Item("OCLG").SetValue("U_CUST",0,"MyValue");When I executed this statement, i am getting HResult error.
    Then I tried this by using UserDataSources.
    The same error repeats.
    But the code with .Specific.String = NewVal is working fine.
    Can you please explain the scenarios that we are able to do it using .Specifc.String. Is this a true method for doing this?
    if not
    please tell me How can we do this using Datasources (DBDatasources/ UserDataSources),?
    Please Help.
    Thank you in Advance
    Anoop

    Anoop,
    when you have created UDF in master item data, the textbox you can see on left side of form (separate form) is bounded already to this field. You cannot rebound it (its system form).
    When you want to change the value, you must use specific.string or specific.value for that textbox (as you wrote), but the calcualted value will be stored into master table (change of udf will set formmode to update mode). If you dont need to update formmode, set the formmode by code to normal mode.
    hope it helps
    Petr

  • User-defined fields in Enjoy transactions

    Hi,
    we have created two user-defined fields and added these in the entry variant for Enjoy transactions. However, we would like the fields to show with fewer characters. We have tried to reduce the length in the entry variant, but it seems that you cannot do this. We do not want to reduce the length of the field in the database.
    Is there any way around this?
    Thanks,
    Moly

    Hi,
    You should be able to do it via screen painter.
    Please check this help:-
    [http://help.sap.com/saphelp_nw04/helpdata/en/d1/801c3a454211d189710000e8322d00/content.htm]
    Also you should put this query in SAP ABAP forum, where you will get more appropriate answers.
    Regards,
    Gaurav

  • User Defined Fields/ XML loading problem

    hai,
    1. i can able to create user defined fields , but i need my fields are in UNIUQE KEY how can i achive through the
    VB Code. ?
    2. I load a XML form but i cant able to make it as fixed single form, or deactivate the minimize / maximaze button , how can i achive it through the VB Code?
    regards
    Thiru

    I don't think you can disable the min max button, but you can just remove them
    The following XML create a form that can't be Resize, maybe it can help you.
    <?xml version="1.0" encoding="UTF-16"?>
    <Application>
      <forms>
        <action type="add">
          <form AutoManaged="0" BorderStyle="6" FormType="60007" ObjectType="-1" SupportedModes="15" appformnumber="" client_height="119" client_width="60" color="0" default_button="" height="121" left="0" mode="1" pane="0" title="Toolbar Like" top="0" type="6" uid="Try" visible="1" width="160">
            <datasources>
              <dbdatasources>
                <action type="add" />
              </dbdatasources>
              <userdatasources>
                <action type="add" />
              </userdatasources>
            </datasources>
            <Menus />
            <items>
              <action type="add">
                <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="0" height="21" left="112" linkto="" right_just="0" supp_zeros="0" tab_order="0" text_style="0" to_pane="0" top="0" type="100" uid="Line1" visible="1" width="1">
                  <AutoManagedAttribute />
                  <specific />
                </item>
              </action>
            </items>
            <FormMenu />
            <DataBrowser />
          </form>
        </action>
      </forms>
    </Application>

  • Opening User defined Fields Form via API

    Hi
    Is there a posiibility to open those user defined field - forms via API. If yes is it possible to check if it is already open?
    TIA
    Phile

    Hi,
    In your eventhandler, you can use this:
    Set oSboForm = Sbo_application.Forms.GetFormByTypeAndCount(-pval.FormType, pval.FormTypeCount)
    form and udf-form are linked through a minus sign.
    I do not know of a nice way to check if they are anebled. What I'm currently doing is running the above line of code contained in an error handler. The error handler does a sendkeys of control shift u (which enables the udf-form) and displays a message. Problem is after control shift u, screen is not yet updated so your code cannot continue immediatelly. Development knows of this problem, but I never received a promise when this will be fixed.
    Hope this helps,
    Jacques

Maybe you are looking for