Data inserting two times in a table  when i click submit button

Hi Experts,
I had a problem, when i am inserting data in a table from a form at the first time when i click button it adds two times, afterwards it is adding one time only, the form and table are from same value node (table is collection cardinality : 1..n and selection cardinality is 0..n) i don't understand why it  is happening here?
Regards,
Pradeep Kumar

Hi Pradeep,
Please check the method for inserting data in a table. May be method is called two times.
Post your code here to look into it.
Best Regards,
Arun Jaiswal

Similar Messages

  • Why the data inserted two times into the DB?

    Hai all,
    When I press the submit button in my form the data will be inserted two timesinto DB. Please help me.
    import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import com.vguss.bean.RegisterInfoBean; import com.vguss.helper.Out; public class InsertRegInfo { public static Connection connection = DBConnection.getDBConnection(); public static void insertRegData(RegisterInfoBean bean) { Connection connection = DBConnection.getDBConnection(); String loginID = bean.getLoginId(); try { PreparedStatement pst = connection .prepareStatement("SELECT login_id FROM login_details WHERE login_id = ?"); pst.setString(1, loginID); ResultSet set = pst.executeQuery(); if (!set.next()) { insertData(bean); } } catch (SQLException e1) { e1.printStackTrace(); } } private static void insertData(RegisterInfoBean bean) { try { PreparedStatement ps = connection .prepareStatement("INSERT INTO login_details (login_id, password, profile_created_by, security_question, answer, full_name, receive_sms, show_details, agree_terms, register_on) VALUES (?,?,?,?,?,?,?,?,?,now())"); ps.setString(1, bean.getLoginId()); ps.setString(2, bean.getPassword()); ps.setString(3, bean.getProf_created_by()); ps.setString(4, bean.getSecurity_Question()); ps.setString(5, bean.getAnswer()); ps.setString(6, bean.getFullName()); ps.setString(7, bean.getLikeSMS()); ps.setString(8, bean.getShowDetails()); ps.setString(9, bean.getAgreeToTerms()); ps.executeUpdate(); PreparedStatement pstmt = connection .prepareStatement("INSERT INTO user_profile (login_id, gender, email, date_of_birth) VALUES (?, ?, ?, ?)"); pstmt.setString(1, bean.getLoginId()); pstmt.setString(2, bean.getGender()); pstmt.setString(3, bean.getEmailID()); pstmt.setString(4, bean.getDateOfBirth()); pstmt.executeUpdate(); /* insert login id to preferred_partner table */ PreparedStatement pStmt = connection .prepareStatement("INSERT INTO preferred_partner (login_id) VALUES(?)"); pStmt.setString(1, bean.getLoginId()); pStmt.executeUpdate(); } catch (SQLException e) { Out.err(e); } } }

    The most obvious thought is that you have a duplicate login id.
    You're trying, but I would not consider this to be well written code, for these reasons:
    1. You don't close any JDBC resources in finally blocks - no connections, no statements, no result sets. Search the forum for people with "max open cursors exceeded" to see why this is a bad idea.
    2. You create a static Connection in this class, but nobody closes it. Classes that execute SQL should not be responsible for obtaining connections; a Connection should be provided to them. Transactions are the reason: a class executing SQL can't know if it's involved in a unit of work with other classes. Somebody who knows the use case and the transaction boundaries ought to be getting the Connection, handling commit/rollback, and closing the Connection.
    3. Refactor that INSERT into three methods. You'll be glad you did someday.
    4. Your INSERT method looks like it's doing a security check, too. Isn't it a little late for that? If you must, move that code into a separate method that returns a boolean. A well-designed method does one thing well. Yours is doing two.
    5. The common JDBC idiom isn't "if (!set.next())", it's "while (set.next())". It's good to use common idioms, because it makes it easier for other people to understand your code.
    But see if you have a repeated login ID.
    And step through in a debugger to see what's going on.
    %

  • How to get current row value from table when press the submit button

    Hi,
    I want to get the current row value of SuccessionPlanId which is one of the column in a advanced table.
    I created one button (created using personalization, action fired thru CO)in the table as column, so each row having one button, if i press the first row's button means then i want to fetch the first row's SuccessionPlanId and if it is 3rd means then i want to get the value of third row's value.
    How to do it in controller extension?
    Please reply soon, its urgent.
    Thanks in advance,
    SAN

    Pratap,
    Yes, I tried with 'delete' button which is seeded one.
    For this, our code using row reference is working too fine. it throws exact SuccessionPlanId value of corresponding row.
    I created MessageStyledText, but here i need to give text value right, then only it 'll appear in the page.
    Instead i created one image and fired explicitly from the controller processRequest method.
    But the same problem remains..
    here my code:
    public void processRequest(OAPageContext pageContext, OAWebBean webBean){
    super.processRequest(pageContext, webBean);
    OAButtonBean oabb = (OAButtonBean)webBean.findChildRecursive("XXSubmit");
    FireAction action = new FireAction("XXSubmit");
    oabb.setAttributeValue(UIConstants.PRIMARY_CLIENT_ACTION_ATTR, action);
    OAImageBean oaib=(OAImageBean)webBean.findChildRecursive("XXSubmitImage");
    oaib.setFireActionForSubmit("XXSubmitImage", null, null, true);
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){
    if("XXSubmitImage".equals(pageContext.getParameter("event"))){
    String succIdI="";
    String rowRefI = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    if(rowRefI != null && !("".equalsIgnoreCase(rowRefI ))){
    PerSuccPlanSearchVORowImpl rowI = (PerSuccPlanSearchVORowImpl)oaam.findRowByRef(rowRefI);
    if(rowI != null)
    succIdI=rowI.getAttribute("SuccessionPlanId").toString();
    }else{
    throw new OAException("Row is null");
    throw new OAException(succIdI, OAException.INFORMATION);
    }else{
    super.processFormRequest(pageContext, webBean);
    If i run the page using this controller, it throws exception without any value, because for 'succIdI' i initialized without any string.
    Can you please suggest me how to solve?

  • When we click Submit button in CSC, I want to redirect to differrent panel

    Hi All
    There is one panel for member search in CSC. from some other form I want to redirect to this 'member search' panel. what should be done?
    Thanks & Best regards,
    Pratik

    you can do this by incorporating the memberserach panel and the panel stack details in the atgSubmitAction, which can be triggered by any onClick event. For example if you have a button, onclicking the button if you want to submit and redirect tot he membersearch panel you can have somethng similar to below one
    <dspel:input type="button" value="submitForm" name="submitButton" bean="TestFormHandler.submitForm" onclick="submitForm();"/>
    and the javascript function for the submit action is something like below, replace the memberSearchPanelName and the memberSearchPanelStackName with corresponding panel and panel stack names for the member search form u have
    <script type="text/javascript">
    submitButton=function(){
    var submitForm=dojo.byId("submitPanelForm"); //get the form to be submitted
    atgSubmitAction({
    form: submitForm,
    panels: ["memberSearchPanelName"],
    panelStack: ["memberSearchPanelStackName"]
    </script>
    HTH
    Thanks,
    Rajesh Akavaram

  • What happens when you click SUBMIT ? URGENT HELP

    Hi,
    I have a requirement where I want to know all the records that are submitted this year.
    Can anybody tell me which column gets auto populated (Vanilla funcationality) in S_EVT_ACT when we click the Submit button ??
    Thanks :-)

    Hi,
    Thanks for the help.
    I am using Siebel ePharma 7.7.2.6.
    No I will not be able to use the Start Date. I want the records submitted this year because of which I cannot use Start Date.
    In S_EVT_ACT, there is a column Call_Submit_Date. But that dosent get populated by default. I wanted to know is there any column which get populated by default (Vanilla functionality) when you click Submit button.
    Thanks :)

  • Apply the same LCR two times on different tables

    Hi all
    Just one question:
    Can I apply the same LCR two times on different tables using only one apply queue?
    For example executing two times LCR.EXECUTE(TRUE) in a procedure handler:
    LCR.EXECUTE(TRUE);
    LCR.EXECUTE(TRUE);
    ....

    Topas,
    You need to create new LCR and execute both LCRs.
    Regards,
    Serge

  • Hi there, I am trying to connect to my server at work from home using a vpn connection. It connects fine and the time ticks along, but when i click go - connect to server, it comes up with connection failed. Please help!

    Hi there, I am trying to connect to my server at work from home using a vpn connection. It connects fine and the time ticks along, but when i click go - connect to server, it comes up with connection failed. Please help!

    ... when i click go - connect to server, it comes up with connection failed.
    If you're trying to connect to a Bonjour server on the remote network, that won't work over a layer 3 VPN. Use something like Hamachi or one of the SSH-tunnelling Bonjour proxy apps for that.

  • Thanks For Your Support in advance i want to know that when I open a website that time view print option and when I click close button then page also new window page also close. I want to copy it how i can stop this print option?

    WHEN I OPEN A URL THAT TIME WITH PAGE OPEN SHOWS PRINT OPTION AND WHEN I CLICK CLOSE BUTTON OF PRINT OPTION THAT TIME NEW WINDOW BUTTON IS CLOSED. I WANT TO CLOSE ONLY PRINT OPTION. PLEASE HELP ME...............THANKS

    Many sites which offer specific "print formatted" pages do that: they assume that once you have finished with the print dialog you no longer want the page itself. So for your convenience they close it. Not so convenient for you, since you still want to view the page.
    I'm not aware of an easy solution for this. I can think of a couple different approaches.
    First, maybe there's an add-on to solve this? That would be easiest.
    Second, maybe there's a userscript to solve this?
    The Greasemonkey add-on runs userscripts which you can copy or download. Be careful to install only long-establish and trusted scripts. (''Is there a site that has this bad behavior that I can view without logging in? I will test one of my existing scripts to see whether it helps.'')
    Third, Firefox has an old system for restricting site permissions in a custom text file in your profile folder (named user.js). Editing this file is a bit advanced, and I haven't been able to test it, but the system works along these lines:
    <br>// Define a policy name for window.close permission
    // (assumes you don't have this pref already)
    user_pref("capability.policy.policynames", "nowindowclose");
    // Define policy: disable sites from using window.close
    // in their scripts
    user_pref("capability.policy.nowindowclose.Window.close", "noAccess");
    // List of sites subject to this policy
    user_pref("capability.policy.nowindowclose.sites", "firstbadsite.com secondbadsite.com");
    Again, I haven't tested that and recommend looking into add-ons first.

  • I inserted a HTML5 video in page, when I test it in a Browser, I see the poster image and controls, But when I click play button the video goes white, slider moves like its playing, but just white picture. There was no audio included in video. Please help

    I inserted a HTML5 video in page, when I test it in a Browser, I see the poster image and controls, But when I click play button the video goes white, slider moves like its playing, but just white picture. There was no audio included in video. Please help

    Without a link, it's anybody's guess.
    It could be a problem the video rendering itself.  Which software did you use?
    Did you export to the 3 file types -- MP4, OGG and WEBM to support all browsers?
    Does your web server support those 3 MIME file types?
    Nancy O.

  • Yesterday, since I downloaded the lastest version 3.6.6, every time firefox opens and when I click on something, I get multiple error windows that say "ERROR: Security Manager Vetoed Action. I can't hardly use if anymore because of all the window pop-ups

    Yesterday, since I downloaded the latest version 3.6.6, every time firefox opens and when I click on something, I get multiple error windows that say "ERROR: Security Manager Vetoed Action". I can't hardly use if anymore because of all the window pop-ups. What can I do? Can I go back to an older version?
    == This happened ==
    Every time Firefox opened
    == I downloaded version 3.6.6 yesterday

    hello, when this is happening after you've already updated firefox with your admin account, try to delete the ''updates'' folder and ''active-update.xml & updates.xml'' within the %localappdata% folder of your restricted account like it is described in http://kb.mozillazine.org/Software_Update#Software_Update_not_working_properly

  • Hi I'm using Captivate 7 in Windows Vista. I can't insert characters on my slide. When I click on "Insert - Characters" nothing happens. Please help!

    Hi I'm using Captivate 7 in Windows Vista. I can't insert characters on my slide. When I click on "Insert - Characters" nothing happens. Please help!

    Go to /Library/Internet Plug-Ins.
    If you see the PDF Browser Plug-in, move it to the Trash.

  • Prompt user, when hitting with SUBMIT button

    Hello folks,
    I have application with student record, on 1st page user enters student's name and on 2nd page user enters students grade and their are two buttons on 3rd page saying SAVE and SUBMIT, with the hitting of both the buttons students record enterred by the user will be INSERTED into DB table.
    Now I want to add a functionality saying, student_name as mandatory filled <b>only when user hits SUBMIT button</b> on 3rd page, hence user cannot submit leaving mandatory filled as empty. So I want to prompt a window on 3rd page with the student_name item where user can enter student's name and hit OK button the same prompted window which will help user to SUBMIT that particular student.
    any idea how to achieve it, how to validate and prompt user, when user submits students without entering mandatory items/fields.
    Thanks
    Deep.

    Hi Dan,
    Thanks for replying, yes I'm very aware about your reply but I'm having req. so was trying to implement same into my current application.
    I tried a small example into apex workspace to better understand have a look into it:-
    workspace :- deepapex
    username :- [email protected]
    password :- walubu
    application "Prompt_only_for_Submit"
    I kept validation on page 3 if user doesnt enters student_name(on page 1) upto here it's working perfect than I started implementing JavaScript to open a prompt, but I want to open this prompt only when user doesnt enters student_name on page 1 and not everytime, also within this prompt I was looking how to have text_box item where user can enter student_name on page 3 where he actually forgotted to enter on page 1, so this new student_name item will go into insert process and hence this will be done, I'm away of the logic but really lacking to implement it.
    So if you can help little it will be glad to you.
    Thanks
    Deep.

  • How can i uncheck a checkbox in table component on clicking a button

    In my application I have a table component that display data from the database and a submit button outside the table component, the first column in the table component is a checkbox, How can i uncheck the checkbox in the table component when the submit button is clicked?
    Thanks in advance.

    Something like this ... I THINK it will uncheck all checkboxes in table, but I'm not positive ... you can test!
    if checkbox id is checkbox1...
    <script type="text/javascript"><![CDATA[                                         
    function disableCheckbox()
    document.getElementById('form1:checkbox1').selected = false;
    }]]></script>Put above code inside of head tag in JSP View
    NEXT...
    go to Design View and select your button and go to properties section and select onClick property and insert this javascript in dialog...
    setTimeout('disableCheckbox()', 1)Now run the project when you click the button does the checkbox become unselected?
    Anyway this is where I would start...as far as selecting just the first checkbox if there is more than 1 record...I'm not sure...but I'm curious if this works.
    Jason

  • Calling billing and delivery transactions when i click the button in webdyn

    Hi,
    How to call the transactions like billing and delivery when i click the button.I am developing a webdynpro alv report in that 2 buttons are there.one is confirmation and another is cancel.
    I want to call the billing transaction when i press the confirmation button?

    Hi Lakshmi,
    It is not possible to directly call a transaction code from a wev application. Calling a transaction involves launching of SAP Dynpros which is not supported by WDA frame work.
    One possible ways is to use transactional iViews in Portal. We can Associate a transaction code to this and when called, it launches the same in an R/3 Screen.
    If you are using portal as a triggerring point of your web dynpro applications, then the below requirement is achieved by doing the following.
    1. Create a BDC report program to call transaction CAT2 skipping the first screen.
    2. The report has the same input parameters as that of the transaction CAT2.
    3. Associate a transaction to the report program sat 'ZCAT2'.
    In the event handler of the button in your web dynpro do that following
    Data declarations
    Local Internal tables(lt_)
    lt_bus_parameter_list TYPE wdy_key_value_table,
    lt_launcher_parameter_list TYPE wdy_key_value_table,
    Local Work area's(ls_)
    ls_keyvalue_pair TYPE wdy_key_value,
    Local Variables(l_)
    l_pcdpageurl TYPE string,
    l_componentcontroller TYPE REF TO if_wd_component,
    l_port_manager TYPE REF TO if_wd_portal_integration.
    Constants(c_)
    CONSTANTS:
    c_transaction_code TYPE string VALUE 'ZCAT2',
    c_okcode TYPE string VALUE 'F8',
    c_param1 TYPE string VALUE 'P_Data_Entry_Profile',
    c_param2 TYPE string VALUE 'P_person_number'.
    l_componentcontroller = wd_this->wd_get_api( ).
    l_port_manager = l_componentcontroller->get_portal_manager( ).
    Fill all the business parameters
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = c_param1.
    ls_keyvalue_pair-value = 'Data Entry Profile'.
    APPEND ls_keyvalue_pair TO lt_bus_parameter_list .
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = c_param2.
    ls_keyvalue_pair-value = 'Person Number'.
    APPEND ls_keyvalue_pair TO lt_bus_parameter_list .
    Fill the launcher parameters for the transaction
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'AutoStart'.
    ls_keyvalue_pair-value = 'Yes'.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'GuiType'.
    ls_keyvalue_pair-value = 'WinGui'.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'OkCode'.
    ls_keyvalue_pair-value = c_okcode.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'System'.
    ls_keyvalue_pair-value = 'SAP_R3_HumanResources'.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'TCode'.
    ls_keyvalue_pair-value = c_transaction_code.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'Technique'.
    ls_keyvalue_pair-value = 'SSF'.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    CLEAR ls_keyvalue_pair.
    ls_keyvalue_pair-key = 'WinGui_Type'.
    ls_keyvalue_pair-value = 'Shortcut'.
    APPEND ls_keyvalue_pair TO lt_launcher_parameter_list.
    SAP has provided us with customizing table to maintain the path for the iView.Here Resource_key is the key field to get the path.
    We create a new entry in this table using which we uniquely identify the path of the iVew that needs to be launched.
    get the url of the pcd page for the common transaction iView
    SELECT SINGLE b~text
    INTO l_pcdpageurl
    FROM t7xssserstring AS b
    INNER JOIN t7xssserres AS a
    ON a~respcdpage = b~guid
    WHERE a~ressource = /rio/zcl_hse_constants=>c_common_resource.
    Navigate to the Injury Illness details
    CALL METHOD l_port_manager->navigate_absolute
    EXPORTING
    navigation_target = l_pcdpageurl
    navigation_mode = l_port_manager->co_show_external
    use_sap_launcher = abap_true
    business_parameters = lt_bus_parameter_list
    launcher_parameters = lt_launcher_parameter_list.
    The folowing is the flow of the program:
    When user clicks a button to launch transaction CAT2, the event handler associated to it called.
    Here we populate an internal table with the parameters to call transaction ZCAT2 and the iView is launched by calling navigate_absolute method with the right path.
    I am not very much sure as to how the iViews are set up but there is a provision to read the key valure pair there. The values are read and the tranzation ZCAT2 is called which will inturn launch CAT2 transaction.
    By adding Skip First screen statement we can get in the details directly.
    Hope this helps.
    Regards,
    Sravan Varagani

  • Problem report only print out when i click back button

    hi all..i having problem with my report print program. the problem is my report did not immediately print out when i click print button. the program require me to click back button before print out execute. please help me to solve this problem. Thank you.
    Edited by: padile on Jan 7, 2010 3:51 AM

    Hi,
    In your program, mention the following:
    DATA: gs_out_opt TYPE ssfcompop.
    gs_out_opt-tdimmed = 'X'           "Print immediately
    CALL FUNCTION lv_fname         "Smartform FM
          EXPORTING
            output_options     = gs_out_opt  
    Regards,
    Dawood.

Maybe you are looking for

  • Graphic Card Upgrade for a HP Q815

    HP is telling me  that a NVIDIA GeForce 9600M GS is recomended for an upgrade on my IQ815 desktop touchscreen. But it only has 512MB of memory. i would like to put a NVIDIA GeForce 9600M GT has 1024MB of RAM on it or 1 dollar more. Could I put this o

  • Error when creating a source of supply list via me01 and/otr me05

    Dear expert, We use SAP R/3 4.6c release. I'm trying to create a source of supply that uses a contract. I get an error message 'Object does not exist'. When I look at the details of this messsage I see it is Message OL 826  Diagnosis : You tried to c

  • Java text to unicode or UTF-16?

    Hi all, I get a string inputed in by the user, say 〹. I want to add this to an internal string, but as a unicode formated string. Otherwise when I write this string out using a XML formater, it encodes the ampersand character as & Does anybody know h

  • How do I insert  input data into anoracle table using C#

    Hi guys, I am new in the .NET arena and I am using Visual Studio 2005 Pro edition.. For instance I have 2 forms one being the main form which calls another to to insert captured text onto a form with the idea of passing it into the oracle database. I

  • HT3951 Error message trying to download icloud songs purchased

    I'm trying to download my icloud purchased songs to a laptop but I am getting an error message that I do not have enough access privileges for this action.  Does anyone know what this means? Thanks.