Update UDT

Hi Experts,
I want to protect my udt using VB.net and SDK code so that the user can update it. The udt can only be updated by a certain super user i.e. manager.
Please help me to provide the code. I will appreciate it so much.
Rgds,
John

Hi
Try this
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
        Try
            Dim oForm As SAPbouiCOM.Form = SBO_Application.Forms.Item(FormUID)
            If (FormUID = "yourformuid") Then
                If (pVal.Before_Action = False) Then
                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD Then
                        'Here write your code
                        'if the user is not a super user then just disable all the controls in the form and set form mode to ok mode
                          Dim oSQLRS As SAPbobsCOM.Recordset = SBO_Application.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset)
                Dim SQLString As String
                SQLString ="SELECT T0.UserID FROM OUSR T0 WHERE T0.SUPERUSER = 'Y' "
                if  oSQLRS.DoQuery(SQLString) = SBO_Application.Company.UserName  then
              else
                      DisableForm(oForm)
                     oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE
                 end if
                    End If
                End If
            End If
        Catch ex As Exception
        End Try
    End Sub
Public Function DisableForm(ByVal _form As SAPbouiCOM.Form) As Boolean
            Try
                Dim itemCollection As ArrayList
                itemCollection = getItems(_form)
                Dim oItem As SAPbouiCOM.Item
                _form.Freeze(True)
                For Each tempLoopVar_oItem As SAPbouiCOM.Item In itemCollection
                    If tempLoopVar_oItem.Type = BoFormItemTypes.it_FOLDER Or tempLoopVar_oItem.Type = BoFormItemTypes.it_STATIC Or tempLoopVar_oItem.Type = BoFormItemTypes.it_LINKED_BUTTON Then
                        oItem = tempLoopVar_oItem
                        oItem.Enabled = True
                    Else
                        oItem = tempLoopVar_oItem
                        'for excluding button 1, 2 and txtTemp
                        If oItem.UniqueID = "1" Or oItem.UniqueID = "2" Or oItem.UniqueID = "txtTemp" Then
                            If oItem.UniqueID <> "txtTemp" Then
                                oItem.Enabled = True
                            End If
                        Else
                            oItem.Enabled = False
                        End If
                    End If
                Next
                _form.Freeze(False)
                Return True
            Catch ex As Exception
                MessageBox.Show(ex.ToString())
                _form.Freeze(False)
                Return True
            End Try
        End Function
Public Function getItems(ByRef _form As SAPbouiCOM.Form) As ArrayList
            Try
                Dim oItemCollection As New ArrayList()
                Dim oItem As SAPbouiCOM.Item
                For Each tempLoopVar_oItem As SAPbouiCOM.Item In _form.Items
                    oItem = tempLoopVar_oItem
                    oItemCollection.Add(oItem)
                Next
                Return oItemCollection
            Catch ex As Exception
                MessageBox.Show(ex.ToString())
                Return Nothing
            End Try
        End Function
for this code to work correctly place an edittext box in to your form with unique id txtTemp and set its width and hieght to 0
Regards
Arun

