Change item value before commit

Hello,
I have a form in which I issue an execute_query from a mouse click to retrieve database values from a data block onto a form. The user is then able to change the values of these items on the form and commit them via a button on the form. What I want to do is make sure that some of the values, based on another item in the block, are negative and if not, change them to a negative value. before the changes are commited. I can't seem to find the right trigger to accomplish this-- has anyone have an idea on how to do this?
Thanks in advance.
Jeff

Hi,
How about putting your code in :
1. Pre-Update or
2. When-Database-Record
[Block Level trigger]
The trigger text could be something like :
If (:block.col is > 0 ) Then
:block.col := :block.col * -1;
End If;
-- Shailender Mehta --

Similar Messages

  • Changing Item Values before saving Purchase Requisition in me51n, set_data function

    Hello,
            I have written a user exit, which is called whenever changes are made to a purchase requisition. User Exit is MEREQ001 , function module EXIT_SAPLMEREQ_010 . My requirement here is that the Requisitioner should be 135 for every PR item under certain conditions. Therefore whenever there is any change made to the PR, before saving the PR item, I need to set the Requisitioner to 135, give a status message saying that the Requisitioner is set to 135 and save the Pr with the changed values. Following is the code I have written in EXIT_SAPLMEREQ_010. However, the set_data function called below does not change the PR values. Pls help
    data: lt_item type mmpur_requisition_items,
           wa_item type mmpur_requisition_item,
           wa_itemdet type mereq_item,
           wa_itemref type ref to if_purchase_requisition_item,
           w_message type i.
    constants: c_135 type afnam value '135'.
    call method im_req_header->get_items
         receiving
                 re_items = lt_item.
        loop at lt_item into wa_item.
         wa_itemref = wa_item-item.
         wa_itemdet = wa_itemref->get_data( ).
         if wa_itemdet-afnam ne c_135.
           w_message = 1.
           wa_itemdet-afnam = c_135.
           call method wa_itemref->set_data( wa_itemdet ).
         endif.
       endloop.
      IF w_message = 1.
        MESSAGE 'Requisitioner defaulted to 135 for all items' TYPE 'I'.
      ENDIF.

    Hi Sachin,
               I am able to get a reference to if_purchase_requisition_item in my code (wa_itemref ) and am also able to access each of the line items in the PR in the work area wa_itemdet.
    At this point in the code ( wa_itemdet-afnam = c_135 ) , the work area value is set to '135', However, call method wa_itemref->set_data( wa_itemdet ), does not change the values of the work area wa_itemdet . Pls help

  • Encrypt value before commit

    Hello,
    I'm using Oracle JDeveloper 11g Release 2 (11.1.2.3.0).
    I have a form that the user must enter some values, one of these values is a password. I need to pick up that value before commit and encrypt it. Actually the password is stored in the database without encyptation, just as the user entered it.
    My application does not use adf security, and now it's too late to change everything.
    Any idea that how  can I fix this?
    Thanks in advance!

    Hello Shay!
    Thanks a lot for your answer, I'm newby in ADF and I don't know how to do that. I think that the easiest option is to overwrite the doDML method.
    I overwrite this method in the EOImpl and, now I have this:
         * Custom DML update/insert/delete logic here.
         * @param operation the operation type
         * @param e the transaction event
        protected void doDML(int operation, TransactionEvent e) {
            super.doDML(operation, e);
    I have a method called encrypt(password), that return the password encrypted.
    How can I set the new string to the password attribute when I update on database? I guess I have to insert this code before super.doDML(operation e);, is it?
      if (operation == this.DML_UPDATE){
                // CODE HERE
    Please can you help me with this? Thanks in advance!

  • How check value befor commit my form

    hi master
    sir
    how check value befor commit my form if that value right than commit otherwise show message box and not save
    please give me idea
    thanking you
    aamir

    Have you not tried using When-Validate-Item Trigger.
    Like if i have an Item Which can only take dates between sysdate and sysdate-3 your code in when-validate of the item should be
    If :BlockName.ItemName NOT BETWEEN SYSDATE-3 AND SYSDATE THEN
    MESSAGE('Pleaes Enter valid date);
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    This will fire, and commit will fail.

  • Change item value by process in DML Form: best practice?

    Hi,
    i have a working DML Form and would like to build an option for choosing values in a popup window and refreshing the page items after closing the popup window.
    the DML Form has a button which opens the popup window with
    javascript:popUp2('f?p=&APP_ID.:210:&SESSION.', 600, 580)
    the popup window has a javascript function under HTML Header
    <script language="JavaScript">
    function passBack2()
    doSubmit();window.opener.doSubmit();window.close();
    </script>
    and a button which called the javascript function
    javascript:passBack2();
    while the user chooses a new value and closed the popup window an application item holds the selected value.
    the following page rendering of my DML Form use the application item in before header computations to get the new values.
    from the developer toolbar's session link i found the values changed by the computation correctly and signed with 'I' but they will not displayed in the page and will not used in the Automatic Row Processing update.
    how to accomplish this?
    Michael

    Michael,
    while the user chooses a new value and closed the popup window an application item holds the selected value.
    How does that happen, with an after-submit process on page 210?
    the following page rendering of my DML Form use the application item in before header computations to get the new values.
    All your popup page does is submit itself and then submit the calling page. There is no invocation of the before-header computation on the calling page in this sequence. You should use an after-submit computation.
    Scott

  • Developer 10g Capture All CHANGED Item Values

    Still learning this application one module at a time so be kind :)
    What is the most efficient way to capture all the data block item values that have changed on the form at say the pre-update trigger?
    I'm thinking of testing for:
    RECORD_STATUS = 'CHANGED'
    and if true then assign the first item to v_item using:
    v_item := 'block_name' || '.' || get_block_property('block_name',first_item)
    Then loop through each item in the block and test the DATABASE_VALUE against the form value and if they are not equal the assign the DB value to a variable and the form value to a variable and build a string of text to be displayed to the user by using:
    IF GET_ITEM_PROPERTY(v_item,DATABASE_VALUE) <> :BLOCK_NAME.ITEM_NAME THEN
    v_dbvalue := GET_ITEM_PROPERTY(v_item,DATABASE_VALUE);
    v_frmvalue := :BLOCK_NAME.GET_ITEM_PROPERTY(v_item,ITEM_NAME);
    v_string := v_string || 'Old value was ' || v_dbvalue || ' and new value is ' || v_form value;
    Then advance to the next item by resetting the v_item variable to the next item using:
    v_item := 'BLOCK_NAME' || '.' || GET_ITEM_PROPERTY(v_item,NEXTITEM);
    And repeat the process until there are no more items in the block:
    EXIT WHEN 'BLOCK_NAME' || '.' || NULL;
    So what would be the most efficient way to do this?

    The form holds information that is inserted by a technician then the manager of the technician has to approve the info and submit it to the director for final approval.
    So what I do is capture any of the changes that the technician makes and put that sting into an email and send it to the manager so they know that changes were made to the record and they can approve or decline the changes before submitting it on to the director.
    My successful POST-UPDATE trigger at the form level ended up like:
    <<
    p_html := 'Catalog item ' || :ITEMS.MANUFACTURER || ' - ' || :ITEMS.MODEL_DESC || ' ' || :ITEMS.MODEL || ' has been modified and the results are as follows: <br> ';
    v_item := 'ITEMS' || '.' || get_block_property('ITEMS',first_item);
    <<item_loop>>
    loop
    exit when v_item = 'ITEMS' || '.' || null;
    v_dbvalue := GET_ITEM_PROPERTY(v_item,DATABASE_VALUE);
    v_itemname := GET_ITEM_PROPERTY(v_item,ITEM_NAME);
    v_block := 'ITEMS';
    v_name := v_block || '.' || v_itemname;
    v_frmvalue := NAME_IN(v_name);
    IF v_dbvalue <> v_frmvalue THEN
    p_html := p_html || 'OLD VALUE WAS: ' || v_dbvalue || '<br>AND NEW VALUE IS: ' || v_frmvalue || '<br>';
    END IF;
    v_item := 'ITEMS' || '.' || get_item_property(v_item,nextitem );
    >>
    The p_html variable is the string that I send to the email package to send out via our mail service.
    Maybe this will help someone with a similar need.
    Cheers,
    Max

  • Setting an item value before print report in BI Publisher

    Hi,
    I am having an issue with setting a page item's value once a button (that prints a BI Publisher report) is pressed. The session state for the item is set, however because the page does not re-load no value appears in the item on the page.
    I am using a button as a page Item and using a Page Branch with the Branch Point set as On Submit: After Processing(After Computation, Validation, and Processing) with the Page set to 0 and the Request set to PRINT_REPORT=REPORT
    Is there any way to set the item value on the page before branching to the report?
    Your help is greatly appreciated.
    -Marsha

    Marsha,
    You can do that as follows:
    1- create a hidden text item (P20_date_hidden) with default value set to sysdate.
    2- for your button >> edit >> Buttom display attributes >> attributes >> type in : onFocus= "set_date();" (( note: am using onFocus because it takes places before onClick ))
    3- In your page >> edit >> HTML header >> type in :
    <script language="JavaScript" type="text/javascript">
    function set_date()
    v_date = $x('P20_DATE_HIDDEN').value;
    $x('P20_DATE_LETTER_SENT').value = v_date;
    </script>
    Hope this helps,
    Sam
    Please reward good answers by marking them correct or useful!

  • Change item value when a specific item has changed... how can i do that?

    Hi guys, i need to ask something...
    Is it possible to have a process or a computation, that gives value to an item, only when one specific item has changed.
    I have other items on my page too, but this two are related, and i need to give a specific value to the first one, only when the value of the second has changed...
    Help please
    tsveti:)

    Hey Farhan, i guess i need some help on that easy javascript...
    i havent done much thing with it so i have almost none experience with js....
    So in 'HTML Form Element Attributes' for the second item I m trying this :
    onchange="javascript:{document.getElementById('P1_SUBPROJECT').value = '-1';}"
    but when i change the value of this second item, the first one (P1_SUBPROJECT) dont get -1
    what am i doing wrong?

  • Change ITEM value:  VARAD

    Hi,
    My question is:
    When page is populated the project_id is equal to 8, when I change project_id to 5 and click Submit button it updates the record with project_id 8 and not 5.
    Is there a way to change this so that it gets the current value....
    Thank You for your help and suggestions
    Jesh
    Edited by: user11095252 on Jul 24, 2009 12:35 PM

    Varad,
    I tried using the javascript popup found in this script, but still no luck
    Re: open popup window and passing parameter to the popup
    When I look at the session on the popup page, the value is still not passed and
    when i change the value of project_id (in the main page, which is page 1) from 8 to 5 and I click on sessions at the bottom of the screen, it still shows 8
    Also have a similar case posted on this Thread: Add Insert & Update
    Add Insert & Update
    I might need some help with this
    Thank You for your time
    Jesh

  • Change item value at Sales Invoice form before create a document

    HI,
    I am trying to change value for "TrackNo" item on the sales invoice form just before create a sales invoice,
    I have the following code:
    Dim oForm As SAPbouiCOM.Form
    Dim oItem As SAPbouiCOM.Item
    Dim oEdit As SAPbouiCOM.EditText
    Dim periodo As String
    Dim sf As String
    Try
       oForm = Nothing
       oForm = entorno.Forms.Item(FormUID)
       oItem = oForm.Items.Item("251")
       oEdit = oItem.Specific
       oEdit.String = "Y"
    Catch
    End Try
    It seems to work only If i have selected the logistics folder ( the folder where the "TrackNo" Item is located)
    If I have selected another folder as "contents" or "Accouting" when I create the document it fails.
    Can you help me with this problem?
    Many Thanks

    Buenas Sergio,
    Try forcing a click event on the logistic folder. I don´t think there is another option. You are only able to asign the value if the control is visible(and editable).
    Regards,
    Ibai Peñ

  • How to refresh list item values before report is run?

    We have two SELECT LIST items (drop boxes) on our report. One SELECT LIST has values of "World Region" (e.g. NORTH AMERICA, SOUTH AMERICA, EUROPE, ASIA)
    the other SELECT LIST has values of "Subregion" (e.g. NORTHERN EUROPE, SOUTHERN EUROPE, SOUTHEAST ASIA etc...)
    The values in the Subregion list are dependent on the value that is chosen from the "World Region" List. Can someone tell up how to update the values in the Subregion list BEFORE we submit the page? We can get these values to update (via sql query) when the page is submitted but that is only happening after the report gets run- which is not what we want. We want the user to select a Region from one SELECT LIST and then see all the qualifying Subregions for that Region in the Subregion SELECT LIST. Only after both Region and Subregion have been selected do we want to run the report. Thank for any help on this.

    hey john--
    john) things like Scott's reference to "The name of the LOV Item". What does this really mean?
    raj) in htmldb there's a concept of items at the page and at the app level. page level items have ui component associated with them. in scott's explanation above, he's talking about using a page-level item with a "Display as" type of "select list w/submit" for your first select list. in that case, he's suggesting you have one select list item drive the values of another. when the self-submitting select list submits the page, it sets an htmldb built-in variable called :REQUEST to the name of the self-submitting select list item. in your follow-up post's example, that'd be "REGION_LIST". scott was explaining how you could control the functionality on your page by adding conditions to things like...
    :REQUEST = 'REGION_LIST'
    ...or using declarative Condition options like "Request = Expression 1" and then putting the string "REGION_LIST" in that Expression1 field. so in your case, you have a report region that you don't want displayed until the user's done selecting from your Subregion list. an easy way to handle that would be to add a hidden item (where "Display as" is set to "Hidden") to your page, for example :P1_LAST_REQUEST, to store the last value of :REQUEST. put a Computation on your page that populates :P1_LAST_REQUEST with :REQUEST each time the page is submitted. then put a Condition on your report region that makes it only render when :P1_LAST_REQUEST != 'REGION_LIST'. so this way your users can select a Region and have the page submit itself. the page will then redraw with the values of subregion list correctly populated (you'd presumably use :REGION_LIST in your subregion LOV query to achieve the filtered values) w/o your report region displayed. the user would then select a correct subregion and click some sort of "run my report" button. this time when the page redraws, :P1_LAST_REQUEST would be set so something other than "REGION_LIST" (it'd be set to whatever you named your "run my report button") and so your report region would display as desired.
    hope this helps,
    raj

  • Validation of Item Values before saving the form

    Hi,
    I have requirement in Oracle Forms, we give header information as per the requirement and the lines info of the specific header. In lines whe have two feild as type and amount. If the type is 'E' then we need to sum up the amount value as credit and if type is 'F' we need to sum up of those feild values as Debit and before saving the form we need to check the sum of Credit and Debit is equal or not if equal then we should allow to save the form else it should not. We can have multiple lines under single header..Can any body help on this..Its very emergency..
    Thanks,
    Maggi.

    Hi,
    In Customer-exit ILOM0001 read table IMPT_BUF[] from sap stack. It contains all enteries of measuring points.
    Use below mentioned code in above exits for your reference.
    FIELD-SYMBOLS : <fs_impt> type ANY TABLE.
    data : tab_impt type TABLE OF impt.
    ASSIGN ('(SAPLIMR0)IMPT_BUF[]') to <fs_impt>.
    if sy-subrc is INITIAL.
      tab_impt = <fs_impt>.
    endif.
    table TAB_IMPT is filled wilth all entries of measuring point while creating and changing functional location.
    Thanks,
    Vijay

  • Retrieving DbSequence Value Before Commit

    Hello,
    I'm creating a user registration page which is a flow of 3 pages (Each Page contains an ADF input form which corresponds to a DB table).
    I am using DbSequence for generating the primary keys for three tables. I need to get the Dbsequence value after the first submit was done, in the second page as it is the foreign key to the second table. I'm getting a negative number , if I dont use commit in the first page.
    I want to store the values of the three forms in the temporary tables , and commit only if the third form is successfully submitted.
    Is it possible to do that?
    Thanks.

    I'm using UIX,ADF and Struts. This topic is being followed in
    Insert Foreign Key From Already Available DBSequence Binding

  • How to change item value after re-loading the page.

    Hi all,
    I have two pages 1,2. From page 1 I am calling page2 (like LOV) by using callMyPopup and in page2 i am setting some variables and returns/refreshes to page1 refreshes using window.opener.window.location=new_url java script, at same time it pass few parameters to page1. How can I write some pl/sql code to show some message to user on page1. I mean I am returning some numbers so i want change into meaning full text. I tried processes no luck. Please help me.
    Thanks

    Hey James.
    Please share with everyone,
    Which version of Oracle Apex are you using?
    What is the Database version.
    and what is the Browser version and type?

  • Problem setting a hidden item value when button clicked with dynamic action or pl/sql process

    Apex 4.1
    Oracle 11g
    I have a page that consists of a main region and several sub regions.  I have a pl/sql process in After Header SET_DISPLAY(:P400_DISPLAY :='MAIN';)
    Three subregions have a contional display where P400_DISPLAY = STORE.  This works in hiding the sub regions.
    Now I want to change the P400_DISPLAY value to STORE to show the subregions when I hit a button.
    I tried creating a dynamic action for on click of the add button but get the following error:
    The selected button uses a 'Button Template' that does not contain the #BUTTON_ID# substitution string
    I went to the templates and found:
    Substitution Strings
    Substitution strings are used within sub templates to reference component values. This report details substitution string usage for this template.
    Substitution String
    Referenced
    From
    Description
    #LINK#
    Yes
    Template
    To be used in an "href" attribute
    #JAVASCRIPT#
    No
    To be used in an "onclick" attribute
    #LABEL#
    Yes
    Template
    Button Label
    #BUTTON_ATTRIBUTES#
    No
    Button Attributes
    #BUTTON_ID#
    No
    Generated button ID will be either the button's Static ID if defined, or if not will be an internally generated ID in the format 'B' || [Internal Button ID]
    I then tried creating a page process, pl/sql, :P400_DISPLAY :='STORE'; when the appropriate button is pressed.  The button action is submit page. However, it does not change the P400_DISPLAY value and the subregions stay hidden.
    Suggestions please on how to fix the template or change the P400_DISPLAY value?

    The root issue is that, although you change the value of your page item, it isn't visible to other areas of the page until it is in the session. So, any other action based on the value of your page item; the visibility of a control, a report based on the item's value, etc. will all be unaffected by changing the value of the page item until it has been changed in the session. Even after this the items are stored in the session, you must thereafter do something to cause the value to be reevaluated. To see the effect of this, observe that your page loads and evaluates the value of your page item, it sees that is "MAIN" and hides the regions. However, it doesn't reevaluate them after this.
    So; your choices to get this value set in the session are to either Submit the page, or use JavaScript to set the value in the session. If you use the latter of these, you'll have to do some further work to cause the visibility tests to be re-run, So, let's stick with with the submit method.
    What you've done above sounds correct for this but, there are a lot of decisions you could have made that might have caused things not to happen in the correct sequence.
    Firstly, let's confirm that what I describe above is your problem. From the development environment, load the page, click the button to change the value and submit. Now, click the link labelled Session. Is it still set to MAIN? If so; this is your issue.
    Let's start with the your After Header computation. Did you set it to *only* run if the current value of your page item is NULL??? If not, that's your problem.
    Load Page -> Item set to 'Main' by Computation -> Click Button -> Item set to STORE -> Submit -> Load Page -> Item set to 'Main' by Computation
    See the problem?
    Assuming this isn't the issue, you created a Branch to the same page, right? What is your process point for the Branch? Is it *After* Validation, Computation etc? Because if not, you aren't changing the value before the submit happens.
    I bet it is the first issue but, take a look at these.
    Cheers,
    -Joe

Maybe you are looking for

  • FI MM integration _ Asset acquisition through PO

    Hi, in FI MM integration , Asset acquisition through PO - Do we need any configuration in OBYC/OBYD? Thank you Vedavatee

  • Business area vs profit center togather

    HI, FRIENDS friends i need to know that can we use business area and profit center to gather at a time. eg 1). business area at different region in the country.(different branchs) 2)  profit center at product line level.( different products) please h

  • Cannot resolve "missing return statement error"

    Hi, I have a small code where the following message is received when I am trying to compile it: 61: missing return statement ^ 1 error I cannot figure out what is the source of the error. I appreciate any help in advance. Thanks THE FULL CODE: import

  • Why does my sound only work with my head phones?

    I recently discovered that my iPhone 4s has not been functioning the way it should be. My sound and speaker are not working. I can't even adjust my volume unless I have my headphones. I can't hear my incoming calls and they can't hear me. This happen

  • YES CERTIFIED Bulletin - for Novell produkts

    Hi, for a customer short-term project, I desperately need to IPv6 compatibility statements. Best described as YES CERTIFIED Bulletin, as was previously possible. The products are: Novell OES2SP3 eDirectory, Version 8.8 Novell Client and Novell client