Change UDF field on system form to enabled = false

When doing this, it works fine (on the item master form).  The udfs that I don't want to be editable are disabled (grayed out).  But as soon as anything is typed into ANY field on any pane in the main form or into any of my editable UDFs, the disabled fields immediately become enabled again!  (If I listen for key-down on a field & redisable my UDFS it works, and further entry into any field does not affect the enabled status!  This is obviously no solution, though.  There might be over a hundred fields on this form and it's impratical to listen for key down on all of them!)
I'm doing this as a proof of concept, and if we get it right, we're likely to sell this customer SAP B1, so I'd really like to get this right!
So, searching the forum, I see something about SetAutoManagedAttribute & I try setting the editable attribute to false for these fields.  That line of code crashes:
item2.SetAutoManagedAttribute(BoAutoManagedAttr.ama_Editable, SAPbouiCOM.BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_False)
with a message: "Exception from HRESULT: 0xFFFFE4A2."
(NO text with ANY of these HRESULT messages - where can i find info on them?)
I thought maybe the problem was that I can't use the SET feature for UDFS so I've tried it on the itemcode field itself and this bombs out too!
        <B1Listener(BoEventTypes.et_MENU_CLICK, False)> _
        Public Overridable Sub OnAfterMenuClick(ByVal pVal As MenuEvent)
            Dim form As Form
            form = B1Connections.theAppl.Forms.ActiveForm
            Dim it As Item = form.Items.Item("5")
            Dim pl As Integer = form.PaneLevel
            If pl <> 1 Then
                form.Freeze(True)
                form.PaneLevel = 1
                form.Freeze(False)
                Try
                    it.SetAutoManagedAttribute(BoAutoManagedAttr.ama_Editable, SAPbouiCOM.BoAutoFormMode.afm_Ok, BoModeVisualBehavior.mvb_True)
                Catch ex As Exception
                End Try
            End If
            If form.PaneLevel <> pl Then
                form.Freeze(True)
                form.PaneLevel = pl
                form.Freeze(False)
            End If
