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

Similar Messages

  • User Defined Fields Form

    Hi Philipp,
    This is in reference to ur post Dated Jan13,2005. "Opening User Defined Fields Form via API".
    Is it possible for u to give a code snippet. what i'm unable to get is
    - Check if i can get a handle of the UDF-Form in the Mainform Activate-Event
    and
    -disable the close button
    Thanx in anticipation.
    Manu.

    Hi Manu,
    Here is a code snipet where looks for the related UDF form. The FormTypeNum´s value is the same as pVal.FormType property.
    Dim oUDFForm As SAPbouiCOM.Form
    Try
    oUDFForm = con.Forms.GetForm("-" + FormTypeNum.ToString.Trim, con.Forms.Item(FormUID).TypeCount)
    Catch ex As Exception
       con.ActivateMenuItem("6913")
       oUDFForm = con.Forms.GetForm("-" + FormTypeNum.ToString.Trim, con.Forms.Item(FormUID).TypeCount)
    End Try
    The other issue is solved in your other post.
    Regards,
    Ibai Peñ

  • Error -5002 when adding linked user defined field using DI API

    Hello,
    When I try to add a linked user defined field using DI API I get the error number -5002 with description:
    "The field 'Related Table' should consist of 8 alphanumeric characters with no valid or default values"
    I Get the error when I use the Add method.
    What is the solution for this problem? I use SBO 2005 A SP1 Patch 18
    The code I use is (.NET C# 2.0):
    SAPbobsCOM.IUserFieldsMD uf = (SAPbobsCOM.IUserFieldsMD)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    uf.Name = "S_BUCO";
    uf.TableName = "OPOR";
    uf.Type = SAPbobsCOM.BoFieldTypes.db_Memo;
    uf.SubType = SAPbobsCOM.BoFldSubTypes.st_Link;
    uf.LinkedTable = "S_BU";
    uf.Description = "Description";
    uf.Add()
    Regards,
    Jeffrey

    Hi Jeffrey,
    Your code above does not match the settings you are using in the UI. In particular, the type and subtype you are setting in code are not correct.
    To create the UDF via code, set the field types as follows:
    SAPbobsCOM.IUserFieldsMD uf = (SAPbobsCOM.IUserFieldsMD)company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields);
    uf.Name = "S_BUCO";
    uf.TableName = "OPOR";
    uf.Type = SAPbobsCOM.BoFieldTypes.db_Alpha;
    uf.EditSize = 8;
    uf.LinkedTable = "S_BU";
    uf.Description = "Description";
    uf.Add()
    There's no need to set the SubType property as you require a regular alphanumeric field.
    Kind Regards,
    Owen

  • Prevent closure of user defined field forms

    Hi.
    I need to prevent the closure of a user defined fields form while the parent form is opened. I can trap the et_FORM_UNLOAD before event but seems is too late to prevent the closure. Have anyone some idea about it?
    Ciao. Nicola

    Hi Martella,
    You need to do two things to achieve this.
    1. Make sure that when parent form is opened, the user defined field form is always opened at that same time.
    you can do that as follows
    If pVal.FormTypeEx = [Parent form type] And pVal.EventType = et_FORM_ACTIVATE Then
       Set oForm = SBO_Application.Forms.GetForm(-Val(pVal.FormTypeEx), pVal.FormTypeCount)
       If oForm Is Nothing Then
            If applic.Menus.Item("6913").Enabled = True And applic.Menus.Item("6913").Checked = False Then
               applic.Menus.Item("6913").Activate
            End If
       End If
    End If
    2. Disable the close button(X) on the user defined field form as follows:
    If pVal.FormTypeEx = [User defined form type] And pVal.EventType = et_FORM_LOAD And pVal.Before_Action = False Then
         Set oForm = SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
         Set oItem = oForm.Items.Item("4") ' Item 4 is close button
          oItem.Enabled = False
    End if
    Hope this helps.
    Satish.

  • Can't remove a user defined field with DI API.

    Hi,
    I'm using the code below to remove a user field.  However, the first time I run it, I get the message that:
    "Ref count for this object is higher then 0"
    The second time I run it, I get the message that:
    "No matching records found (ODBC -2028)"
    As you can see, I am killing the UserFieldsMD object.  In fact, when the function is entered, the object is nothing but later instantiated with oCompany.
    The result in both cases is that the field doesn't get removed.  What am I missing?  Any ideas?
    Thanks,
    Mike
        Public Function RemoveUserField(ByVal FieldName As String, ByVal TableName As String, ByRef ErrMsg As String) As Boolean
            Dim Result As Boolean = False
            Dim Err As Integer
            Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
            Try
                If Not FieldExists(TableName, FieldName) Then
                    Result = True
                Else
                    oUserFieldsMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields)
                    With oUserFieldsMD
                        .TableName = TableName
                        .Name = FieldName
                        Err = .Remove
                        If Err Then
                            oUtilCompany.GetLastError(Err, ErrMsg)
                            If ErrMsg = "No matching records found (ODBC -2028)" Then
                                Result = True
                            Else
                                ErrMsg = "Was not able to remove field " & FieldName & " from table " & TableName & " programmatically." & vbCrLf & _
                                         "Please remove it manually using the Tools menu."
                            End If
                        Else
                            Result = True
                        End If
                    End With
                End If
            Catch ex As Exception
                Throw ex
            Finally
                KillObject(oUserFieldsMD)
            End Try
            Return Result
        End Function
        Public Sub KillObject(ByRef Obj As Object)
            If Not Obj Is Nothing Then ObjectRelease(Obj)
        End Sub
        Private Sub ObjectRelease(ByRef Obj As Object)
            'This routine releases objects that were acquired with oCompany.GetBusinessObject().
            System.Runtime.InteropServices.Marshal.ReleaseComObject(Obj)
            Obj = Nothing
            GC.Collect()
        End Sub

    Hi Mike,
    The issue with your code is that you are not calling the GetByKey method of the field object. Until you do this the FieldID property is 0 so when the Remove method is called it will not try and remove the correct UDF (if you run SQL profiler then you'll see that SBO is looking for the UDF based on the table and fieldID values).
    Something like the following works for me:
    private void DeleteUDF(string sTableID, string sFieldName)
        SAPbobsCOM.UserFieldsMD sboField = (SAPbobsCOM.UserFieldsMD)_sboCompany.GetBusinessObject(BoObjectTypes.oUserFields);
        try
            int iFieldID = GetFieldID(sTableID, sFieldName);
            if(sboField.GetByKey(sTableID, iFieldID))
                if (sboField.Remove() != 0)_sboApp.SetStatusBarMessage("Error removing UDF: " + _sboCompany.GetLastErrorDescription(), SAPbouiCOM.BoMessageTime.bmt_Short, true);
        finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(sboField);
            sboField = null;
            GC.Collect();
    private int GetFieldID(string sTableID, string sAliasID)
        int iRetVal = 0;
        SAPbobsCOM.Recordset sboRec = (SAPbobsCOM.Recordset)_sboCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
        try
            sboRec.DoQuery("select FieldID from CUFD where TableID = '" + sTableID + "' and AliasID = '" + sAliasID + "'");
            if (!sboRec.EoF) iRetVal = Convert.ToInt32(sboRec.Fields.Item("FieldID").Value.ToString());
        finally
            System.Runtime.InteropServices.Marshal.ReleaseComObject(sboRec);
            sboRec = null;
            GC.Collect();
        return iRetVal;
    Note that the parameter sAliasID is the field name without the U_ prefix.
    Kind Regards,
    Owen

  • 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

  • Update User Defined Field using DBDataSource

    Hi All,
    I'm trying to update the user defined field using the DBDataSource object.  However an error occurred - "Item is not a User-Defined Field".
    The code used is as follows:
    Dim oDS as SAPbouiCOM.DBDataSource
    Dim oForm as SAPbouiCOM.Form
    Set oForm = SBO_Application.Forms.GetForm("139", 1)
    Set oDS = oForm.DataSources.DBDataSources.Item("ORDR")
    oDS.SetValue("U_Field1",oDS.Offset,"abc")
    Please help.

    If you haven´t put the field directly in the standard form the user defined fields are in a different form. This form has the same type but with "-" before it.
    So so should use this code to get the user defined fields form:
    Set oForm = SBO_Application.Forms.GetForm("-139", 1)
    Maybe this can be the cause

  • Accessing user defined fields when multiple forms as open SBO 2005

    Hi
    I have a program which updates a user defined field on the sales order screen. This works fine but fails to work correctly when they have more than one sales order screen open.
    It updates the first sales order screen and not the active one.
    Is there any easy way of accessing the correct user defined form which is attached to the active screen please ?
    Code below -
                For lc = 0 To B1Connections.theAppl.Forms.Count - 1
                    If B1Connections.theAppl.Forms.Item(lc).TypeEx = "-139" Then
                        form2 = B1Connections.theAppl.Forms.GetFormByTypeAndCount("-139", 1)
                        form2.Items.Item("U_bpremarks").Specific.string = orecset.Fields.Item(0).Value
                    End If
                Next
    Many thanks
    Regards Andy

    Hi Paul,
    you got the point - as long as you have always the udf screens open the count is the same !
    no need to say sorry
    iam relaxed - i have a EURO 08 livestream open
    lg David

  • Creating User Defined Fields via DI API

    Hello,
    Has anyone tried creating User Defined Fields via DI without direct database intervention ? My add on relies on some UDF's that have to be created on install.
    Thank you

    I regularly use the UI API to do this.  You can find several discussions on this forum.  I have not put this in my installation program, but I use UserFieldsMD in the DI API and a CSV file from Excel to store the information about the fields.

  • User defined fields via DI-API

    I want to read user defined fields using the DI-API.
    The following code works but lists only UDFs defined for articles:
    SAPbobsCOM.Items item =
    (SAPbobsCOM.Items) GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);     
    int count = item.UserFields.Fields.Count;
    MessageBox.Show("count == "+anzahl.ToString(), "OK");
    for(int i=0; i<count; i++){
      MessageBox.Show("index == "+i.ToString(), "OK");
      MessageBox.Show("name == "+item.UserFields.Fields.Item(i).Name, "OK");
    If I try to list all UDFs defined in the system using the oUserFields object I get an exception when I assign the business object:
    try{
      SAPbobsCOM.UserFields ufd = (SAPbobsCOM.UserFields)
      GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserFields); // exception
      int count = ufd.Fields.Count;
    catch(System.Exception ex){
      MessageBox.Show("ex.ToString(), "OK");
    The exception says something like
    InvalidCastException: COM object of type 'System.__ComObject' can not casted into
    interface type SAPbobsCOM.UserFields
    Thank you for help,
    Frank Romeni

    Hi Vítor,
    thank you for the hint to UserFieldsMD - now the access works.
    You wanted to know what I am trying to do - let me explain the background even it is a bit complicated:
    I have to access a certain UDF defined for articles.
    To access this UDF I can't use a fixed index like e.g. '5' in
    item.UserFields.Fields.Item(5).Value
    because this index is 5 only on my local machine - it could be a different index on the target machine.
    I solved this in writing some sql-code to access table CUFD and to find the index of this UDF in CUFD.FieldID.
    But sometimes there is a problem when there are UDFs deleted from the database. It is possible that there are 'holes' between the FieldId of UDFs of one object, e.g.
    Initial entries in CUFD (Table, FieldId, Name  => code to access field):
    OITM 0 'myUDF1'   ==> item.UserFields.Fields.Item(0).Value
    OITM 1 'myUDF2'   ==> item.UserFields.Fields.Item(1).Value
    OITM 2 'myUDF3'   ==> item.UserFields.Fields.Item(2).Value
    After deletion of 'myUDF2':
    OITM 0 'myUDF1'
    OITM 2 'myUDF3'
    Now the access to 'myUDF2' with item.UserFields.Fields.Item(2).Value fails!
    You have to use index '1' in .Item(index) to access 'myUDF2' because this UDF is now the second UDF in the item object (zero based).
    After I realized this I didn't use the sql-code to get FieldID any longer and searched with a loop all existing indices and compared them with the name of my special UDF, e.g. (this code works as expected):
    public int getUDFIndex(string udfName){
      index = -1;
      for(int i=0; i<item.UserFields.Fields.Count; i++{
        if(item.UserFields.Fields.Item(i).Name == udfName){
          index = i;
          break;
      return index;
    Now I tried to make this method more general to find UDFs in any object - not only in item objects.
    This is the background I wanted to access SAPbobsCOM.UserFields for.
    The problem is that UserFieldsMD has no method like Item(index) as I used it in my example.
    Do you have an idea to solve the problem with the 'holes' between FieldId in the UFD-table CUFD?
    Frank Romeni

  • Want to add a prepopulated User defined field in create user form

    Hi,
    I have an entity adapter which will perform a pre-insert check on the user group of the user logged in to the oim.
    If the logged in user belongs to a group say "IT ADMIN", another validation check will be imposed on the create user action performed by him.
    If not from "IT ADMIN" group then create user action will be handled normally.
    Now the catch is, how would I determine the group name of the user logged in from the adapter code I have written?
    I decided to keep an User defined field "Created by" in the create user form which will be non-editable and auto-prepopulated with the group name of the logged in user. This way I will be able to map the variable field from the User definition drop down list while mapping the adapter variables.
    May you please guide me how I can achieve this?
    Would highly appreciate suggestion/inputs.

    Thanks for all your replies!
    However I am still in dark.
    I tried to retrieve the groupname using tcUSerOperationsIntf. But iit tries to retrieve the group name of the user getting created.
    Please note, the group name I want is not of the user yet to get created, but that of the user creating it i.e., the logged in user.
    My requirement is to have this created_by field in the create user form already prepopulated with the group name of the logged in user.
    So that I can put a check based on this field value in the netity adapter.
    If the group is IT ADMIN then proceed with the validation.
    Else no validation required.
    In short, I want to know,how can I auto-prepopulate a UDF in Create USer form?

  • 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

  • User-Defined Fields and Form Settings

    I have a User-Defined Field in the table "OCLG" and I'd like to show it in the "Activities Overview for Business Partner - xxx" window.
    Is possibile to do that by the "Form Settings" window? Here I don't find U-D Fields. Is there a way to show them?
    Or is there an other solution?

    Hi,
    This report is hardcoded. You need to create your own report for it. Better by Crystal Report.
    Thanks,
    Gordon

  • Not found Users Form in User Defined Field Definition!!

    I want to add new filed into Users form, As my subject, but when I query "Users" in User Defined Field Definition, no result return, just exist Orgnizations, Roles, Resource Objects,Structure Utility.
    FYI, OIM Version: oim 11g
    Thanks,
    Edited by: 793495 on 2010-10-11 上午2:53

    this you can find in Web console
    configuration>>user configuration>>action>>attributes
    I am able to add attribute but not able to make field as mandatory,while creating attribute we are not getting option like that you want this field mandatory or not but while modifying the attribute we are getting option like required field radio button if i select that i am getting error "you cant change an attribute to required unless all the user have value for this field"

  • User defined fields in Resource object; Resource object form

    Hi,
    Can anyone tell me what is the purpose of having user defined fields for resource object and resource object form and how can we use those fields while requesting for target resource.
    Regards,
    Alabhya Goel

    Thanks for your reply!!!!!!!!!!
    I know about resource object form i am just asking what is the use of user define field in resource object form. How can we use it. Like when we create any user defined field in under User form those fields display on create user form but when we create any user defined field in resource object from those are not displayed in form.
    If anyone has used or worked on user defined fields in Resource Object or resource object form; please give me an overview over the same.
    Regards
    Alabhya Goel

Maybe you are looking for