Problem with inserting new records in Oracle Forms

Hi Friends,
I am a new user to Oracle Forms and I need a help from you people. The problem is as follows:
I have a data block in which I can display a number of records. In this data block the user will be able to edit the fields if no child records are found in another table. I have used when-new-record-instance to attain this scenario. All are text items. One item licensee_id which is made invisible by setting the property in property palette and required=no ( as this is the primary key of the table). Also the audit columns are made invisible.
The code for it is as follows:
DECLARE
     v_alert_button NUMBER;
     v_cnt                          NUMBER;
BEGIN
     SELECT COUNT (*)
INTO v_cnt
FROM id_rev_contracts
WHERE licensee_id = :ID_REV_LICENSEES.licensee_id;
IF v_cnt > 0 THEN
set_item_property('ID_REV_LICENSEES.LICENSEE_NAME', UPDATE_ALLOWED, PROPERTY_FALSE);
ELSE
     set_item_property('ID_REV_LICENSEES.LICENSEE_NAME', UPDATE_ALLOWED, PROPERTY_TRUE);
     -- set_item_property('ID_REV_LICENSEES.LICENSEE_NAME', INSERT_ALLOWED, PROPERTY_TRUE);
END IF;
END;
Now in this data block I should also be able to insert new records and for the same I have used PRE-INSERT trigger and the code for it is as follows:
DECLARE
     v_alert_button NUMBER;
CURSOR v_licensee_id IS SELECT id_rev_licensees_s.NEXTVAL FROM dual;
BEGIN
OPEN v_licensee_id;
FETCH v_licensee_id INTO :id_rev_licensees.licensee_id;
CLOSE v_licensee_id;
IF :id_rev_licensees.licensee_id IS NULL THEN
Message('Error Generating Next v_licensee_id');
RAISE Form_Trigger_Failure;
END IF;
:ID_REV_LICENSEES.created_by := :GLOBAL.g_login_name;
:ID_REV_LICENSEES.last_updated_by := :GLOBAL.g_login_name;
:ID_REV_LICENSEES.create_date := SYSDATE;
:ID_REV_LICENSEES.last_update_date := SYSDATE;
EXCEPTION
WHEN form_trigger_failure
THEN
RAISE form_trigger_failure;
WHEN OTHERS
THEN
v_alert_button :=
msgbox ('ERROR in Pre-Insert - ' || SQLERRM, 'STOP', 'Contact IST');
RAISE form_trigger_failure;
END;
Every thing is compiling fine but at the run time when I am trying to insert a new record I am receiving the following error:
FRM-40508:ORACLE error:unable to insert record
I also think the pre-insert record is not firing at the time of inserting a new record and saving it. So I request you to please delve into this problem and suggest me how to overcome this problem. Code snippets would do more help for me. If you need any other things from me please let me know. I will see if I could be of any help in that concern because I may not be able to send the entire form as it is.
Thanks and regards,
Vamsi K Gummadi.

first of all
pre-insert fires after the implicit/explicit commit/commit_form is issued and before the real insert is submitted to the db.
i would suggest to remove the error handling part for the moment
because i believe you might be getting "ora-xxxx cannot insert null"
and also make visible the primary column to check if the pre-insert is executed.
it would be better to make visible for a while the not null columns of the table/block
i suppose that the block is insert allowed and you are using table as the source of the block and not any procedures or something...