(I saw another post on the forum about not being able to change the visible attribute unless the current pane contained the field being changed, so that's why I'm trying to switch it & switch it back and I've tried the SET command without the panelevel switch and I always get the same error)
PS I'm at p16  - THANK YOU!

Hi John,
Do the UDFs have to be on the Item Master window itself (ie can they be left on the UDF tab)?
Would this work as a solution?...
Use the UDF settings to create 2 different UDF categories and assign the 2 different sets to these categories. Then, when the user selects a particular item, your add-on can check the item group and automatically change the UDF category to reflect the correct item group. Sure, it doesn't set the other fields to inactive but it does hide them from the user. Only issue would be if you have other UDFs that are generic (ie non-group specific) as you can only assign a UDF to a single category.
Kind Regards,
Owen

Similar Messages

  • How to change UDF value in system form if its invisible or inactive?

    Hi all,
    I need to compute some document total values and save them on UDFs defined on Sales Order Header document, when the user adds a new order line.
    However I must not allow the user to change them (or see them). Also, there are other UDFs on the Sales Order Header that the user must be allowed to change...
    Is there any way to control this? If I set a UDF as not 'Active', I cannot change its value with programming.
    I'm using the following command to change a UDF value on the Sales Order form:
                        Form form = B1Connections.theAppl.Forms.GetForm("-139", pVal.FormTypeCount);
                        EditText et = (EditText)form2.Items.Item("U_TotalTax1").Specific;
                        et.Value = "10";     // this raises an exception "Form item is not editable"
    Is there any other way to change this UDF contents (maybe with datasources? etc)
    Thanks all,
    Manuel Dias

    Hi You can Enable/Disable the item after your transaction. follows the code
    oForm.Items.Item("U_TotalTax1").Enabled = True
    oEdit.value=10
    oForm.Items.Item("U_TotalTax1").Enabled = False
    Try this
    Manmath

  • How can we add Text field on system form which is updateable?

    Hi Experts
    I Want to create text field on System Form like A/R Invoice, in which I can store value after saving the document. I means Updateable field. Is it possible and How?
    Thanks
    Regards
    Gorge

    Hi Gorge,
    Please follow Jeyakanthan instructions. You may know how to create a UDF but you clealy don't understant how they work.
    A UDF in the System document's Title table is always updatable, unless you define it otherwise or do not have permission to update it (Open the form where you created the UDFs and press CTRL + ALT + B to open the definitions form).
    A UDF in the System document's Rows table is always updatable ONLY if that document's rows are updatable AND if you set them as updatable (via Form Settings) and have permission.
    On a User Form, you make your own rules!
    Regards,
    Vítor Vieira

  • User Defined Fields on System Form

    Dear All,
                   I want to know that how much User Defined Fields can be added on a system form. My problem is that I am developing an add-on for the Item Master Data. And I have used a lot of User Defined Fields on Item Master Data Forms which contains table 'OITM'. Now if I am trying to add any extra User Defined fields in OITM Table, I am not able to do so. I am getting an error as  'Internal Error Occurred'. What can i do regarding this problem.?  Help me. It is something very important.
    Thanks and Regards

    Hi,
    There is theoretically no limit on the number of UDF for a table. there is however a maximum number of characters for a record in SQL Sever.
    As far as I know this is 4000 in SQL Server 2005 and older and 8000 in SQL Server 2008.
    pls check Microsoft for the exact numbers
    Regards
    Ad

  • How to prevent user from changing a field on a Form.

    I have a form and a report on the same page. The form is used to set criteria for the report. So after the criteria is entered on the form a button is clicked, which passes the criteria to the report. The form also displays some additional data based on the criteria, i.e. I do a query on the form.
    The problem I'm having is preventing the user from changing the additional data which is displayed. I tried all the wizzard options; i.e. not updatable, not insertable etc. but the user can still change the data.
    The only options seems to be writting some Java code for one of the triggers, but I haven't written any Java before.
    So I was wondering if anyone has a non-Java solution for this problem or an example of a Java program I could use to solve the problem.
    Thanks for any help
    Larry

    Hi,
    Suppose you want Empno, Sal fields of Employee table as Query only and all other fields user updateable then
    uncheck all the three check boxes
    Mandatory , Updatable , Insertable under validation options for those fields.
    When you run the form, these fields appear as text items in query mode and will appear labels once the querying done.
    Hope it works
    Madhav

  • System form UDF

    i want to catch an event on click on udf in a system form.
    how i will catch...
    how i will get item id for udf in system form.
    oForm = SBO_Application.Forms.ActiveForm
                     oedit2 = oForm.Items.Item("U_EmpCode").Specific()  <---- Error
    or simply i want to assign value in udf... but i got error.
    Regard,
    Avijit

    If pVal.FormType = "-60100" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
                Try
                    Dim oedit2 As SAPbouiCOM.EditText
                    oForm = SBO_Application.Forms.ActiveForm
                    oedit2 = oForm.Items.Item("U_EmpCode").Specific() <----
                Catch ex As Exception
                    MsgBox(ex.Message)
                End Try
                '  oedit2 = oForm.Items.Item("U_EmpCode").Specific()
            End If
    petr ,
    i have udf in employee master date.
    but still it is through error....

  • I created new table in database and want to bind with system form

    Hi All,
    1) i created new table in database and want to bind with system form .
    2) How i bind this field to system form sale order where i added new folder tab in that i added some fields that fields i want to bind with database. when i click on the next ,previous ,first and last button
    bind value should change.
    Awaiting soon reply
    Rajkumar G.

    hi,
    try this
    Public Sub BindDataToForm()
            Dim oItem As SAPbouiCOM.Item
            Dim oEdit As SAPbouiCOM.EditText
            Dim oComboBox As SAPbouiCOM.ComboBox
            '// getting the matrix column by the UID
            'oItem = oForm.Items.Item("docname")
            'oComboBox = oItem.Specific
            'oComboBox.DataBind.SetBound(True, "OSRI", "BaseType")
            'oItem = oForm.Items.Item("docno")
            'oEdit = oItem.Specific
            'oEdit.DataBind.SetBound(True, "OSRI", "BaseEntry")
            oColumn = oColumns.Item("Code")
            'oColumn.DataBind.SetBound(True, "", "DSCardCode")
            oColumn.DataBind.SetBound(True, "OSRI", "ItemCode")
            oColumn = oColumns.Item("Serial")
            oColumn.DataBind.SetBound(True, "OSRI", "IntrSerial")
            Try
                oColumn = oColumns.Item("Inspection")
                oColumn.DataBind.SetBound(True, "OSRI", "U_Inspection")
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
            oColumn = oColumns.Item("Quality")
            oColumn.DataBind.SetBound(True, "OSRI", "U_Quality")
            oColumn = oColumns.Item("Status")
            oColumn.DataBind.SetBound(True, "OSRI", "U_Status")
            oColumn = oColumns.Item("Finish")
            oColumn.DataBind.SetBound(True, "OSRI", "U_Finish")
            oColumn = oColumns.Item("Thickness")
            oColumn.DataBind.SetBound(True, "OSRI", "U_Thickness")
            oColumn = oColumns.Item("uom")
            oColumn.DataBind.SetBound(True, "OSRI", "U_NetUOM")
            oColumn = oColumns.Item("length")
            oColumn.DataBind.SetBound(True, "OSRI", "U_Length")
            oColumn = oColumns.Item("height")
            oColumn.DataBind.SetBound(True, "OSRI", "U_Height")
            oColumn = oColumns.Item("sqf")
            oColumn.DataBind.SetBound(True, "OSRI", "U_sqf")
            oColumn = oColumns.Item("sqm")
            oColumn.DataBind.SetBound(True, "OSRI", "U_sqm")
        End Sub

  • Hiding items in system form by changing record

    Hi,
    I have on system form textbox binded to UDF. If user change the record, the textbox is not showing. I know about possibility to catch events like form_load, resize and data_load where I can set visible to true to this textbox, but my question is, if exists some better method how to say to SBO that this field will be always visible.
    thx
    Petr

    I found the problem, in some forms in diferent modes is set diferent panelevel...

  • How can I change the tax formula in system form ?

    Hi,
      Usually the tax is extra-added for 5% in calcaulating.
      But now I need to change the formula of tax to be embeded.
      How can I change the tax formula in system form ?
                                           Besr regard!

    Great!
    I suppose "Speed-button" is the same as "toolbar button", right?
    To all (more or less):
    It confirms that I am on the right track when I bother the participants in this forum time-after-time with remarks to train themselves - or get trained - in application + customization features (+ SDK).
    Of course as developers we can use the SDK for whatever purpose and try to develop additional functionality - ... that might already be there, but we just don't know about it
    In addition the power of customization features (UDFs/UDTs/queries/formatted searches (also bound to fields on SAP Business One forms)...) should not be underestimated!!!
    When starting development with SDK you - or the person who writes the specifications for an Add-On must IMHO be familiar with the application + the customization features + being trained with SDK to avoid unnecessary development or getting into trouble latest when the solution is shipped to a customer...
    Please again note that there's a lot of eLearning available in the education area in the SMB Portal on SAP Service Marketplace.
    Regards,
    Frank

  • Enable/disable fields in Workspace form

    Okay here is my scenario. I need to disable some fields on a form depending on which user logs onto workspace to open the same form.
    1. User1 logs onto workspace and opens leave request form, fields at the top of the form are enabled for the user to fill out, bottom fields which are for leave request administrator to fill out are disabled but visible.
    2. User1 fills out top portion of leave request form and completes form. Workflow sends form to leave request administrators "To do" list in Workspace.
    3. Administrator opens up submitted form in Workspace and sees User1's filled out data on the form and the bottom fields are now enabled for administrator to approve or dissaprove. Bottom fields only include two check boxes, two text fields and one date field.
    Now how is this done? I am sure their maybe scripting involved? if so what is it and at what events in the form? Is this whole process done in the form or through Admin UI or Workebench as well? Please help!!!!!!!!!

    Hi Rahat,
    You can use the same form and enable/disable some fields according to the user's role with only little scripting. Review the steps the below:
    1-First place a hidden field ("user_role") in your form
    2-Insert a script object into your form onder "Variables" in object hierarchy and write a script for enabling/disabling the fields (regarding the value of "user_role")
    3-On the initialize and change events of the "user_role" call your script object
    4-On your process design, put a SetValue service before User tasks. In the asssignment you should set the desired user_role to the form, so that the script is triggered in your form and the fields are enabled/desiabled
    Fro further needs on your form or process design you can contact us from: http://www.kgc.com.tr/company_Contact.html
    Oguz
    http://www.kgc.com.tr

  • Updating a user text field in sap system form in Find Mode

    Dear All,
                    I created a Edit text field in Sap System form [FormType :149] -Sales Quotation. I want to update a value to the text while clicking OK button in Find Mode. the code is given below.
    If pVal.ItemUID = "1" And pVal.FormMode = SAPbouiCOM.BoFormMode.fm_FIND_MODE And (Not pVal.Before_Action) And pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK Then
            oForm = SBO_App.Forms.Item(FormUID)
            oForm.Freeze(True)
            oItem = oForm.Items.Item("txtUID") 
            oEdit = oItem.Specific
            oRS = ConSBOdb.Execute("Select * from BG_CAMPAIGNSHDR where CMIDENT ='" & Trim(oEdit.Value) & "'")
            oItem = oForm.Items.Item("txtCampgn")         ' //  User created field
            oItem.Enabled = False
            oEdit = oItem.Specific
            If oRS.EOF = False Then
                oEdit.Value = oRS.Fields("CMNAME").Value
            Else
                oEdit.Value = ""
            End If
    end if
    while clicking the OK button, Based on the value fetched on the screen, I have to open a recordset and get the value.  But, the screen loads the value to the system textboxes. I could not get those value to run the Sql  in the event. it returns empty. Could any one help please how to solve this ?
    Thanks in advance.
    Manikandan.

    Hi,
    Try This..
    If pVal.FormType = 149 And pVal.ItemUID = "1" Then
                If pVal.FormMode = SAPbouiCOM.BoFormMode.fm_FIND_MODE Then
                    If pVal.Before_Action = False Then
                        If pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED Then
                            Try
                                oForm = SBO_App.Forms.Item(FormUID)
                                oForm.Freeze(True)
                                oItem = oForm.Items.Item("txtUID")
                                oEdit = oItem.Specific
                                oRS = ConSBOdb.Execute("Select * from BG_CAMPAIGNSHDR where CMIDENT ='" & Trim(oEdit.Value) & "'")
                                oItem = oForm.Items.Item("txtCampgn") ' // User created field
                                oItem.Enabled = False
                                oEdit = oItem.Specific
                                If oRS.EOF = False Then
                                    oEdit.Value = oRS.Fields("CMNAME").Value
                                Else
                                    oEdit.Value = ""
                                End If
                            Catch ex As Exception
                                SBO_application.MessageBox(ex.Message)
                            End Try
                        End If
                    End If
                End If
            End If
    Best Regards,
    Mahendra

  • How to set the value to non enabled UDF fields

    Dear All,
    I created a UDF at titile level of PO and that UDF item always disabled (i.e oItem.Enabled=false). Now how can set a value through coding.
    I wrote like this:
    oForm = SBO_Application.Forms.GetFormByTypeAndCount(-142, 1);
                                oItem = oForm.Items.Item("U_Poap");
                                if (oItem.Enabled == false) { oItem.Enabled = true; }
                                oEdit = ((SAPbouiCOM.EditText)(oItem.Specific));
                                oEdit.Value = "1";
                                oItem.Enabled = false; 
    But system throws an error at : oItem.Enabled=true statement.
    How to solve issue.
    Thanks in advance
    Suresh Yerra

    Hi,
    You can set the values using datasource object
    oDBs_Head = objForm.DataSources.DBDataSources.Item("@TableName")
    oDBs_Head.SetValue("U_FieldName", 0, "Value")
    regards:
    SANDY
    Sandeep Saini | Roorkee | India on Dec 26, 2008 11:01 AM

  • Change the value of a field in a form when the form is displayed

    Hello
    I have a report which has a link to a form for updating the records. I have used a link to the form from report which displays the the record to be updated i.e it gets default values from the report. I need to change one of these values at the time of displaying the form. The set_value in the 'before displaying the page' section doesn't change the vaue displayed in the form. I tried in other 'Advanced pl/sql' sections provided but didn't succeed.
    Thank you
    Jayasree

    hi,
    let's call the new value u want to set "NewValue"
    insert this code in the before displayin' the page
    htp.p('<script language="Javascript1.1">
    function defaultValue(fieldname)
    var thefield;
    for( var v=0; v < document.forms[0].elements.length; v++)
    // get the right field
    if (document.forms[0].elements[v].name.indexOf(fieldname) >= 0 )
    thefield = document.forms[0].elements[v];
                        thefield.value='''||NewValue||''';
    break;
    </script>');
    in the after displaying the page section call the function above with the appropriate field:
    htp.p('<script language=javascript1.1>
    defaultValue(''Field_Name'');
    </script>');
    where Field_name is the name of the field u want to change the value!
    Mohamed

  • How to change the fields in a JSF form based on a URL parameter

    I am trying to build a generic JSF form of parameters which I want to dynamically change (i.e.
    change which field is visible, what the label text should be, etc) based on a URL parameter.
    I can set the fields using logic in the backing bean as an action on a command button pressed.
    But how do I do it based on the URL parameter ? I can retrieve the URL parameter but I
    don't know where to put (or hook) the Java code to do this initialization prior to
    the page being rendered for the first time.
    The fields in the JSF is being configured dynamically using a database table.
    BTW I am using Jdeveloper 10.1.3.5
    Thanks
    CK

    Thanks. I decided to set a Session bean to store the value of the URL parameter (if it is set)
    and then to use the session bean to initialize the attributes of the fields on the JSF Page.
    There also seems to be some caching of the inputText fields (i.e. it reverts back to the first
    initialized value) even though I tried to change it using the URL parameter in the requestScope
    backing bean. So, setting the values into the Session bean and retrieving it back from there
    seems to be more reliable.

  • Passing Changed  extended fields using ALE-IDOC to receiving system

    Hi all,
    Please tell me how passing changed  extended fields using ALE-IDOC to receiving system can be achieved. Is it possible by Chnage pointer concept.Do i need to do some coading after data enters into receiving system as it is required while creating the entries in database table.
    For ex. in matmas05 extended for classification and inspection view and then created using 'CREATION'
    related bapi.Do i also need to incorporate the changes by change related bapi or ir can be handled by change pointer concept.
    Thanks.

    Hi Sanu
    1) Please tell me how passing changed extended fields using ALE-IDOC to receiving system can be achieved. Is it possible by Chnage pointer concept.
    => Looks like you have extended standard IDOC here. so you need to find User Exit or BADI for the Push program to populate the additional fields. Yes, it is possible thru change pointers as well.
    1) Do i need to do some coading after data enters into receiving system as it is required while creating the entries in database table.
    => Yes, as suggested in 1 try finding User Exits/BADIs.
    Regards
    Shital

Maybe you are looking for