Similar Messages

  • DTW update UDT fields - Version 88.0.10

    Hello,
    I have already searched this forum for similar issues, but they only fit to older DTW-versions or UDO (masterdata or forms)
    We created an UDT (no object) with one UDF (text). So we kept our testenviroment as small as possible.
    Import runs without problems:
    Code;Name;U_toll
    1;1;blabla
    2;2;test
    But update doesnt work - DTW returns error message: "Can not find this object in B1Application-defined or object defined error65171":
    Code;Name;U_toll
    1;1;zzz
    2;2;ggg
    We also tried to update with LineNum (or #) and/or RecordKey:
    RecordKey;LineNum;Code;Name;U_toll
    1;1;1;1;zzz
    We also tried to update without Name or Code, nothing works.
    Does anyone have an idea, how to update data in UDT?
    Please note: DTW Version 88.0.10
    We use UDT (no object)
    We use .csv (same as import)

    Issue solved. Update of UDT data works correctly with DTW version 2005.0.19 !!!
    Older DTW-version works better than newer one (8.8).
    VERY annoying

  • Is it allowed to update UDT or UDF directly?

    Hi,
       I am having an issue using the DI to import into UDT and I was wondering if I can insert/update directly to UDF or UDT in SAP B1.
      Please let me know
    Thanks
    Hector

    Hi Hector,
    You can insert/update into UDT. It's your table.
    For UDF, it seems to be good to use the DI object to insert or update.
    Example :
    - Update an user fields in Quotations Object.
    oQuotations.Lines.UserFields.Fields.Item("U_IFC_SEL").Value = oEdit.Value;
    int ret = oQuotations.Update();
    - Insert data in UserTable :
    SAPbobsCOM.UserTable UT;
    UT = SBO_Company.UserTables.Item("IFC_AFF_TMP");
    UT.Code = oEd_DocEntry.Value + iLineNum.ToString() + i.ToString();
    UT.Name = oEd_DocEntry.Value + iLineNum.ToString() + i.ToString();
    int ret = UT.Add();           
    Hope i help you.
    Michael
    Edited by: Michael LECLERCQ on May 29, 2008 5:35 PM
    Edited by: Michael LECLERCQ on May 29, 2008 5:39 PM

  • Attempted to read or write protected memory. This is often an indication that other memory is corrupt SAP B1

    Dear All,
    While adding customization addon, the below error shows.
    The below credentials ,
    SAP B1 -- 9.0 Version
    Patch level -- PL 06
    DIAPI -- 32 bit (x86)
    "Attempted to read or write protected memory. This is often an indication that other memory is corrupt".
    Please fix this issue ASAP.
    Thanks & Regards,
    Bowya S S

    Hi,
    Please check SAP note:
    1988581 - Unable to update UDT
    Thanks & Regards,
    Nagarajan

  • How to update correctly a UDT at FORM_DATA_ADD

    Hi,
    When adding an item marketing document, my add-on has to update a UDT with all the lines in the document.
    I have placed the update of this UDT in the BeforeAction == false and ActionSuccess is true on et_FORM_ADD_DATE.
    But what if an error message appears when updating this UDT, how can I prevent that the document is not added in SBO either. If the update of the UDT fails for any reason I don't want to let the user to update the UDT.
    What is the best practice in this case?
    Thank you,
    Irina

    Irina,
    even if you happen to know at the before action true event that the update process generates an errror, you will not be able to roll back ( or make bubble event false)  the actual document creation . it is going to happen anyway .
    or you are getting at something else?
    Binita

  • How to update existing data of specific UDF at UDT?

    Hi Experts,
    I have a UDT with one of the UDF, status. I would like to update the udf, status of the document after i converted it to other documents. So tat I can filter out the selection at the query data. How can i do tat?
    Thanks and appreciate it.
    Regards,
    George
    Edited by: George Shii on Jun 29, 2009 10:57 AM

    Thanks Yatsea.
    Can I have some sample code for updating child table? I try but seems like something is missing in between.
    Problem solved. Thanks everone, appreciate it.
    'Get GeneralService - Main UDO - Retrieve the relevant service
    oGeneralService = oCmpSrv.GetGeneralService("G_OBCA")
    'GetByKey
    oGeneralParams = oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)
    'Child Order Key
    oEditTextcolumn = oGrid.Columns.Item(12)
    oGeneralParams.SetProperty("DocEntry", oEditTextcolumn.GetText(Count2))
    'Create data for new row in main UDO
    oGeneralData = oGeneralService.GetByParams(oGeneralParams)
    'Get GeneralService - Child UDO
    oChildren = oGeneralData.Child("G_BCA1")
    'Child Line Number
    oChild = oChildren.Item(oGrid.DataTable.GetValue(13, Count2) - 1)
    oChild.SetProperty("U_iStatus", "C")
    oGeneralService.Update(oGeneralData)
    Edited by: George Shii on Jun 30, 2009 5:43 AM
    Edited by: George Shii on Jun 30, 2009 6:18 AM

  • Asking about query update sql to UDF or UDT

    Hi experts,
    Is it possible to do a query update/ insert SQL to  UDT or UDF in SP notification ? I don't touch any core SAP's table. Just to UDF of UDT that i create  myself. Is it possible ?
    thanks in advance
    regards
    KK

    To Rahul,
    Thanks For your answer . So what is differences between SBO_SP_PostTransactionNotice and SBO_SP_TransactionNotification ? Usually i use SBO_SP_TransactionNotification for blocking some document or alert. So how about SBO_SP_PostTransactionNotice ?
    Please tell me. I'm new in this.
    To Gordon ,
    So can i just make a query insert sql to UDT in SBO_SP_TransactionNotification ?
    Thanks in advance
    Regards
    KK

  • How to update an UDT with B1if ?

    Hi every body,
    I would like to synchronize a UDT between 2 company DBs.
    Thanks to a gentleman, I succeed to export the content from the UDT (using a SAP Business One component and choosing the SQL object type) by a SQL query.
    But unfortunately, I don't understand how to insert data in the UDT. I have chosen as outbound
    SAP Business One
    SQL
    But I understand which nodes I have to put into the XSL file to run the update queries.
    Does anyone know how to do that?
    Thank you for your help! :o)

    Hi Damien,
    I selected the in the OutBound, Database and used the following code. Make sure your SLD is of JDBC type.
    I am updating the SAP table ITM1, all you have to do is change the table name and sql select/insert/update statement.
    <xsl:template name="transform">
    <DBout xmlns="" type="sql">
    <xsl:for-each select="$msg/row[position()&gt;0]">
    <sql>UPDATE [ITM1] SET Price =  <xsl:value-of select="col[10]"/>, U_ORCFU_Date = CAST(&apos;<xsl:value-of select="col[8]"/>&apos; AS date), U_ORCFU_Time = REPLACE(&apos;<xsl:value-of select="col[9]"/>&apos;, &apos;:&apos;, &apos;&apos;) WHERE ItemCode = &apos;<xsl:value-of select="col[6]"/>&apos; AND PriceList = (SELECT ListNum FROM [OPLN] WHERE ListName = RTRIM(&apos;<xsl:value-of select="col[1]"/> &apos;) +  LTRIM(&apos; <xsl:value-of select="col[3]"/>&apos;))</sql>
    </xsl:for-each>
    </DBout>
    </xsl:template>
    Good Luck,
    Mike
    Edited by: Mike Hardwick on Feb 9, 2012 9:17 PM

  • UDT updations

    Hi SAP B1 experts,
    i am trying to update an UDT through a query
    i have values for the fields that i have defined.
    but, how & with what value to update the default fields 'Code' & 'Name' ?
    i tried to supply values for those fields also. but, here again, i am facing a problem.
    i thought, 'Code' must be the primary key, mandatory & unique.
    but, it seems, even the 'Name' must be unique!
    even though the value for 'Code' is unique, it is not allowing to insert a duplicate 'Name' !
    is there any system variable like 'row-id' (current record number) with which i can update the default field 'Code' ?
    Thanks & Regards,
    Raghu Iyer

    Hi Jeyakanthan,
    first i tried:
    insert into [dbo].[@BinStock] (U_Wh_Code, U_Item_code, U_St_Bin, U_Qty_Bal)
    values ('CTRM', 'SAMPLE002', 'BIN002', 200)
    this created a record with 'CTRM' pushed to 'Code', 'SAMPLE002' to 'Name', 'BIN002' to 'U_Wh_Code' and 200 to 'U_Item_code'
    then i supplied the values for 'Code' & 'Name'
    insert into [dbo].[@BinStock] (code, name, U_Wh_Code, U_Item_code, U_St_Bin, U_Qty_Bal)
    values (2, ' ', 'CTRM', 'SAMPLE002', 'BIN002', 200)
    it worked, but, i am required to supply unique value for 'Code' and unique value for 'Name' also.
    is there a way to auto generate values for those two system fields ('Code' & 'Name') ?
    note : for testing, i tried with constant values, once i get to know how this works, i will be using select satement to insert values.
    Thanks & Regards,
    Raghu

  • DTW update deletes UDT fields values

    hello
    i work with sap 2007A 8.00.242 sp:01 pl 15, dtw version 2005.0.31 api version 8.0.242
    and i have a special user tables ordered from a sap partner company that replaces several excel files in our company.
    i tried to import data into them using DTW, but the import erases all the fields that i left blank in the csv, i even tried to delete all the blank columns from the csv but it didnt help.
    im importing into udt table found under "user defined data" > tables(UDT) > U_PASSPORT(**my table) using "update existing data" option.
    this table is the big part of a window with several tabs - each tab is a different table(U_example) and it gets data from items(OITM) so i dont think that filling all the blank csv columns is the answear because can affect child tables in this window as well as production order and customer orders.
    when i tried to update fields in OITM it was doing great.
    what can i do?
    mickel

    hey gordon thanks for the fast reply
    yes i can add new records.
    the main issue is that i want to make the transfer from execl documents with its simple data insertion, as smooth as it can be as my colleagues are very afraid from the sap and the time that it will steal from them.
    i want to make them a simple template with an XML and a batch file so they only have to insert data into csv and press a windows shortcut without going through the DTW annoying wizard every time.
    can i change the values at the second row of the template into a caption i choose?
    mickel

  • How can i update system form udf based on udt add event

    hello experts,
    i require small functionality on customized form add event,one of the system form udf value at row level should be update for particular row on based on the values on the customized form.
    so it should go like this on add event of customized form system form's row level udf should be update
    Regards,
    Bhavank

    Hi
    Are you opening your customised form with reference to any system form or it works alone?
    If it works alone then on the add event of customized form you haveto use update query with reference to the system form
    Regards

  • Formatted Seach does not update on UDT

    Hello Experts,
    One of our client is using a third party add-on for their rental business. On the rental document lines the formatted search does not automatically update rental warehouse field when exiting or field changed ( Item No). What could be the problem? When manually clicked on the globe icon it works.Here is the formatted search. SAP B1 8.8 PL15
    Select Case $[@BIZ_ORDR.U_RenWhse]
    When '22' Then '02'
    When '11' Then '01'
    When '33' Then '03'
    End
    Any help would be appreciated.

    Based on the UDF code, it seems that the UDF is located in the document header meanwhile the itemcode is in the document line. I think that's why it is not updated eventhough the itemcode is changed by user
    JimM

  • I dont know how to update a already defined UDT?

    I have a User defined field attached to a menu named customer equipment card, i need to change the objects and add a few more to it how can i do it, help me out with this problem

    Click on iTunes at the top of this page.
    Download the installer.
    Run the installer.

  • Using UDT's for passing rows to a PL/SQL procedure

    I'm trying to get a list of rows into a procedure...
    With ODP 11 - I thought that I would simply need to create a UDT of an object (i.e. user_id, first_name, last_name) and - then type which is a collection of that object.
    Then - using that object type collection as a parameter in my procedure - pass the numerous rows from .NET in.
    I've found a examples with varray's, nested varrays etc... but - nothing straight forward with passing a collection of rows.
    Does anyone know of any online examples that illustrate this?
    Thanks for your help!

    Hi,
    A BLOB variable is just a pointer to binary data and you are passing a text string to your procedure which is why you have the error. So to write a blob into a table in a procedure you need something like this:
    CREATE OR REPLACE PROCEDURE testone(
    V_TEXT IN VARCHAR2
    AS
    V_SIGIMG BLOB;
    BEGIN
    insert into sin_image values(empty_blob())
    returning blobcol into V_SIGIMG;
    -- then copy the text as binary data, this does not convert the text to binary data
    DBMS_LOB.WRITE(V_SIGIMG,1,LENGTH(V_TEXT),v_TEXT);
    commit;
    END;
    /However, if you want to upload images into the table it is easier to use the Apex functionality to upload the image into the APEX_APPLICATION_FILES table then move the blob into your table using an INSERT or UPDATE.
    Rod West

  • Help needed for data updation in User Defined Tables

    Hello Experts,
    I am developing one add-on in SAP B1 8.8 to input data in a User Defined Table described as under
    Table Name
    DriverMst UDT Type is No Object
    Description
    Stores the Driver master data which are used to get reference in Sale Delivery Form and Driver data management activity
    User defined fields
    Data Name
    Data source
    Size
    Pane Level
    Description
    Driver Code
    Code
    Alphanumeric
    0
    No object table fixed field
    System Name
    Name
    Alphanumeric
    30
    0
    No object table fixed field
    Full Name
    FullName
    Text
    50
    0
    Father Name
    FatherName
    Text
    50
    0
    Birth Date
    BirthDate
    Date
    0
    Phone Number
    PhoneNo
    Alphanumeric
    50
    0
    Mobile No
    MobileNo
    Alphanumeric
    13
    0
    I have created one form using screen painter displaying text boxes and bind them to the table.
    This form is working absolutely fine when there are some data in table (i.e. Browse using navigation)
    My problem is, when I click add button from tool bar the "OK" button turn to "Add" that means the form is set to Add mode, but when I click "Add" button after entering some data nothing happens and input data is not stored in Table. The same "OK" Button turned to "Update" when I do changes in loaded data, but my changes are not reflected to table after I click "Update".

    Thanks Nagarajan,
    None.
    There is no such query. The table fields is directly linked to Edit Box or Combo Box in form.
    From the examples I learned that I have to do something like this to get my table updated
    Dim oUsrTbl As SAPbobsCOM.UserTable
    Dim Res As Integer
    oUsrTbl = oCompany.UserTables.Item("DRIVERMST")
    oUsrTbl.Code = oBPC.Value 'Item Specific of Driver Code Edit Box
    oUsrTbl.Name = Left(oBPN.Value, 30) 'Item Specific of Name Edit Box
    oUsrTbl.UserFields.Fields.Item("U_FullName").Value = oMFN.Value
    oUsrTbl.UserFields.Fields.Item("U_FatherName").Value = oFTHN.Value
    oUsrTbl.UserFields.Fields.Item("U_BirthDate").Value = oDOB.Value
    oUsrTbl.UserFields.Fields.Item("U_PhoneNo").Value = oPHN.Value
    (Similar For rest ofthe fields)
    Res = oUsrTbl.Add()
    Just let me know that is this necessary to do like above.. To be frank there are few more fields and matrices on the form which I didn't mentioned. I am just trying to get recovered from first step to proceed further.
    Regards

Maybe you are looking for