Similar Messages

  • Problem with Image IO jre on Oracle Form

    I'm using PJC to run my Text Editor program from Oracle Form. The Editor has an Image drag & drop option and I have to upgrade the jre with Image I/O API for this functionality. To upgrade jre the tool 'jai_imageio_1_0_01-lib-windows-i586-jre' needs to be installed. When I upgrade jre with this tool and run my program independently from Oracle Form, it runs well but when I run this right there from Oracle Form it doesn't run and exception is thrown on javax.imageio and other packages that are part of that tool even though the Oracle Developer's jdk is upgraded with this tool. Could anyone help me resolve this problem?

    Hi,
    This is a JDeveloper help forum, the Formsforum can be found at Forms Now you might think that Forms developers don't understand Java well enough, they do however understand teh Forms context and this is important to answr the question.
    a) Which Java version does your ben require?
    b) Are you using JInitiator or JavaPlugin (Jinitiator only supports Java 1.3)
    c) Is your PJC signed? Note that running an app stand alone as a Java app does not require special grants. Running it within a JavaApplet - as Forms is - does execute teh bean in a security sandbox, for which reasons the jar file must be signed and the public key be available in the Forms certdb.txt file (assuming Jinitiator)
    d) An exception stack trace gives more information than "Oracle Form it doesn't run and exception is thrown on javax.imageio and other packages", which is meanlingless to me and others. Teh stack trace canbe copied from teh JInitiator console
    I recommend resending this question to the Forms forum
    Frank

  • Problem with inserting a record

    Hi Friends,
    I want to update my database table with new record for this I wrote a coding like this, but i am unable to update the database table please find my coding:
    LOOP AT lt_invmov INTO lw_invmov WHERE check = 'X'.
              SELECT  MAX( trans )
                         INTO zinv_mov-trans FROM zinv_mov.
              IF sy-subrc EQ 0.
                zinv_mov-trans = zinv_mov-trans + '0000000001'.
              ELSE.
                MOVE '0000000001' TO zinv_mov-trans.
              ENDIF.
              itab-lifnr     =   lw_invmov-lifnr.
              itab-xblnr     =   lw_invmov-xblnr.
              itab-bukrs     =   lw_invmov-bukrs.
              itab-usnam     = zinv_mov-usnam.
              itab-appdate   = sy-datum.
              MOVE 'V2' TO itab-status.
              MOVE 'CL' TO itab-clear.
             APPEND itab.
              INSERT INTO zinv_mov VALUES itab.
            ENDLOOP.
          ENDIF.
    Regards,
    Line

    do like this it may help you..
    LOOP AT lt_invmov INTO lw_invmov WHERE check = 'X'.
    SELECT MAX( trans )
    INTO zinv_mov-trans FROM zinv_mov.
    IF sy-subrc EQ 0.
    zinv_mov-trans = zinv_mov-trans + '0000000001'.
    ELSE.
    MOVE '0000000001' TO zinv_mov-trans.
    ENDIF.
    itab-lifnr = lw_invmov-lifnr.
    itab-xblnr = lw_invmov-xblnr.
    itab-bukrs = lw_invmov-bukrs.
    itab-usnam = zinv_mov-usnam.
    itab-appdate = sy-datum.
    MOVE 'V2' TO itab-status.
    MOVE 'CL' TO itab-clear.
    APPEND itab.
    ENDLOOP.
    INSERT INTO zinv_mov from table itab.
    ENDIF.
    your itab should be like zinv_mov .
    regards
    shiba dutta

  • Problem with Image IO jar on Oracle Form

    I'm using a PJC as a TextEditor on Oracle Form. The PJC uses JAI ImageIO jar that holds javax.imageio package. When I use the PJC right from Oracle Form it doesn't work whereas it works well independently. Please have a look on JInitiator Console message given below and let me know if possible how to get around this:
    Drag Enter
    Source: java.awt.dnd.DropTarget@1abd68
    Drag Exit
    Possible flavor: application/x-java-file-list; class=java.util.List
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: javax/imageio/ImageIO
    at HTMLEditor.drop(HTMLEditor.java:591)
    at java.awt.dnd.DropTarget.drop(Unknown Source)
    at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(Unknown Source)
    at sun.awt.dnd.SunDropTargetContextPeer.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    I need to tell that if I unjar my jar used for pjc I find that ok for javax.imageio package and also if I run my program other than on Oracle Form, it runs fine. I know regarding the signing issue of jar required to run pjc , so don't get concerned of it.
    Thanks
    Rashed

    Hi...thanks for your suggestion. Which JavaPlugin do you suggest to implement? If you mean to upgrade the jre that is an installer found for various jdk versions, I have that...in that case I only need to know which version should I use. Moreover, installing that tool the jre of jdk gets upgraded...I don't know how to upgrade Jinitiator...please let me know this issue.
    Rashed

  • How to insert new record into oracle table from GridView in VS2005.

    I need to insert records into Oracle10g table from VS2005 GridView using the Insert Method in Business Logic Class. The Update and Delete Methods are working fine. What's the best way out?

    How is it "not possible"?
    Either modify the Class for the new fields, or give the new fields default values (if applicable). If the type of an existing column has changed, then only the first option is available.
    Where's the problem?

  • How to insert  new records in Master and detail Forms.

    Hi,
    I am having trouble inserting values in both master and detail view at the same time. The scenarios is I have a Dept Table (View Object-VO1) and Employee Table(View Object -VO2) both linked with a foreign key, as per Default HR schema in Oracle DB XE.
    Now I want to insert new record in both Dept(VO1) and EMP(VO2) table via a New page say ( Page2 ). There is a button on Page1 with button INSERT .I can only drag-drop "CreateInsert" operation on that button for VO1 or VO2. So only text box for Dept records are enable to insert data but not Emp records. Is there a way I can insert data in both the tables at the sametime??
    Thanks,
    MB

    Hi MuradRabbani,
    You can programmatically call both createInsert Operations,
    Add to your pageDef both CreateInsert Operations.
    Create a button tha will call insert method from Master (VO1) and then call insert method for Detail (VO2)
    Here is an Example code of calling the operations:
    DCBindingContainer dcb = ADFUtils.getDCBindingContainer(); //you need ADFUtils.java and JSFUtils.java classes. You can find them in the sample applications in your JDeveloper.
    OperationBinding oper = dcb.getOperationBinding("CreateInsertVO1");
    oper.execute();
    -----------------NOTE: at this point you should have set values that compine the ViewLink on the master in order the detail will know where to link the new record there are many ways to do it.
    As an approach try to overrdi the create Method on the in the ViewRowImpl of your Master vo (VO1)
    e.g.
    @Override
    protected void create(AttributeList attributeList) {
    //before
    attributeList.setAttribute("NameOfAttribute", valueHere);
    super.create(attributeList);
    After that you should call the operation for your detail VO2
    e.g.
    DCBindingContainer dcb = ADFUtils.getDCBindingContainer();
    OperationBinding oper = dcb.getOperationBinding("CreateInsertVO2");
    oper.execute();
    The detail record will now have the values from your master automatically.
    Regards,
    Dimitris.

  • Cannot add new records through VC form when consuming IP write back query

    I have created a planning application in IP and created a Form in VC (CE 7.1). I am not able to create new records in VC Form and save it back to the cube like the traditional excel form on IP does. I have attached a document with every step that i did as a screen shot in designing my model. The writing back of data using the Form works if i have preexisting data in the planning cube and if i am only changing the values of the existing data records it works great. I could consume the planning functions that i created and they work well within VC. But if i want to create new records in a empty planning cube it gives me error unlike planning in excel analyser lets me save it back to the cube. I have tested the same query in Excel Analyser and created new records and saved it back in the cube. Any help on this is greatly appreciated.
    [http://www.mediafire.com/?sharekey=f1bc9aa662da6a86d956df2962098fcbe04e75f6e8ebb871]
    Thanks.
    Edited by: BI GUYS on Sep 28, 2009 2:00 PM

    Hi PradeeP,
    1. The BI Query itself has to support the entries of new lines. This is described in note 1149346.
    However, if the Query allows entering new lines in the BEx Analyzer, then this prerequisite is fulfilled.
    2. In the BI Query wizard in VC in the u201CChoose Presentationsu201D step, you have to include  the key presentation for the characteristics.
    If 1 and 2 are fulfilled and you still have the problem, it is strange...
    Does the problem also occur if you create new records in a cube that already shows some data in the table view?
    Regards,
    Talia

  • How to insert new record into altered table

    I am using JDBC with MySQL. I altered existing table and want to insert new record using java class. But it is not possible.How to do?

    How is it "not possible"?
    Either modify the Class for the new fields, or give the new fields default values (if applicable). If the type of an existing column has changed, then only the first option is available.
    Where's the problem?

  • Problem with the new server UCS C220 for set IP to CIMC

    Hi
    We’ve a problem with the new server UCS C220.
    We bought two servers UCS C220 M3 for CallManager 8.6 with High Availability.
    When we turn on the server during the boot and when it tells us, oppress F8 to enter at the CIMC and set the IP. But it never enters at the CIMC.
    Then, we configure our DHCP server and our switch, we connect the three gigabyte ports to our switch to give him an IP to the CIMC, so and then can enter via browser, but neither works.
    Note. The dedicated management NIC does not link, the other two ports do make link.
    What do you suggest to put an IP to CIMC and start installing our applications?
    regards

    You may have noticed that there is no DVD rom on the c220. What you need to do is:
    Login into the CIMC from your browser
    Luanch the KVM
    Insert the VMware DVD in your machines drive
    On the KVM pop up there should be a tab to mount the drive, after mounting it click on Macros and choose ctrl_alt+delete to restart.
    After the VMware OS installs press F2 to enter IP.
    Browse to the VMware ip to download the Vsphere client
    Open the Vsphere client, enter the ip of the vmware and the username will be root and no password if you did not set one.
    You can now upload OVA templates or manually create virtua machine from this enviroment.
    Hope this help

  • Problem while inserting a record to infotype 416

    Iam facing a problem while inserting a record to the infotype 416 for a personnel no using the FM 'HR_INFOTYPE_OPERATION'.I have created a FM to insert a record to the infotype 416.In that FM iam using the FM 'HR_INFOTYPE_OPERATION' to create a record for infotype 416.while executing  my FM the FM 'HR_INFOTYPE_OPERATION' is returning the return value 0.But when i check in PA30 for the infotype 416,there is no record created for that personnel no.Also in the table PA0416 the record is not get created.SO what might be the problem.can anyone please provide me help on this.
    I have attached the code of my FM for ur reference.
    FUNCTION Y_ESS_FL_ENCASH.
    DATA: G_COMPENSATION_AMOUNT LIKE PA0416-AMONT,
          G_RETURN TYPE BAPIRETURN1.
    DATA T_PA0416 LIKE P0416 OCCURS 0 WITH HEADER LINE.
    CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
           TCLAS                 = 'A'
           PERNR                 = '00000014'
           INFTY                 = '0416'
         BEGDA                 = sy-datum
         ENDDA                 =  sy-datum
           BYPASS_BUFFER         = 'X'
         LEGACY_MODE           = ' '
    IMPORTING
         SUBRC                 =
          TABLES
            INFTY_TAB             = T_PA0416
    EXCEPTIONS
      INFTY_NOT_FOUND       = 1
      OTHERS                = 2
        LOOP AT T_PA0416
        WHERE SUBTY = '1002'.
        ENDLOOP.
        IF SY-SUBRC <> 0.
          CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
            EXPORTING
               NUMBER = '00000014'
            IMPORTING
               RETURN = G_RETURN.
          IF SY-SUBRC <> 0.
             MESSAGE I016(RP) WITH ' RECORD IS ALREADY LOCKED'.
          ENDIF.
          T_PA0416-PERNR = '00000014'.
          T_PA0416-SUBTY = '1002'.
          T_PA0416-INFTY = '0416'.
          T_PA0416-OBJPS = ''.
          T_PA0416-SPRPS = ''.
          T_PA0416-SEQNR = ''.
          T_PA0416-AEDTM = SY-DATUM.
          T_PA0416-UNAME = SY-UNAME.
          T_PA0416-ENDDA = SY-DATUM.
          T_PA0416-BEGDA = SY-DATUM.
          T_PA0416-NUMBR = '10'.
          T_PA0416-WGTYP = '1530'.
          T_PA0416-AMONT = '15000'.
          T_PA0416-WAERS = 'INR'.
          T_PA0416-QUONR = '1'.
          APPEND T_PA0416.
          CALL FUNCTION 'HR_INFOTYPE_OPERATION'
            EXPORTING
              INFTY                  = '0416'
              NUMBER                 = '00000014'
              SUBTYPE                = '1002'
      OBJECTID               =
      LOCKINDICATOR          =
             VALIDITYEND            = '31129999'
             VALIDITYBEGIN          = SY-DATUM
            RECORDNUMBER           = ''
              RECORD                 = T_PA0416
              OPERATION              = 'INS'
              TCLAS                  = 'A'
      DIALOG_MODE            = '0'
            NOCOMMIT               = 'X'
      VIEW_IDENTIFIER        =
      SECONDARY_RECORD       =
            IMPORTING
              RETURN                 = G_RETURN.
      KEY                    =
          IF G_RETURN+0(1) EQ 'E'.
                  MESSAGE I086(ZHR) WITH 'Record is not inserted in IT416'.
          ELSE.
              COMMIT WORK.
          ENDIF.
          CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
            EXPORTING
              NUMBER = '00000014'
            IMPORTING
              RETURN = G_RETURN.
        ENDIF.
    ENDFUNCTION.

    Hi Murthy
    With a first glance, I think you have given a wrong parameter value to "validityend". It should be '99991231' not '31129999' .
    If your problem still persists, try inserting the data online from PA30. If your input causes no errors, then please state what the return parameter contains.
    Regards
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • Receiver JDBC: Error while doing the Deleting and Inserting new records

    Hi All,
              I am doing Idoc to JDBC scenario. In this I am collecting & bundling different type of Idocs and then sending to the JDBC receiver. My requirement is to delete the existing records in the database and insert the new records. I have configures as mentioned in the link
    Re: Combining DELETE and INSERT statements in JDBC receiver
    In the above link its shows for single mapping. In my scenario I am using multi mapping for collecting idocs in BPM. If I configured for normal mapping then it is working fine(Deleting existing records and Inserting new record). Whenever I am using multi mapping then I am getting following error in the receiver JDBC communication channel u201CError while parsing or executing XML-SQL document: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)u201D . Can you please tell me what might be the problem.
    Thanks & Regards,
    T.Purushotham

    Hi !
    check this out:
    JDBC - No 'action' attribute found in XML document - error
    JDBC receiver adapter: No 'action' attribute found in XML document
    It appears that the inbound payload (the one that is going from XI to the JDBC adapter) does not have the requiered tag to specify which SQL action to execute in the receiver system. Maybe the multimapping is not creating the desired output message format.
    Regards,
    Matias.

  • Urgent help : how when insert new record navigation off

    hi master
    Sir
    when i insert new record by mistake press down key and curser move to next record and my need is
    When I insert new record or change any record that time my form navigation musht be off and no move to next record how I restrict to navigation please give me idea which event and what code I use
    Thanking you
    aamir

    If u want the cursor not to move ahead from a particular field when the records are inserted or updated on that field then u can just write null to the
    key-next-item trigger of that particular item.
    ie IN key-next-item
    null;
    Hope this is what you wanted.

  • Triger for display next record in oracle forms

    hai all,
    i want to do
    when new form opened i have to add new reord that is empty new form also my new rownum will be displayed.
    now i getting first record.
    like:
    GROUP_ROWNUM:     1
    GROUP_ID:      120130
    GROUP_NAME aaaaaaaaa
    need like:
    GROUP_ROWNUM:     7
    GROUP_ID:
    GROUP_NAME
    that can be done by
    trigger for display next record in oracle forms?
    or through property seting?
    thanks in adv,
    rcs
    --------

    YES, this block is base on the DB table
    through defualt navigational button i can go to next,last,new record
    but i want create seperate form for new entry, in that i want to display
    old rownum
    formula to get rownum automatically (i am not at all typing it is system generated)
    even though i created column group_rownum for rownum
    (i can't be typing)
    LAST_RECORD;
    NEXT_RECORD; also not getting the next rownum
    i hope now understand me
    any posible way?
    thank you for your good input
    i.e.
    SQL> DESC GROUP_MSTR1;
    Name Null? Type
    GROUP_ID NOT NULL NUMBER(10)
    GROUP_NAME NOT NULL VARCHAR2(30)
    SQL> select * from GROUP_MSTR1;
    GROUP_ID GROUP_NAME
    123 AAAAAA
    124 BBBBBBBB
    125 CCCCCCCCC
    126 DDDDDDDD
    1 eeeeeeee
    2 FFFFFFFFF
    3 ggggggg
    7 rows selected.
    SQL> select rownum, GROUP_ID, GROUP_NAME from GROUP_MSTR1;
    ROWNUM GROUP_ID GROUP_NAME
    1 123 AAAAAA
    2 124 BBBBBBBB
    3 125 CCCCCCCCC
    4 126 DDDDDDDD
    5 1 eeeeeeee
    6 2 FFFFFFFFF
    7 3 ggggggg
    7 rows selected.
    -------------

  • I have one  iphone 4s is the third time that sends Ai repairs .. not my substitutions with a new record even if I have no guarantee I replace it with a new one I'm tired of this story what I can do;;

    I have one is the third time that you send for repair .. not my substitutions with a new record even if I guarantee I'm tired of this story what I can do;;; For two months I have not mobile .. every ten days sends it to my dealer and sends it exactly as you send it back .. and no problems have been made ... find my solution;;

    The people responding in this forum are just other Apple product users like you, not Apple itself.  Apple Support Communities is primarily an end-user to end-user (i.e., users like you helping other users) technical issue support feature.
    Try:
    Contact Us

  • Inserting new records into database table at runtime

    Hi all ,
    How to insert new records into database table at runtime on click update?
    Thanks.

    Hi Sasikala,
    Just for your understanding am giving a sample code snippet which you can use to read the contents of your Table UI element & save the data on to your database. Suppose you have a button up on pressing which you want to read the data from your screens table & save on to the database then you can proceed as shown below:
    1) Obtain the reference of your context node.
    2) Fetch all the data present in your table into an internal table using methods of if_wd_context_node
    3) Use your normal ABAP logic to update the database table with the data from your internal table
    In my example I have a node by name SFLIGHT_NODE and under this I have the desired attributes from SFLIGHT. Am displaying these in an editable table & the user would press up on a push button after making the necessary changes to the tables data. I would then need to obtain the tables information & save on to the database.
    data: node_sflight           type ref to if_wd_context_node,
            elem_sflight           type ref to if_wd_context_element,
            lt_elements            type WDR_CONTEXT_ELEMENT_SET,
           stru_sflight           type if_main=>element_sflight_node,
           it_flights             type if_main=>elements_sflight_node.
    "   navigate from <CONTEXT> to <SFLIGHT_NODE> via lead selection
        node_sflight_node = wd_context->get_child_node( name = 'SFLIGHT_NODE'  ).
       lt_elements = node_sflight->get_elements( ).
    "   Get all the rows from the table for saving on to the database
        loop at lt_elements into elem_sflight.
          elem_sflight->get_static_attributes( importing static_attributes = stru_sflight ).
          append stru_sflight to it_flights.
        endloop.
    " Finally save the entries on to the database
        modify ZSFLIGHT99 from table it_flights.
        if sy-subrc eq 0.
    endif.
    However a word of caution here.... SAP doesn't ever recommend directly modifying the database through an SQL query. You would preferably make use of a BAPI for the same. Try go through Thomas Jung's comments in [here|modify the data base table which is comming dynamiclly;.
    Regards,
    Uday

Maybe you are looking for