Insert a new row in log table when update on view object

hi All,
i have created approval System where i maintain log which is based on table(ApprovalLog) which contain attribute like (Agencycode,approve_status,approved_by,approved_date).
and i have also create a view object which is based on (AgencyApproval) table. which is also contain field approval_status by default 'N'
i create a jsf page using this view object and drag drop as adf table now i want when user change approve_status field and click on commit button then
a new row created on to ApprovalLog table and values of column like (agencycode,approve_status,approved_by) comes from AgencyApproval table.
How can i do this in ADF.
Please Reply.
manish

hi Timo,
i have done this as following and it is working.
please tell me it is right approach or not.
        protected void prepareForDML(int i, TransactionEvent aTransactionEvent)
            if (i != EntityImpl.DML_DELETE)
                     ViewObjectImpl vo = (ViewObjectImpl)this.getDBTransaction().findViewObject("AdAgcrlimitAppLogView3"); // change it to the name of your VO
                       Row row = vo.createRow();
                       // set the values ...
                       row.setAttribute("AppDt",getAppDt() );
                       row.setAttribute("Publ",getPubl() );
                       row.setAttribute("GrpAgcode",getGrpAgcode() );
                       row.setAttribute("GrpAgsubcode",getGrpAgsubcode() );
                       row.setAttribute("StaticCrlimit",getStaticCrlimit() );
                       row.setAttribute("FixCrlimit",getFixCrlimit() );
                       row.setAttribute("VarcrLimit",getVarcrLimit() );
                       row.setAttribute("AdhocLimit",getAdhocLimit() );
                       row.setAttribute("AdhocFr",getAdhocFr() );
                       row.setAttribute("AdhocTo",getAdhocTo() );
                       row.setAttribute("CrAlertLimit",getCrAlertLimit() );
                       row.setAttribute("BillAmt",getBillAmt() );
                       row.setAttribute("AdjAmt",getAdjAmt() );
                       row.setAttribute("DbnAmt",getDbnAmt() );
                       row.setAttribute("PayAmt",getPayAmt() );
                       row.setAttribute("UnbillAmt",getUnbillAmt() );
                       row.setAttribute("Status",getStatus() );
                       row.setAttribute("AlertTag",getAlertTag() );
                    row.setAttribute("CrlimitTag",getCrlimitTag() );
                       row.setAttribute("Confirm",getConfirm() );
                       row.setAttribute("ApproveRemark",getApproveRemark() );
                       row.setAttribute("ApproveBy",getApproveBy() );
                       row.setAttribute("ApproveDt",getApproveDt() );
                       row.setAttribute("ApproveStatus",getApproveStatus() );
                       row.setAttribute("ApproveHier",getApproveHier() );
                       row.setAttribute("Usrname",getUsrname() );
                       row.setAttribute("Usrid",getUsrid() );
                       row.setAttribute("Usrdate",getUsrdate() );
                       row.setAttribute("Cuser",getCuser() );
                       vo.insertRow(row);
                   super.prepareForDML(i, aTransactionEvent);
        }

