UDO update in matrix with conditions deletes data

Hi,
I have a form binded to a MasterData and MasterDataLines tables.
I have three folders in this form.
When I click a folder I set a conditions to the matrix datasource so that I can see only the relevant data for each folder.
The problem is when I update.
The lines that are visible in the matrix are updated but the rest of it are deleted!
Any ideas in how can I update without loosing data?
Best Regards,
Ana Silva

Hello Ana,
Try to debug your addon to determine the number of rows in the matrix by RowCount and VisualRowCount. If 2 numbers are differs, than do not flush the data before you sav action.
if the numbers are same, than i suggest to use the following procedure before saving:
0. filter matrix data by conditions (this is what you do)
1. press save
2. receive and load data has been filtered out (wich is not visible in edited mode)
3. flush to datasource
4. save the data by default udo process.
Regards
János

Similar Messages

  • Send all line items of a sales order to IPC along with condition lines data

    We wrote some pricing routines in R/3, where while doing he calculations for condition line item, we needed to pull in the material information for previous line items. So we exported vbap and imported it inside the routine to be able to have access to all the line items in the sales order. Now, we need to put in the same kind of logic in CRM/IPC. My question is what would be the equivalent of SAP's(import/export) commands for internal tables in case of IPC. I looked at the BADI CRM_COND_COM_BADI but still do not see how I can send all the line items  data to IPC. So I guess, the question comes down to, how do I send all the line items of the sales order (whole VBAP in R/3 terms) to IPC along with the condition line data? Can someone please help?
    Thanks

    Hi Vaibhav,
    If you can get the list of Sales orders which has deleted line items and force completion status. You can manage them in BI via lookup  or navigation attribute.
    Just my views I am sharing .
    Thanks,
    KDJ

  • UPDATE multiple columns with conditional SET parameters

    I have a procedure that updates multiple columns of a table using the procedure's parameter. Is it possible to have one update statement with conditional SET parameter?
    CREATE TABLE TEMP
    (POL_NUM NUMBER,
    OED DATE,
    TERM NUMBER,
    TRANS_CD CHAR(2));
    INSERT INTO TEMP VALUES (1, '1 AUG 2009', 12, 'NB');
    INSERT INTO TEMP VALUES (2, '4 AUG 2009', 12, 'XL');
    INSERT INTO TEMP VALUES (3, '2 AUG 2009', 12, 'RN');
    COMMIT;
    CREATE OR REPLACE PROCEDURE TMP_PROC (
      pPOL_NUM NUMBER,
      pOED IN DATE,
      pTERM IN NUMBER,
      pTRANS_CD CHAR2)
    AS
    BEGIN
      IF pOED IS NOT NULL THEN
        UPDATE TEMP SET OED = pOED WHERE POL_NUM = pPOL_NUM;
      END IF;
      IF pTERM IS NOT NULL THEN
        UPDATE TEMP SET TERM = pTERM WHERE POL_NUM = pPOL_NUM;
      END IF;
      IF pTRAN_CD IS NOT NULL THEN
        UPDATE TEMP SET TRANS_CD = pTRANS_CD WHERE POL_NUM = pPOL_NUM;
      END IF;
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN
         NULL;
    END;Is it possible to replace multiple IFs from the code to have only one UPDATE statement with condition that update the column only if the passed parameter is not null? In real scenario I have more than 3 columns and I don't want to write many IF blocks.
    Please help Gurus!!
    Edited by: Kuul13 on Sep 18, 2009 1:26 PM

    Hi,
    You certainly don't want to issue separate UPDATE statements for every column; that will be really inefficent.
    SQL has several ways to implement IF-THEN-ELSE logic. CASE is the most versatile, but NVL will do everything you need for this job. You can use one of those to set a column to itself (and therefore not really update that column) when appropriate.
    For example:
    CREATE OR REPLACE PROCEDURE TMP_PROC (
      pPOL_NUM   IN       NUMBER,
      pOED          IN   DATE,
      pTERM          IN   NUMBER,
      pTRANS_CD  IN       CHAR
    AS
    BEGIN
         UPDATE  temp
         SET     oed      = NVL (poed,       oed)
         ,     term      = NVL (pterm,       term)
         ,     trans_cd = NVL (ptrans_cd, trans_cd)
         WHERE     pol_num      = ppol_num;
      COMMIT;     -- Maybe
    END    tmp_proc;"EXCEPTION WHEN OTHERS THEN NULL" is almost always a bad idea. If there's an error, don't you want to know about it? Shouldn't you at least log a message in a warnings table or something?
    Think careflully about whether or not you want to COMMIT every time you call this procedure.
    Just as it's inefficient to issue a separate UPDATE statement for every column, it's also inefficient to issue a separate UPDATE statement for every row. If efficiency is important, it should be possible to UPDATE several rows in a single UPDATE statement, using NVL (or CASE, or COALESCE, or NULLIF, or NVL2, or ...).
    This was a very well-written question! Thanks for providing the CREATE TABLE and INSERT statements, and such a clear explanation.

  • Load Matrix With Conditions

    By using this method to load my matrix does not bring any data. And if removing the Conditions and run only "oDBDataSource.Query ();", view all table data.
    public void GetDataFromDataSource() {
    // Ready Matrix to populate data
    oMatrix.Clear();
    oMatrix.AutoResizeColumns();
    //oDBDataSource.Query();
    SAPbouiCOM.Conditions oConditions;
    SAPbouiCOM.Condition oCondition;
    oConditions = new SAPbouiCOM.Conditions();
    oCondition = oConditions.Add();
    oCondition.BracketOpenNum = 2;
    oCondition.Alias = "U_ItemOne";
    oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
    oCondition.CondVal = "Teste";
    oCondition.BracketCloseNum = 1;
    //oCondition.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR;
    oDBDataSource = oForm.DataSources.DBDataSources.Item("@TB_TESTE");
    oDBDataSource.Query(oConditions);
    oUserDataSource.Value = "Phone with prefix";
    oMatrix.LoadFromDataSource();
    When you execute them brings my empty Matrix. Can I do this operation on tables that have the type of object? Or only on tables without object type? What was wrong?

    I have answered in your other thread - which you marked as answered but didn't assign points so I don't think it was really answered?
    Anyways, you are opening two brackets but only closing one, that is why your matrix is empty.
    oConditions = new SAPbouiCOM.Conditions();
    oCondition = oConditions.Add();
    oCondition.BracketOpenNum = 1;
    oCondition.Alias = "U_ItemOne";
    oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL;
    oCondition.CondVal = "Teste";
    oCondition.BracketCloseNum = 1;
    oDBDataSource = oForm.DataSources.DBDataSources.Item("@TB_TESTE");
    oDBDataSource.Query(oConditions);
    Try that instead

  • Update SharePoint list with project finish date on Project.Updated event

    Hello,
    I want to update a column in a SharePoint list with the project finish date when a project is updated on Project Server. My OnUpdated event handler is being called ok, but if I change the project start date Project Server runs an asynchronous republishing
    on the project, and my event handler ends up being called before the finish date is update by the republishing job, so the code writes the "old" finish date on the SharePoint list. The solutions I could think of are:
    Identify the republishing job on Project Server queue, pool the queue waiting for it to finish, then read the finish date and update the list item in SharePoint.
    Include a custom job on Project Server queue after the republishing job, that reads the finish date and update the list item in SharePoint.
    I don't know if any of the solutions are feasible and how to implement them. Has anyone coded something like this and/or have a better solution?
    Thanks,
    GB

    I vote for the option 1.
    I did for one of my event handler..Did you try "on published" event?
                projectSvc.QueueUpdateProject(jobUid, SessionUID, projectDss, false);
                //WaitForQueue(q, jobUid);
                jobUid = Guid.NewGuid();
                projectSvc.QueuePublish(jobUid, e.ProjectGuid, false, string.Empty);
                jobUid = Guid.NewGuid()
    Cheers. Happy troubleshooting !!! Sriram E - MSFT Enterprise Project Management

  • Program to update info record with material master data

    I am trying to determine if there is a standard SAP program that can be run as a batch file  to update the fields in the info record with the same fields that are in the material master?  ie:  Planned delivery time, Tolerance, purchasing group etc.

    Hi,
    There is no standard report or transaction that can do this.
    The data from these fields in the material master is brought in as a default to the info record when it is created. beyond this point the Info record is treated as being the correct data regardless of what happens to the material master data and so no updates occur in the standard system.
    It would not be difficult to build an LSMW job to copy the data from the material master to the info records and this would be the recommendation if you want to do this.
    Steve B

  • HT204053 How can i update app purchsed with my Deleted Apple ID?

    I have deleted my old user Apple ID, but now I cannot update the Apps I purchased with it. is there a way i can update without having to delete the app and install new one using my new ID?

    HumaidG wrote:
    is there a way i can update without having to delete the app and install new one using my new ID?
    No.
    Anything Downloaded with a Particular Apple ID is tied to that Apple ID and Cannot be Merged or Transferred to a Different Apple ID
    See iTem 5 Here  >  http://support.apple.com/kb/HT5622

  • Filling matrix with Dummy Data

    I am doing a demo screen for a client and I need to fill a matrix with hard coded data. I followed the sample code and I have the following code but it is not working for me (it throws a matrix-line exists exception):
    // Now get the matrix Item.
    SAPbouiCOM.Item matrixItem  = oForm.Items.Item("v33_Grid");
    theMatrix = (SAPbouiCOM.Matrix) matrixItem.Specific;
    Form.Freeze(true);
    SAPbouiCOM.UserDataSource uds;
    uds = oForm.DataSources.UserDataSources.Add("salesUds",SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 10);
    theMatrix.AddRow(1, theMatrix.RowCount);
    SAPbouiCOM.Column     col      = null;
    // Ready Matrix to populate data
    theMatrix.AutoResizeColumns();
    col = theMatrix.Columns.Item("desc1");
    col.DataBind.SetBound(true, "", "salesUds");
    uds.Value = "Test description";
    // setting the user data source data
    theMatrix.LoadFromDataSource();
    oForm.Freeze(false);
    oForm.Update();     
    I really need to get this working. ANyone got any ideas what I am doing wrong?

    Hi Laura,
    You should use theMatrix.SetLineData() which is the avaiable statement for user matrixes.
    Here is some code that loads a form with a matrix from an XML. This way you can edit form values in the XML, instead of hard coding.
    Dim oXMLDoc1 As Xml.XmlDocument = New Xml.XmlDocument
    oXMLDoc1.Load("C:BaseForm.xml")
    App.LoadBatchActions(oXMLDoc1.InnerXml)
    Dim oForm As SAPbouiCOM.Form = App.Forms.GetForm("ITA0002", 1)
    Dim oMatrix As SAPbouiCOM.Matrix = oForm.Items.Item("5").Specific()
    Dim Informes As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("Informes")
    Dim ID As SAPbouiCOM.UserDataSource = oForm.DataSources.UserDataSources.Item("ID")
    Dim i As Int16 = 1
    oMatrix.AddRow(ListaInformes.Length)
    For Each Informe As String In NameList
       Informes.ValueEx = Informe
       ID.ValueEx = i.ToString
       oMatrix.SetLineData(i)
       i = i + 1
    Next
    The xml is this one:
    <?xml version="1.0" encoding="UTF-16"?>
    <Application>
         <forms>
              <action type="add">
                   <form AutoManaged="1" BorderStyle="4" FormType="ITA0002" ObjectType="-1" SupportedModes="1" appformnumber="ITA0002" client_height="284" client_width="291" color="0" default_button="1" height="316" left="363" mode="1" pane="1" title="Informes" top="149" type="4" visible="1" width="297">
                        <datasources>
                             <userdatasources>
                                  <action type="add">
                                       <datasource size="254" type="9" uid="Informes"></datasource>
                                  </action>
                                  <action type="add">
                                       <datasource size="10" type="9" uid="ID"></datasource>
                                  </action>
                             </userdatasources>
                        </datasources>
                        <items>
                             <action type="add">
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="6" linkto="" right_just="1" supp_zeros="0" tab_order="10" text_style="0" to_pane="0" top="260" type="4" uid="1" visible="1" width="65">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific caption="OK"></specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="0" from_pane="0" height="19" left="77" linkto="" right_just="1" supp_zeros="0" tab_order="20" text_style="0" to_pane="0" top="260" type="4" uid="2" visible="1" width="65">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific caption="Cancelar"></specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="0" height="20" left="5" linkto="" right_just="0" supp_zeros="0" tab_order="0" text_style="0" to_pane="0" top="5" type="99" uid="3" visible="1" width="80">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific AffectsFormMode="1" caption="Informes" val_off="0" val_on="1">
                                            <databind alias="Informes" databound="1" table=""></databind>
                                       </specific>
                                  </item>
                                  <item AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" enabled="1" font_size="0" forecolor="-1" from_pane="1" height="224" left="8" linkto="" right_just="0" supp_zeros="0" tab_order="60" text_style="0" to_pane="1" top="28" type="127" uid="5" visible="1" width="276">
                                       <AutoManagedAttribute></AutoManagedAttribute>
                                       <specific SelectionMode="2" layout="0" titleHeight="0">
                                            <columns>
                                                 <action type="add">
                                                      <column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="2" type="16" uid="2" val_off="N" val_on="Y" visible="1" width="20">
                                                           <databind alias="ID" databound="1" table=""></databind>
                                                           <ExtendedObject></ExtendedObject>
                                                      </column>
                                                      <column AffectsFormMode="1" backcolor="-1" description="" disp_desc="0" editable="0" font_size="12" forecolor="-1" right_just="0" text_style="0" title="Nombre" type="16" uid="1" val_off="" val_on="" visible="1" width="255">
                                                           <databind alias="Informes" databound="1" table=""></databind>
                                                           <ExtendedObject></ExtendedObject>
                                                      </column>
                                                 </action>
                                            </columns>
                                       </specific>
                                  </item>
                             </action>
                        </items>
                        <items>
                             <action type="group">
                                  <item uid="3"></item>
                                  <item uid="4"></item>
                             </action>
                        </items>
                        <FormMenu></FormMenu>
                        <DataBrowser></DataBrowser>
                   </form>
              </action>
         </forms>
    </Application>
    Regards,
    Ibai Peñ

  • Updating target table with date in owb using mapping

    I want to update the effetive begin date (month begin date) when we load the target table. I have field in target table has Eff_updated_dt defined as DATE.
    If I use the Data generator operator and then expression operator (trunc (sysdate,'mm' ) it giving error. It says data generator operator should be connected to flat file .
    What other operators can I use to update the column with month begin data.
    Also which operator I have use to have sequence key in the table.
    Thanks

    you can always use a constant for the date field.
    just create a constant of type date and give it the value you want, trunc (sysdate,'mm' ) and connect it to your target column, Eff_updated_dt defined.
    you have a sequence operator that you can use to link to your "sequence key" as well.
    Borkur

  • UDO Updating is not working

    Hi All
    I am working on udo concepts. I created Master type UDO and Custom Form it is working fine while adding records. Up while updating the values it giving message like u201COperation completed successfully u201Cbut values are not updating in table.
    Please give me the solution. How to update the records.

    Hi,
    Do onething
    I assume that you have only one matrix in your screen
    So it is advisable to bind this matrix to a table of the type Master data lines.Let me guide you with the steps
    1) Create a master table with no UDFs
    2) Create a new table (but of type master data lines) and with the same fields you have now in your table
    3) Bind the columns of the matrix with the master data lines table
    4) Add 2 hidden fields in the screen and bind it with the Code and Name fields of the header table
    5) Through insert SQL query,make the value of this field(Code and Name) as '1' and '1'
    6) So whenever you open this form,through coding load the form in find mode,populate values '1' and '1' to these 2 fields and add ,click on the find button.
    7) so you have one record in the header table and the contents of the matrix are your lines table.Whenever you open the form this only record is opened and its line items are only updated.
    Thanks & Regards,
    Senthil Maruthappan

  • Open HUB ( SAP BW ) to SAP HANA through DB Connection data loading , Delete data from table option is not working Please help any one from this forum

    Issue:
    I have SAP BW system and SAP HANA System
    SAP BW to SAP HANA connecting through a DB Connection (named HANA)
    Whenever I created any Open Hub as Destination like DB Table with the help of DB Connection, table will be created at HANA Schema level ( L_F50800_D )
    Executed the Open Hub service without checking DELETING Data from table option
    Data loaded with 16 Records from BW to HANA same
    Second time again executed from BW to HANA now 32 records came ( it is going to append )
    Executed the Open Hub service with checking DELETING Data from table option
    Now am getting short Dump DBIF_RSQL_TABLE_KNOWN getting
    If checking in SAP BW system tio SAP BW system it is working fine ..
    will this option supports through DB Connection or not ?
    Please follow the attachemnet along with this discussion and help me to resolve how ?
    From
    Santhosh Kumar

    Hi Ramanjaneyulu ,
    First of all thanks for the reply ,
    Here the issue is At OH level ( Definition Level - DESTINATION TAB and FIELD DEFINITION )
    in that there is check box i have selected already that is what my issue even though selected also
    not performing the deletion from target level .
    SAP BW - to SAP HANA via DBC connection
    1. first time from BW suppose 16 records - Dtp Executed -loaded up to HANA - 16 same
    2. second time again executed from BW - now hana side appaended means 16+16 = 32
    3. so that i used to select the check box at OH level like Deleting data from table
    4. Now excuted the DTP it throws an Short Dump - DBIF_RSQL_TABLE_KNOWN
    Now please tell me how to resolve this ? will this option is applicable for HANA mean to say like , deleting data from table option ...
    Thanks
    Santhosh Kumar

  • Updating database table with DUPLICATE keys

    i have an internal table having data as follows.
    emp_id     name     date           proj_id  activity_id    Hours  Remarks
    101     Pavan    09.10.2007      123     1         2.00       Coding
    101     Pavan     09.10.2007   124     2         1.00        Documentation
    102     Raj     09.10.2007   123        3         6.00     Testing
    Now i need to update a Ztable with above mentioned data.
    The structure of the Ztable is as follows.
    Mandt     emp_id  name    date    proj_id   activity_id   Hours   Remarks
    NOte: i have ticked both check boxes for the field MANDT in table.
    Rest didnt select the check boxes.
    I believe now the field MANDT alone is a primary key for the z-table.
    NOw i have tried with UPDATE/INSERT statments to update the database table.
    But instead of inserting all the rows, the system is over writing on the same emp_id row.
    Even tried with the statments like INSERT INTO <Ztable> values <Internal table> ACCEPTING DUPLICATE KEYS.
    But its not getting inserted as a separate row in the table.
    Requirement is to insert the multiple rows in the database table without any over writing activity.
    Can anyone give me the code to do this?
    Regards
    Pavan

    Hi Pavan,
        Please let me know what are the key fields in your Ztable. Try with below code it may help you. change the "Ztablename" as your database table name and I_INTERNAL TABLE  as your internal table name. still you are facing the problem please let me know.
    lock the custom table before updating the table.
      CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
      MODE_RSTABLE         = 'E'
         TABNAME              = 'ZTABLENAME'
      VARKEY               =
      X_TABNAME            = ' '
      X_VARKEY             = ' '
      _SCOPE               = '2'
      _WAIT                = ' '
      _COLLECT             = ' '
       EXCEPTIONS
         FOREIGN_LOCK         = 1
         SYSTEM_FAILURE       = 2
         OTHERS               = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        INSERT  ZTABLENAME FROM TABLE I_INTERNALTABLE ACCEPTING DUPLICATE KEYS.
        COMMIT WORK.
      ENDIF.
    unlock after updating the custom table After updation is done.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
        MODE_RSTABLE       = 'E'
         TABNAME            = 'ZTABLENAME'
        VARKEY             =
        X_TABNAME          = ' '
        X_VARKEY           = ' '
        _SCOPE             = '3'
        _SYNCHRON          = ' '
        _COLLECT           = ' '

  • I want to update iCloud account with new apple id but don't know password for old apple id.  Plus can no longer receive email at old apple id.  How can I delete the current iCloud account on my iPhone if the previously stated conditions exist?

    I want to update iCloud account with new apple id but don't know password for old apple id.  Plus can no longer receive email at old apple id.  How can I delete the current iCloud account on my iPhone if the previously stated conditions exist?

    If the old ID is yours, and if it is an earlier version of your current ID, go to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iDevice, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll.  When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.

  • Problem to update UDO-recordsets using a matrix with DBDataSource

    Hello,
    I've got a problem with updating recordsets in an UDO-Table using DBDataSource.SetValue().
    Special szenario: I use a matrix bounded with DBDataSources. Adding new records and loading them via DBDataSource.Query() with conditions works fine. The UDO object type is "Document" without lines.
    In the simple way now I load just one record and after this I was trying to set an "message" to an simple, editable edittext-column via calling:
    oDBDataSource.SetValue("U_Message", 0, "Hello world");
    oMatrix.LoadFromDataSource();
    Now it's visible in the matrix.
    But when I call update via clicking the update-button, B1 do say, everything was ok (green status-message). Reloading this recordset you can see: it was not stored in the database
    Even not after:
    oMatrix.FlushToDataSource();
    As a workaround I do write the "message" via using Cell.Specific.
    Can anybody help me?
    I'am using SBO 2005 A SP 01 PL 39
    Edited by: Christian Bührig on Mar 18, 2008 4:48 PM

    look at
    New Row in Matrix is a Duplicate and Cannot update Object with new Row
    the next way is do it with recordset and directly insert to table.
    hope it helps
    Petr

  • Matrix With UDO Datasource

    Hi,
    I have been through all the Matrix Samples and read many threads here but I just dont get a few things with the Matrix.
    I have created an add on that adds a new folder to the Business Partners Form,
    I can have built a matrix in this form and created bound columns bound to my UDO Table @xxxx
    I have an event that fires when a business partner is chosen and the folder is only shown when a Customer is selected.
    I can even get the matrix to fill with data related to the specific customer only when the customer is selected - using conditions on the DBDataSource.
    This is all great but the 2 problems I have are :
    I have created a button called Add Row that Adds a Row to Matrix - this button turns into an Update button when the row is added in the Matrix.
    Problem 1 : When the row is added in the Matrix it takes the data from the last row of the data and duplicates it in the new row - you can change this data of course however I would like a blank row inserted instead.
    Problem 2 : When I update I do a Matrix.FlushToDataSource - then I requery but it has not saved the new entry ?
    How do I get the new entry to save into the database.
    Any Help would be appreciated.
    Thanks

    Thanks - I sent the Screen shot - here is the event code
                If ((pVal.FormType = 134 And pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) And (pVal.Before_Action = True)) Then
                     oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
                    If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD) And (pVal.Before_Action = True)) Then
                            oNewItem = oForm.Items.Add("BOMFolder", SAPbouiCOM.BoFormItemTypes.it_FOLDER)
                        oItem = oForm.Items.Item("9")
                        oNewItem.Top = oItem.Top
                        oNewItem.Height = oItem.Height
                        oNewItem.Width = oItem.Width
                        oNewItem.Left = oItem.Left + oItem.Width
                        oFolderItem = oNewItem.Specific
                        oFolderItem.Caption = "Lynxs BOM"
                        oFolderItem.GroupWith("9")
                        SetupBOMMatrix()
                        oForm.PaneLevel = 1
                    End If
                    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
                        If pVal.ItemUID = "mat" Or pVal.ItemUID = "colitem" Then
                            Try
                                Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                                oCFLEvento = pVal
                                Dim sCFL_ID As String
                                sCFL_ID = oCFLEvento.ChooseFromListUID
                                Dim oForm1 As SAPbouiCOM.Form
                                oForm1 = SBO_Application.Forms.Item(FormUID)
                                Dim oCFL As SAPbouiCOM.ChooseFromList
                                oCFL = oForm1.ChooseFromLists.Item(sCFL_ID)
                                If oCFLEvento.BeforeAction = False Then
                                    Dim oDataTable As SAPbouiCOM.DataTable
                                    oDataTable = oCFLEvento.SelectedObjects
                                    Dim val As String
                                    Dim nam As String
                                    Try
                                        val = oDataTable.GetValue(0, 0)
                                        nam = oDataTable.GetValue(1, 0)
                                     Catch ex As Exception
                                        val = "none"
                                        nam = "none"
                                    End Try
                                     Try
                                        Call UpdateCells(oForm1, pVal.Row, val, nam)
                                    Catch
                                        MsgBox("Couldnt Set Data Tables")
                                    End Try
                                End If
                            Catch
                                MsgBox("Error in Item Event - CFL : " & Err.Description)
                            End Try
                        End If
                    End If
                     If pVal.ItemUID = "btnAddRow" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.Before_Action = True Then
                        ' SOMETHING IS AMISS HERE
                        Dim ob As SAPbouiCOM.Button = oForm.Items.Item("btnAddRow").Specific
                        Dim oe As SAPbouiCOM.EditText = oForm.Items.Item("5").Specific
                        oMatrix = oForm.Items.Item("mat").Specific
                        If MatrixMode = "Nothing" Then
                            oMatrix.AddRow()
                            Dim i As Integer
                            i = oMatrix.RowCount
                            Dim oc As SAPbouiCOM.Column
                            Dim ocell As SAPbouiCOM.Cell
                            Dim oed As SAPbouiCOM.EditText
                            oc = oMatrix.Columns.Item("colArea")
                            oed = oc.Cells.Item(i).Specific
                            oed.String = ""
                            oc = oMatrix.Columns.Item("colItem")
                            oed = oc.Cells.Item(i).Specific
                            oed.String = ""
                            oc = oMatrix.Columns.Item("colItemtxt")
                            oed = oc.Cells.Item(i).Specific
                            oed.String = ""
                            oc = oMatrix.Columns.Item("colFitted")
                            oed = oc.Cells.Item(i).Specific
                            oed.Value = 0
                            oc = oMatrix.Columns.Item("colCritica")
                            oed = oc.Cells.Item(i).Specific
                            oed.Value = 0
                            oc = oMatrix.Columns.Item("colSpares")
                            oed = oc.Cells.Item(i).Specific
                            oed.Value = 0
                            MatrixMode = "Add"
                            ob.Caption = "Update Row"
                        Else
                            oMatrix.FlushToDataSource()
                            Dim oConditions As SAPbouiCOM.Conditions
                            Dim ocondition As SAPbouiCOM.Condition
                            oConditions = New SAPbouiCOM.Conditions
                            ocondition = oConditions.Add
                            ocondition.BracketOpenNum = 1
                            ocondition.Alias = "U_CARDCODE"
                            ocondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                            ocondition.CondVal = oe.Value.ToString
                            ocondition.BracketCloseNum = 1
                            oDBDatasource.Query(oConditions)
                            oMatrix.LoadFromDataSource()
                            MatrixMode = "Nothing"
                            ob.Caption = "Add Row"
                        End If
                    End If
                    If pVal.ItemUID = "BOMFolder" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.Before_Action = True Then
                        '// when the new folder is clicked change the form's pane level
                        '// by doing so your items will apear on the new folder
                        '// assuming they were placed correctly and their pane level
                        '// was also set accordingly
                        oForm.PaneLevel = 11
                    End If
                End If

Maybe you are looking for