Similar Messages

  • To insert a new row in a table control without affecting the other rows

    Halo experts,
    I have a Table control TCTRL in a program .
    The lt_tab contains two cols A and B
    In change mode of the transaction Col A is in display mode and Col B is in change mode
    When i press the + button to insert a new blank entry .I need a blank row with both col A and col B input enabled w/o affecting the display of above and below rows of table control
    In PBO module of subscreen 101
    LOOP AT lt_tab  WITH CONTROL tctrl.
    MODULE tctrl_status.
    endloop.
    In the user command of 0101
    i am writn
    When 'INS'.
    INSERT INITIAL LINE INTO itab.
    Inside MODULE tctrl_status.
    IF lt_tab IS INITIAL.
        LOOP AT SCREEN.
          IF screen-name = 'COLA'.
          screen-input = 1.
      ENDIF.
        ENDLOOP.
          MODIFY SCREEN.
    endif.
    but the problem here is still the Col A is in display mode and Col B is in change mode after output
    .Here modify statement is happening but it does not update the TCTRL-COLS-Screen structure for the col A ( which I have set statically while designing the screen ).I dont want to make the entire row in edit mode only the inserted row ( for both Col A and Col B) and the rest shud remain as it is
    Thanks
    Kallu

    hi Naveen
    I have made my tctrl input disabled for both the columsn and
    I have a module before the PBO loop where I set the like
    module set_tctrl_status.
    IF gv_ok_code NE gc_disp.
        LOOP AT tctrl-cols INTO gs_cols.
          IF gs_cols-screen-name = 'ColB'.
            gs_cols-screen-input = 1.
            MODIFY tctrl-cols FROM gs_cols INDEX sy-tabix.
          ENDIF.
        ENDLOOP.
    This is just to set the Col B in edit mode when in change and create status.
    But if i press the INS button for that change i am coding inside the loop endloop of the pBO like
    if itab is initial.
    LOOP AT tctrl-cols INTO gs_cols.
    gs_cols-screen-input = 1.
    MODIFY tctrl-cols FROM gs_cols INDEX sy-tabix.
    endloop.
    But the problems i it is setting the enite rows as input enabled . I want tos et only that row inpur enabled

  • How to insert a new Row in a table? - Need help

    Hi everyone,
    I'm using JDeveloper 10.1.2, UIX pages and STRUTS.
    This is my situation: When I navigate from page one to page two, I have in my page2 one table and I need to create a new row with some values by default, but I don't want to commit this line except the user decides to complete this line.
    Can anyone help me? This is very important.
    Thanks,
    Atena

    Hi Sascha,
    thanks very much for your replay.
    My project changed and I have another question about this. My page1 has a table (table1) and when I select one line from table1 and press a button, I go to page 2.
    I have an action in the Struts-Config.xml like this in page2 (S2PopUpObstaculos):
    <action path="/S2PopUpObstaculos" type="oracle.jheadstart.controller.strutsadf.action.JhsDataActionSaveObstaculos" className="oracle.jheadstart.controller.strutsadf.action.JhsDataActionMapping" parameter="/WEB-INF/page/S2PopUpObstaculos.uix" name="DataForm">
    <set-property property="modelReference" value="S2AltaSociais2UIModel"/>
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=${data.S2AltaSociais2UIModel.Obstaculo},${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},${data.S2AltaSociais2UIModel.Obstaculo}"/>
    </action>
    But now, the problem is, if I don't select one Row from table1 and press the button to go to page2, I need to pass diferent parameters to page 2, like this:
    <set-property property="bindParams" value="S2DominiosLevel1Iterator=0,${data.S2AltaSociais2UIModel.AlsEpsPsId},${data.S2AltaSociais2UIModel.AlsEpsId},0"/>
    </action>
    Do you have any ideia how to do this? Can you help me?
    Thanks,
    Atena

  • How to add a new row in rich table when a button clicks which isinatemplate

    i am new to j developer 11g. i have problem when i click a reset button located in the template
    will clear all data from the rich table and it is in a add mode,ie table with only one empty row
    Regards
    rajesh
    Edited by: [email protected] on Mar 10, 2009 11:30 PM

    Hi,
    and here is a blog entry about global buttons in templates
    http://thepeninsulasedge.com/frank_nimphius/2007/11/23/adf-faces-rc-implementation-strategies-for-global-buttons-in-page-templates/
    Frank

  • Inserting a new row in a table

    I want to insert a row between other rows. Means when we insert a row and we see by
    select * from emp;
    then the result shows that inserted value goes to last row. So i want that when we insert a value to a table and do
    select * from emp;
    then inserted value must be between other rows....

    Well, if your teacher won't take the answer "you can't insert rows between other rows, you must use an order by to get your data in a particular order", then he is not the teacher you want to be learning Oracle database concepts from. Because it is the truth. Maybe he is testing your resolve to stick to an answer that you have researched.
    If he's intending it as a "trick" question, you could propose what others here have alluded to - for example, if you have a date field in your table and had, for example, rows with dates Jan 3 2011 and Jan 5 2011, you could insert a record with date Jan 4 2011, then when you select, and use "order by" that column, the data will "appear to be" between the existing 2 records. But, again, this relies on using "order by", the data is not physically or any other way "between" the first 2 records, and is not a practical, real-world way of solving most data ordering issues.
    Now, this is an Oracle forum, and this is the Oracle answer. I do not have experience with any other database so I can't definitively say that this would be the answer in all databases.
    Good luck with your class.

  • Query regarding inserting a new row at first row data table

    hi all,
    I have a doubt regarding the insertion of new row in data table.I am now using the following code
    if (skillDataProvider.canAppendRow()){
    RowKey rowkey = skillDataProvider.appendRow();
    skillDataProvider.setCursorRow(rowkey);
    String skillID=getSkilID();
    skillDataProvider.setValue("Skill.SkillID", rowkey, skillID);
    int rowID=Integer.parseInt(rowkey.getRowId());
    tableRowGroup1.setFirst(rowID);
    Its working fine.But this code gives me provision to add the data at the last of the table.I need it to be at the first row.I tried
    RowKey rowkey=skillDataProvider.insertRow(skillDataProvider.getRowKey(String.valueOf(0)));
    but it shows some null pointer exception.Can anyone help me?
    Thanks in advance
    Sree

    I think AChervov has the right idea here.
    CachedRowSetDataProvider.canInsertRow(beforeRow) returns false, so you cannot insertRow().
    Therefore, you'll need to control the sort order yourself. I'd add a sort field to the database. Then use TableRowGroup.setSortCrtieria() to control the table display order. Or commit the append to the database immediately and reselect (refresh) the provider (assuming the provider has the desired "order by").

  • Inserting a new row in a child table referencing an already existing parent

    I have two tables PARENT & CHILD (one to many), both of which are populated at different times.
    In our toplink mappings, parent contains a collection of child Domain Objects, & and child Domain object contains a one - one to parent.
    How can I insert a new row in a child table with reference to an already existing row in parent?
    When I fetch the parent Domain object and try to set it in the child Domain Object and use the unitOfWork.registerObject() it goes into a circular loop of selecting from 2 other tables.
    Please suggest.

    Odd, have you disabled caching and indirection? (NoIdentityMap, dontUseIndirection, or alwaysRefresh/disableCacheHits). If so, then this could be the issue.
    Otherwise please include the sample code you use to perform this, and verify that you do not have any unusual code in your set/get methods or in descriptor events. Also turn TopLink logging on and include a sample. Also ensure that you do not modify your objects until after registering them in the unit of work, and only modify the unit of work clones.

  • Generate a surregate key only when insert a new row - (SCD1)

    Hi all,
    I&acute;m starting with OWB (10gR2) and I'm creating a simple template dimension with SDC type 1 with one source, one target and a sequence do generate the surrogate key.
    The main properties configurations are:
    - Target property: Loading type = INSERT/UPDATE.
    - Only match the natural key between source and target.
    - Only use the sequence.nextval when inserting a new row.
    - Mapping: Set based.
    The generated code was something like this:
    {color:#000080}+MERGE INTO DIM_DEFAULT+{color}
    {color:#000080}+USING SCR_TABLE+{color}
    {color:#000080}+ON(SCR_TABLE.NATURALKEY=DIM_DEFAULT.NATURALKEY)+{color}
    {color:#000080}+WHEN MATCHED THEN+{color}
    {color:#000080}+UPDATE SET NAME=SCR_TABLE.NAME+{color}
    {color:#000080}+WHEN NOT MATCHED THEN+{color}
    {color:#000080}+INSERT(SK_DEFAULT,NATURALKEY,NAME)+ {color}
    {color:#000080}+VALUES(SQ_DIM_DEFAULT.NEXTVAL,SCR_TABLE.NATURALKEY,SCR_TABLE.NAME)+{color}
    Ok, it works fine! But the merge statement generates a new SK for each merged row even if the action is update! What I want is a new SK only when the process inserts a new row. Hard-coding, I possible solve this problem creating a function to return the nextval from a sequence and put it on the insert clause like this:
    {color:#000080}+MERGE INTO DIM_DEFAULT+{color}
    {color:#000080}+USING SCR_TABLE+{color}
    {color:#000080}+ON(SCR_TABLE.NATURALKEY=DIM_DEFAULT.NATURALKEY)+{color}
    {color:#000080}+WHEN MATCHED THEN+{color}
    {color:#000080}+UPDATE SET NAME=SCR_TABLE.NAME+{color}
    {color:#000080}+WHEN NOT MATCHED THEN+{color}
    {color:#000080}+INSERT(SK_DEFAULT,NATURALKEY,NAME)+ {color}
    {color:#000080}+VALUES(FN_SQC_NEXTVAL('SQ_DIM_DEFAULT'),SCR_TABLE.NATURALKEY,SCR_TABLE.NAME)+{color}
    Hard-coded it works fine as I need and that&acute;s the point that I want to know:
    It&acute;s possible perform this solution using OWB?
    I tried to use Constants but this solution doesn&acute;t work then I tried an expression calling my sequence.nextval function but the result was:
    {color:#000080}+MERGE INTO DIM_DEFAULT+{color}
    {color:#000080}+USING (SELECT FN_SQC_NEXTVAL('SQ_DIM_DEFAULT') AS SK_DEFAULT_0,NATURALKEY,NAME FROM SCR_TABLE) AS SCR_TABLE+{color}
    {color:#000080}+ON(SCR_TABLE.NATURALKEY=DIM_DEFAULT.NATURALKEY)+{color}
    {color:#000080}+WHEN MATCHED THEN+{color}
    {color:#000080}+UPDATE SET NAME=SCR_TABLE.NAME+{color}
    {color:#000080}+WHEN NOT MATCHED THEN+{color}
    {color:#000080}+INSERT(SK_DEFAULT,NATURALKEY,NAME)+ {color}
    {color:#000080}+VALUES(SK_DEFAULT_0,SCR_TABLE.NATURALKEY,SCR_TABLE.NAME)+{color}
    It&acute;s the same of merge the row using the SEQUENCE.NEXTVAL direct.
    Does anyone have a workaround to solve this situation?

    Hi,
    Perhaps this comes a bit late but...
    Have you tried to change attribute properties in the mapping? For simple example you have a source table in sa-stage which have to fields: code (varchar2(2), natural key) and description (varchar2(50)). You want to map those fields to target table where you have 3 fields: id (NUMBER(10), surrogate id, nextval from sequence when new row inserted), code (as from the source, natural key, the field to determine if the coming row is new or one to be merged) and description as in source table. Fields and datatypes are just for an example.
    When you have source and target tables in your mapping (and fields mapped), drag the sequence operator to the mapping and map the nextval to target table's surrogate id field.
    - Change target table operator properties:
    * loading type = UPDATE/INSERT
    * Match by constraint = no constraint
    - Change target table attribute properties for:
    * surrogate id field: Load column when updating row = no; match column when updating row = no; load column when inserting row = yes
    * natural key field(s): Load column when updating row = no; match column when updating row = yes; load column when inserting row = yes
    * all the regular fields: Load column when updating row = yes; match column when updating row = no; load column when inserting row = yes
    - change the deleting rules as you want them to be
    - Validate your mapping. If the green light is shown, the settings in field properties are suitable for merge.
    Hope this is what you wanted to get. I think this kind of solution works fine. Trigger in the table that holds and where one inserts millions of rows sounds scary...
    Regards,
    jk
    Added text: sorry about false alarm. I think that was what you did. The solution above steals the nextvals from sequence. Perhaps no-native-english-reader should be more careful when reading questions ;-)
    Edited by: jkoski on 5.11.2008 1:30

  • Textarea - space when inserting a new row !!!

    when I insert a new row with the editcurrent record, I get a space in each textarea.
    I don't understand why you write this like:...
    if(obj == null)
    sText = createMultilineTextField(sAttribute , " ");
    else
    The Db now contain a space caracter.
    Jean-Nokl WALLEZ
    [email protected]

    Hi, your code is right. So, replaces your blank space by the character 255 (ALT+255) and the blank space will be shown in your table.
    if(obj == null)
    sText = createMultilineTextField(sAttribute , " ");
    else
    Pakitwo.

  • BAPI to insert a new row in the MCHA table

    Hi all,
    I am in search of a BAPI to insert a new row in the MCHA table... with the fields of the materail, plant and batch values.
    Any inputs on this..is highly appreciable...
    thanks in advance...
    regards..
    prathima.

    explore BAPI_BATCH_CREATE

  • BAPI to insert a new row in the AUSP table

    Hi all,
    I am in search of a BAPI to insert a new row in the AUSP table... with the fields of the object and
    characteristic values.
    Any inputs on this..is highly appreciable...
    thanks in advance...
    regards..
    prathima.

    hi,
    from best of my knowledge  here is list of bapi through you can insert ausp table.
    check it.
    CLSE_SELECT_AUSP
    CLVF_INSERT_AUSP
    BAPI_CLASS_CREATE
    C14K_AUSP_CHANGE_VALUE
    CLSE_SELECT_AUSP
    CLVF_UPDATE_AUSP
    C14K_AUSP_ADD_UPD
    BAPI_CLASS_CREATE
    regards,
    vipul

  • Add Row in detail table when check box is checked on a master report table

    Hi,
    How could I detect the click on the check box within a Report and then insert a row in a detail table?
    Many thanks for your help
    jko

    Hi Yogesh,
    That is all handled by the cloneRows() function described in that thread.
    In that function, we first insert a new row:
    var wNew = t.insertRow(ri + 1);ri + 1 = current row + 1 and tells javascript where to add the new row (that is, underneath the current one)
    Then, we loop through all of the cells on the current row and copy its cells into the new row:
    var c;
    var newCell;
    var oldCells = w.getElementsByTagName("TD");
    for (c = 0; c &lt; oldCells.length; c++)
      newCell = wNew.insertCell(c);
      newCell.className = oldCells[c].className;
      newCell.innerHTML = oldCells[c].innerHTML;
    }Next, we search for all INPUT items on the new row and clear the values:
    var inputs = wNew.getElementsByTagName("INPUT");
    var j;
    for (j = 0; j < inputs.length; j++)
      inputs[j].value = "";
    }And, finally, we call the updateInputs() function to rename all of the items on the page. Apex expects all items to have unique "f01_nnnn" etc names, adding in a new row upsets this, so we need to reset them:
    function pad(n)
    var s = '0000' + n;
    return s.substr(s.length-4);
    function updateFields(f)
      var fields = document.getElementsByName(f);
      var j;
      if (fields.length > 0)
        for (j = 0; j < fields.length; j++)
          fields[j].id = f + "_" + pad(j+1);
    function updateInputs()
    updateFields("f01");
    updateFields("f02");
    updateFields("f03");
    updateFields("f04");
    }without doing that, the data may get lost when the page is re-rendered.
    This is all called from a new Derived Column on the report. This column's HTML Expression is:
    &lt;a href="#" onclick="javascript:cloneRow(this)"&gt;&lt;img src="#IMAGE_PREFIX#FNDADD11.gif"&gt;&lt;/a&gt;which generates the + symbols which, when clicked, run the cloneRow() function
    Andy

  • Creation of new Row in Tree Table

    We are creating a new row using CreateListener which is written in Bean, after creating the row, we are adding it to the iterator and the new row is not getting highlighted and focus is not in new row in the table by default. It takes an click to make it editable. 'setActiveRowKey()' method didnot help here which is used in the af:table component to achieve the same.
    Any pointers regarding this issue would be helpful..
    Thanks,
    Shruthi

    Hi Max:
    According to what you described, it's really wierd. An ADF table is Surrounded by a panelCollection or not doesn't matter in terms of CreateInsert operations, I think. Also each step you said OK doesn't mean that step is 100% problem free towards your final goal. For example, when you drag and drop and ADF table onto a JSF page, you forget to turn on 'row selection', it will be OK, you won't get any error message, but later on when you find that you need to turn it back on, you have to go back to JSF page source, to manually added codes to do so.
    The simpliest solution and quickest one is to reinitiate a clean ADF project and do it all over again. It's simple straightforward in my view. Probably don't use PanelCollection first, just drop your ADF table on a form, or af:panelForm, but make sure your table and 'CreateInsert' button is surrounded by a form, otherwise, when you click on 'CreateInsert', nothing will happen. When everything works, then probably back it up and replace your form or af:panelForm with panelCollection. See how it goes.
    Thanks,
    Alex

  • Problems with adding a new row in my table

    Im an ADF beginner but I thought it would be simple to to do some basic CRUD stuff in ADF. Im now even struggling when i try to add a new row to my table.
    Seems that the primary key id is not set correctly...
    could someone help?

    Hi,
    Have a look to this page CREATE SEQUENCE
    Regards,
    Sébastien
    Creating a Sequence: Example
    The following statement creates the sequence customers_seq in the sample schema oe. This sequence could be used to provide customer ID numbers when rows are added to the customers table.
    CREATE SEQUENCE customers_seq START WITH     1000 INCREMENT BY   1 NOCACHE NOCYCLE;

  • Problem in adding a new row in a table.. plsss hlppp

    Hi Friends,
    I have a table defaulted to 4 rows. I have a add button to add a new row in the table.
    When i have already 4 rows in table, and when i click add its adding that 5th row correctly( and i used set_lead_selection for this new row ).
    But i want to automatically make a next page once i hit the ADD button here. Each time now i m hitting next page then only  able to see hte 5th row. I need once ADD is clicked, i want to see the 5th row visible..
    Can someone tell me how to code or do this
    thanks friends,,,
    Niraja

    hi niraja,
    Plz refer to the following code:
    method onactiononadd .
    node_material type ref to if_wd_context_node.
    elem_material type ref to if_wd_context_element.
    stru_material type sflight.
    node_material =  wd_context->get_child_node( name = 'ANNA' ).
    elem_material = node_material->get_element(  ).
    if ( elem_material is initial ).
    call method node_material->create_element
    receiving
    element = elem_material.
    endif.
    call method elem_material->get_static_attributes
    importing
    static_attributes = stru_material .
    call method node_material->bind_structure
    exporting
    new_item = stru_material
    set_initial_elements = abap_false.
    endmethod.
    i hope it helps
    regards
    arjun

Maybe you are looking for

  • How can I set Mail to show only one email at a time

    Mail will group emails based on subject or sender and then I keep losing or missing emails because they get buried in a thread. Sometimes under another persons name! I'm old and easily confused. I just want one email per line. No grouping. Can't seem

  • Keeping iTunes 10.7 on new iMac

    I am planning to purchase a new iMac in the near future and will be copying everything over from my current iMac.  One thing that potentially concerns me is that I will need to copy my large iTunes library over to the new iMac, which I assume will co

  • Adobe Premier Elements 9 stopped working randomly, Please help!

    Just recently when I try to open my Adobe Premier Elements 9 and an error message keeps popping up that says "We have detected an incompatible display driver, please update. HD Graphics 4400 3.0.0 - Build 10.18.10.3977." I went and updated the driver

  • Invoking wsdl in java

    Hi, We have an EJB project for CRM customer self service. The requirement we have is to call a wsdl which will in turn invoke a PI proxy. The wsdl file is from PI. I am not sure how to instantiate the WSDL and the proxy classes. What should be the UR

  • ACS SE & CSACS for windows

    Hello Friends, If i order Access Control Server Solution Engine (ACS SE) CSACS-1120-K9, i should'nt order a CSACS for windows CD,????? Is it ACS server is built-in in ACS SE no need of installing windows OS and on top of that ACS server ,i m confuse