Mutilple updations and insertions by BAPI_SALESORDER_CHANGE at one time

Hi ,
I just want to know whether it is possible to insert and update multiple line items in a sales order through the BAPI BAPI_SALESORDER_CHANGE .
we tried doin it for single record ( update and insert ) , it is working fine . but when we try for mutiple items , it gives a system dump.
could you plz help out , how to pass the parameters for mutiple updation and insertions at a time?

HI ALL,
I THINK IF WE MAKE THE SCHEDULE LINE ITEM NO. TO BE UNIQUE FOR EACH LINE ITEM IT GETS UPLOADED PROPERLY. THE VBEP-ETENR IS 001 ONLY. PEOPLE WITH ALTERNAT ANSWERS PLZ. CORRECT.
SEE CODES BELOW.
**This creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '2'.
APPEND T_ITEM.
T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '1'.
T_SCHE-REQ_QTY = 2.
t_sche-req_date = '20080204'.
APPEND T_SCHE.
T_SCHEX-updateflag =  c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-SCHED_LINE = '1'.
t_schex-req_qty = 'X'.
APPEND T_SCHEX.
**This also creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
*T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '1'.
APPEND T_ITEM.
*T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '4'.
t_sche-req_date = '20080202'.
T_SCHE-REQ_QTY = 1.
APPEND T_SCHE.
T_SCHEX-updateflag =  c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-ITM_NUMBER = 'X'.
T_SCHEX-SCHED_LINE = '4'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.
**This also creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
*T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '1'.
APPEND T_ITEM.
*T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '5'.
t_sche-req_date = '20080202'.
T_SCHE-REQ_QTY = 1.
APPEND T_SCHE.
T_SCHEX-updateflag =  c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-ITM_NUMBER = 'X'.
T_SCHEX-SCHED_LINE = '5'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.
**This also creates additional line no. in the sales order.
**Material no is hard coded, you need to change the materisl no in
**available in ur system.
*T_ITEM-itm_number = ''.
T_ITEM-material = 'AGA350'.
T_ITEM-target_qty = '1'.
APPEND T_ITEM.
*T_ITEMx-itm_number = ''.
T_ITEMX-UPDATEFLAG = 'I'.
T_ITEMX-target_qty = 'X'.
T_ITEMX-material = 'X'.
APPEND T_ITEMX.
T_SCHE-SCHED_LINE = '6'.
t_sche-req_date = '20080202'.
T_SCHE-REQ_QTY = 1.
APPEND T_SCHE.
T_SCHEX-updateflag =  c_insertflag.
t_schex-req_date = 'X'.
T_SCHEX-ITM_NUMBER = 'X'.
T_SCHEX-SCHED_LINE = '6'.
T_SCHEX-REQ_QTY = 'X'.
APPEND T_SCHEX.
*i_order_header_in-sd_doc_cat

Similar Messages

  • Update and insert in to table

    Hi All,
    I am uploading data from a txt file into itab_infile and wants to update the table Zppprice based on itab_infile. It the record is existing it has to update and when it is a new record it has to insert the record. And I need to capture how many records havebeen updated and inserted.
    Please help me.
    Thanks,
    Veni.
    REPORT ZSD_PRICEPROTEC NO STANDARD PAGE HEADING
           LINE-SIZE 132
           LINE-COUNT 60.
    TABLES: KNA1,ZPPPRICE.
    TYPES: BEGIN OF type_infile,
             KUNNR(10) TYPE c,  "Customer Number
             MATNR(18) TYPE c,  "Material Number
             CRDATE(10) TYPE c,  "Creation Date
             EFDATE(10) TYPE c,  "Effective date
             SPRICE(15) TYPE c,  "Old Price
             EPRICE(15) TYPE c,  "New Price
             EOHQTY(09) TYPE c,  "Estimated Quantity
             AOHQTY(09) TYPE c.  "Actual Quantity
          TYPES: END OF type_infile.
    * Internal tables
    DATA: itab_infile TYPE STANDARD TABLE OF type_infile with header line.
    * Work areas
    DATA: wa_infile TYPE type_infile.
    * Global variables.
    DATA:  gc_tcode  LIKE sy-tcode VALUE 'VA01'. "Transaction code
    SELECTION-SCREEN BEGIN OF BLOCK one WITH FRAME TITLE text-001.
    PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK one.
    START-OF-SELECTION.
      PERFORM upload_text_file.
    *&      Form  UPLOAD_TEXT_FILE
    FORM upload_text_file.
      CALL FUNCTION 'WS_UPLOAD'
           EXPORTING
                filename                = p_file
                filetype                = 'DAT'
           TABLES
                data_tab                = itab_infile
           EXCEPTIONS
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                OTHERS                  = 10.
      IF sy-subrc <> 0.
        MESSAGE e208(00) WITH 'Error in loading text file'.
      ENDIF.
    ENDFORM.                    " UPLOAD_TEXT_FILE

    Hi Veni,
    Simple thing ,you can use MODIFY Command,it works both insert as well update.
    check the documentation.
    see the below program and i am getting data from XLS file and i am updating to Ztable( same as ur case ).
    Program    : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
    Type       : Upload program
    Author     : Seshu Maramreddy
    Date       : 05/16/2005
    Transport  : DV3K919574
    Transaction: None
    Description: This program will get the data from XLS File
                 and it upload to ZBATCH_CROSS_REF Table
    REPORT ZLWMI151_UPLOAD no standard page heading
                           line-size 100 line-count 60.
    *tables : zbatch_cross_ref.
    data : begin of t_text occurs 0,
           werks(4) type c,
           cmatnr(15) type c,
           srlno(12) type n,
           matnr(7) type n,
           charg(10) type n,
           end of t_text.
    data: begin of t_zbatch occurs 0,
          werks like zbatch_cross_ref-werks,
          cmatnr like zbatch_cross_ref-cmatnr,
          srlno like zbatch_cross_ref-srlno,
          matnr like zbatch_cross_ref-matnr,
          charg like zbatch_cross_ref-charg,
          end of t_zbatch.
    data : g_repid like sy-repid,
           g_line like sy-index,
           g_line1 like sy-index,
           $v_start_col         type i value '1',
           $v_start_row         type i value '2',
           $v_end_col           type i value '256',
           $v_end_row           type i value '65536',
           gd_currentrow type i.
    data: itab like alsmex_tabline occurs 0 with header line.
    data : t_final like zbatch_cross_ref occurs 0 with header line.
    selection-screen : begin of block blk with frame title text.
    parameters : p_file like rlgrap-filename obligatory.
    selection-screen : end of block blk.
    initialization.
      g_repid = sy-repid.
    at selection-screen on value-request for p_file.
      CALL FUNCTION 'F4_FILENAME'
           EXPORTING
                PROGRAM_NAME = g_repid
           IMPORTING
                FILE_NAME    = p_file.
    start-of-selection.
    Uploading the data into Internal Table
      perform upload_data.
      perform modify_table.
    top-of-page.
      CALL FUNCTION 'Z_HEADER'
      EXPORTING
        FLEX_TEXT1       =
        FLEX_TEXT2       =
        FLEX_TEXT3       =
    *&      Form  upload_data
          text
    FORM upload_data.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                FILENAME                = p_file
                I_BEGIN_COL             = $v_start_col
                I_BEGIN_ROW             = $v_start_row
                I_END_COL               = $v_end_col
                I_END_ROW               = $v_end_row
           TABLES
                INTERN                  = itab
           EXCEPTIONS
                INCONSISTENT_PARAMETERS = 1
                UPLOAD_OLE              = 2
                OTHERS                  = 3.
      IF SY-SUBRC <> 0.
        write:/10 'File '.
      ENDIF.
      if sy-subrc eq 0.
        read table itab index 1.
        gd_currentrow = itab-row.
        loop at itab.
          if itab-row ne gd_currentrow.
            append t_text.
            clear t_text.
            gd_currentrow = itab-row.
          endif.
          case itab-col.
            when '0001'.
              t_text-werks = itab-value.
            when '0002'.
              t_text-cmatnr = itab-value.
            when '0003'.
              t_text-srlno = itab-value.
            when '0004'.
              t_text-matnr = itab-value.
            when '0005'.
              t_text-charg = itab-value.
          endcase.
        endloop.
      endif.
      append t_text.
    ENDFORM.                    " upload_data
    *&      Form  modify_table
          Modify the table ZBATCH_CROSS_REF
    FORM modify_table.
      loop at t_text.
        t_final-werks = t_text-werks.
        t_final-cmatnr = t_text-cmatnr.
        t_final-srlno = t_text-srlno.
        t_final-matnr = t_text-matnr.
        t_final-charg = t_text-charg.
        t_final-erdat = sy-datum.
        t_final-erzet = sy-uzeit.
        t_final-ernam = sy-uname.
        t_final-rstat = 'U'.
        append t_final.
        clear t_final.
      endloop.
      delete t_final where werks = ''.
      describe table t_final lines g_line.
      sort t_final by werks cmatnr srlno.
    Deleting the Duplicate Records
      perform select_data.
      describe table t_final lines g_line1.
      modify zbatch_cross_ref from table t_final.
      if sy-subrc ne 0.
        write:/ 'Updation failed'.
      else.
        Skip 1.
        Write:/12 'Updation has been Completed Sucessfully'.
        skip 1.
        Write:/12 'Records in file ',42 g_line .
        write:/12 'Updated records in Table',42 g_line1.
      endif.
      delete from zbatch_cross_ref where werks = ''.
    ENDFORM.                    " modify_table
    *&      Form  select_data
          Deleting the duplicate records
    FORM select_data.
      select werks
             cmatnr
             srlno from zbatch_cross_ref
             into table t_zbatch for all entries in t_final
             where werks = t_final-werks
             and  cmatnr = t_final-cmatnr
             and srlno = t_final-srlno.
      sort t_zbatch by werks cmatnr srlno.
      loop at t_zbatch.
        read table t_final with key werks = t_zbatch-werks
                                    cmatnr = t_zbatch-cmatnr
                                    srlno = t_zbatch-srlno.
        if sy-subrc eq 0.
          delete table t_final .
        endif.
        clear: t_zbatch,
               t_final.
      endloop.
    ENDFORM.                    " select_data
    Thanks
    Seshu

  • Use of the "updlock" hint with update and insert statements

    I have inherited some stored procedures and am trying to figure out why the developers decided to use the "updlock" hint on many of the update and insert statements. I have looked around everywhere and have found only one explanation of why "update...with
    (updlock)" can be useful, namely when a table has no clustered index:
    http://www.sqlnotes.info/2012/10/10/update-with-updlock/ I have found nothing yet that mentions why "insert into...with (updlock)" might be used. I understand why the hint
    might be useful on select statements in some cases, but if all of the tables have clustered indexes, is there any good reason to use it on update and insert statements?
    Thanks,
    Ron
    Ron Rice

    This form of deadlock error can occur on a table which has a clustered index.
    If you are doing updates on a table which has a clustered index and that table also has a nonclustered index and the nonclustered index is used to find the row to update you can see this type of deadlock.  For example create a table with a clustered
    primary key index and a nonclustered index by running
    Create Table Foo(PK int primary key identity, OtherKey varchar(10), OtherData int);
    go
    Insert Foo Default Values;
    go 10000
    Update Foo Set OtherKey = 'C' + Cast(PK As varchar(10))
    Create Unique Index FooIdx On Foo(OtherKey);
    That creates a table with 10000 rows, a clustered index and a nonclustered index.  Then run
    Begin Transaction
    Update Foo Set OtherData = 1 Where OtherKey = 'C5'
    That will use the FooIdx index to find the row that needs to be updated.  It will get a U lock on the index row in the FooIdx index, then an X lock on the row in the clustered index, update that row, then free the U lock on FooIdx, but keep the X lock
    on the row in the clustered index.  (There is other locking going on, but to simplify things, I'm only showing the locks that lead to the deadlock).
    Then in another window, run
    Begin Transaction
    Update Foo Set OtherData = 2 Where OtherKey = 'C5'
    This will get a U lock on the index row in the FooIdx index, then try to get an X lock on the row in the clustered index.  But that row is already exclusively locked, so this second window will wait holding a U lock on FooIdx row and is waiting for
    an X lock on the clustered index row.
    Now go back to the first window and run
    Update Foo Set OtherData = 3 Where OtherKey = 'C5'
    This will once again try to get the U lock on the FooIdx row, but it is blocked by the U lock the second window holds.  Of course the second window is blocked by the X lock on the clustered index row and you have a deadlock.
    All that said, I certainly do not routinely code my updates with UPDLOCK.  I try to design databases and write code so that deadlocks will be rare without holding excessive locks.  The more locks you hold and the longer you hold them, the more
    blocking you will get and the slower your system will run.  So I write code that if a deadlock exception occurs, it is properly handled.  Then if too many deadlocks occur, that is the time to go back to the code to see what changes are needed to
    decrease the number of deadlocks (one way to do that may be to get locks earlier and/or hold them longer. 
    But I wouldn't worry much about this form of deadlock.  It is, in my experience, vary rare.  I don't recall ever seeing it in a production environment.
    Tom

  • Possible to update and insert in a table at a same time

    Hi friends,
    I have a table with six columns in it.
    Initially that table will have seven rows with six columns, but all the columns wont have a content in it. But only one column will have the content of seven rows. so that's why initially it will have seven rows.
    Assume that first column consist of the following seven content each in a row(so seven row)
    *)A
    *)B
    *)C
    *)D
    *)E
    *)F
    *)G
    So what i need to do is set DML operation such that for the existing seven rows which is in the table i need to update the value of the remaining six column and at the same time i need to insert all the seven rows of only the first column in the next seven rows.
    Whether it is possible to do it.
    How to achieve it friends,
    Thanks
    Regards,
    Mini

    Hi,
    It should be like
    Initially my table would be like the below
    *questions            StronglyAgree              DA               AG          suggestions*
    what is ur name?          
    what is ur age?                                 
    which is ur pet?                                    My DML operation should be like it should update and insert
    Update in the sense, it should be like
    *questions            StronglyAgree              DA               AG                    suggestions*
    what is ur name?              y                                                                my name
    what is ur age?                                        y                                        my age
    which is ur pet?                                                         y                       my petSoon after that insert should be like
    *questions            StronglyAgree              Disagree             Agree                    suggestions*
    what is ur name?              y                                                                          my name
    what is ur age?                                          y                                                 my age
    which is ur pet?                                                                y                          my pet
    what is ur name?
    what is ur age?
    which is ur pet?It should be like the above..
    All izz well
    GTA
    Edited by: GTA on Jun 13, 2011 6:43 AM
    Edited by: GTA on Jun 13, 2011 6:43 AM

  • I just updated my latest java but the update is causing problems with some externale devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device

    i just updated my latest java but the update is causing problems with some external devices. So i would like to uninstall this latest java update and get back the previous one. That should solve to problems with my external device.
    Is this possible and how do i do that?
    Anyone who responds thanks for that!
    Juko
    I am running
    Hardware Overview:
      Model Name:          Mac Pro
      Model Identifier:          MacPro1,1
      Processor Name:          Dual-Core Intel Xeon
      Processor Speed:          2,66 GHz
      Number of Processors:          2
      Total Number of Cores:          4
      L2 Cache (per Processor):          4 MB
      Memory:          6 GB
      Bus Speed:          1,33 GHz
      Boot ROM Version:          MP11.005D.B00
      SMC Version (system):          1.7f10
      Serial Number (system):          CK7XXXXXXGP
      Hardware UUID:          00000000-0000-1000-8000-0017F20F82F0
    System Software Overview:
      System Version:          Mac OS X 10.7.5 (11G63)
      Kernel Version:          Darwin 11.4.2
      Boot Volume:          Macintosh HD(2)
      Boot Mode:          Normal
      Computer Name:          Mac Pro van Juko de Vries
      User Name:          Juko de Vries (jukodevries)
      Secure Virtual Memory:          Enabled
      64-bit Kernel and Extensions:          No
      Time since boot:          11 days 20:39
    Message was edited by Host

    Java 6 you can't as Apple maintains it, and Java 7 you could if you uninstall it and Oracle provides the earlier version which they likely won't his last update fixed 37 remote exploits.
    Java broken some software here and there, all you'll have to do is wait for a update from the other parties.

  • I updated to ios 8.3 and i hate it! Is there a way i can uninstall the update and go back to the one before this?

    I updated to ios 8.3 and i hate it! Is there a way i can uninstall the update and go back to the one before this?

    I'm sorry, but Apple does not provide a downgrade path for iOS. Because downgrading is unsupported by Apple we cannot discuss it on these forums.
    You may leave comments at Apple Feedback.

  • How to update and insert the records without using Table_comparison and Map_operation?

    How to update and insert the records without using Table_comparison and Map_operation?

    Use either join or MERGE see this Inserting, Updating, and Deleting Data by Using MERGE

  • I have upgraded my computer to program the MAC OS X but would like to remove this update and revert to the old one. Is this possible and how do I proceed?

    I have upgraded my computer to program the MAC OS X but would like to remove this update and revert to the old one. Is this possible and how do I proceed?

    Not easily, unless you backed up your data.
    Did you?  If not, let that be a lesson to never install anything without a backup:
    https://discussions.apple.com/docs/DOC-1992
    https://discussions.apple.com/docs/DOC-1948

  • Rows updated and inserted by  MERGE

    Hi,
    Is there any way I can come to know, How many rows are updated and inserted using a MERGE statement.
    Thanks in advance

    Something like this ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>
    satyaki>desc aud_emp;
    Name                                      Null?    Type
    EMPNO                                              NUMBER(4)
    ENAME                                              VARCHAR2(10)
    JOB                                                VARCHAR2(9)
    MGR                                                NUMBER(4)
    HIREDATE                                           DATE
    SAL                                                NUMBER(7,2)
    COMM                                               NUMBER(7,2)
    DEPTNO                                             NUMBER(2)
    AUDIT_TMP                                          TIMESTAMP(6)
    AUDIT_IP_ADDR                                      VARCHAR2(15)
    OPR_DESC                                           VARCHAR2(30)
    USER_NM                                            VARCHAR2(40)
    REMARKS                                            VARCHAR2(200)
    satyaki>
    satyaki>
    satyaki>
    satyaki>
    satyaki>select * from aud_emp;
    no rows selected
    Elapsed: 00:00:00.04
    satyaki>
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    13 rows selected.
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>select * from e_emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7566 JONES      MANAGER         7839 02-APR-81    3718.75                    20
          7782 CLARK      MANAGER         7839 09-JUN-81     3062.5                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       5000                    10
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER     CLERK           7782 23-JAN-82      11700                    10
    7 rows selected.
    Elapsed: 00:00:00.07
    satyaki>CREATE OR REPLACE TRIGGER trg_aud
    before insert or update or delete on e_emp
    for each row
    declare
         S_IP_ADDR    varchar2(30);
         str          varchar2(320);
         s_empno      varchar2(40);
         s_ename      varchar2(40);
         s_job        varchar2(40);
         s_mgr        varchar2(40);
         s_hrdate     varchar2(40);
         s_sal        varchar2(40);
         s_comm       varchar2(40);
         s_deptno     varchar2(40);
    begin
         SELECT SYS_CONTEXT('USERENV','IP_ADDRESS')
         into S_IP_ADDR
         from dual;
         str:= null;
         if inserting then
             insert into aud_emp values(:new.empno,
                                        :new.ename,
                                        :new.job,
                                        :new.mgr,
                                        :new.hiredate,
                                        :new.sal,
                                        :new.comm,
                                        :new.deptno,
                                        systimestamp,
                                        S_IP_ADDR,
                                        'INSERT',
                                        USER,
                                        NULL);
         elsif updating then
           if :old.empno <> :new.empno then
              s_empno := 'Employee No: '||:old.empno;
           elsif :old.ename <> :new.ename then
              s_ename := 'Employee Name: '||:old.ename;
           elsif :old.job <> :new.job then
              s_job := 'Job: '||:old.job;
           elsif :old.mgr <> :new.mgr then
              s_mgr := 'Mgr: '||:old.mgr;
           elsif :old.hiredate <> :new.hiredate then
              s_hrdate := 'Hire Date: '||:old.hiredate;
           elsif :old.sal <> :new.sal then
              s_sal := 'Salary: '||:old.sal;
           elsif :old.comm <> :new.comm then
              s_comm := 'Commission: '||:old.comm;
           elsif :old.deptno <> :new.deptno then
              s_deptno := 'Department No: '||:old.deptno;
           end if;
           str:= 'Updated Records Details -> '||s_empno||' '||s_ename||' '||s_job||' '||s_mgr||' '||s_hrdate||' '||s_sal||' '||s_comm||' '||s_deptno;
             insert into aud_emp values(:new.empno,
                                        :new.ename,
                                        :new.job,
                                        :new.mgr,
                                        :new.hiredate,
                                        :new.sal,
                                        :new.comm,
                                        :new.deptno,
                                        systimestamp,
                                        S_IP_ADDR,
                                        'UPDATE',
                                        USER,
                                        str);
         elsif deleting then
             insert into aud_emp values(:old.empno,
                                        :old.ename,
                                        :old.job,
                                        :old.mgr,
                                        :old.hiredate,
                                        :old.sal,
                                        :old.comm,
                                        :old.deptno,
                                        systimestamp,
                                        S_IP_ADDR,
                                        'DELETE',
                                        USER,
                                        'Old Records before deletion');
         end if;
    exception
        when others then
          raise_application_error(-20501,'Contact With Your Admin....');
    end;
    Trigger Created.
    Elapsed: 00:00:00.09
    satyaki>ed
    Wrote file afiedt.buf
      1  merge into e_emp o
      2     using emp n
      3     on ( o.empno = n.empno)
      4     when matched then
      5       update set o.ename = n.ename,
      6                  o.job   = n.job,
      7                  o.mgr   = n.mgr,
      8                  o.hiredate = n.hiredate,
      9                  o.sal = n.sal,
    10                  o.comm = n.comm,
    11                  o.deptno = n.deptno
    12     when not matched then
    13       insert( o.empno,
    14               o.ename,
    15               o.job,
    16               o.mgr,
    17               o.hiredate,
    18               o.sal,
    19               o.comm,
    20               o.deptno)
    21       values( n.empno,
    22               n.ename,
    23               n.job,
    24               n.mgr,
    25               n.hiredate,
    26               n.sal,
    27               n.comm,
    28*              n.deptno)
    satyaki>/
    13 rows merged.
    Elapsed: 00:00:03.95
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.07
    satyaki>
    satyaki>
    satyaki>select * from aud_emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO AUDIT_TMP                                                                   AUDIT_IP_ADDR   OPR_DESC                       USER_NM                                  REMARKS
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20 31-DEC-08 10.54.06.667000 PM                                                10.23.99.77     UPDATE                         SCOTT                                    Updated Records Details ->      Salary: 3718.75
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10 31-DEC-08 10.54.06.686000 PM                                                10.23.99.77     UPDATE                         SCOTT                                    Updated Records Details ->      Salary: 3062.5
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20 31-DEC-08 10.54.06.687000 PM                                                10.23.99.77     UPDATE                         SCOTT                                    Updated Records Details ->
          7839 KING       PRESIDENT            17-NOV-81       7000                    10 31-DEC-08 10.54.06.697000 PM                                                10.23.99.77     UPDATE                         SCOTT                                    Updated Records Details ->      Salary: 5000
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20 31-DEC-08 10.54.06.698000 PM                                                10.23.99.77     UPDATE                         SCOTT                                    Updated Records Details ->
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20 31-DEC-08 10.54.06.699000 PM                                                10.23.99.77     UPDATE                         SCOTT                                    Updated Records Details ->
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30 31-DEC-08 10.54.06.720000 PM                                                10.23.99.77     INSERT                         SCOTT
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10 31-DEC-08 10.54.07.059000 PM                                                10.23.99.77     INSERT                         SCOTT
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30 31-DEC-08 10.54.07.060000 PM                                                10.23.99.77     INSERT                         SCOTT
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30 31-DEC-08 10.54.07.060000 PM                                                10.23.99.77     INSERT                         SCOTT
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30 31-DEC-08 10.54.07.061000 PM                                                10.23.99.77     INSERT                         SCOTT
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO AUDIT_TMP                                                                   AUDIT_IP_ADDR   OPR_DESC                       USER_NM                                  REMARKS
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10 31-DEC-08 10.54.07.061000 PM                                                10.23.99.77     INSERT                         SCOTT
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30 31-DEC-08 10.54.07.062000 PM                                                10.23.99.77     INSERT                         SCOTT
    13 rows selected.
    Elapsed: 00:00:00.22
    satyaki>
    satyaki>set lin 80Hope this will help you.
    Regards.
    Satyaki De.

  • How can we do policy updations and insertion using procedures in insurence?

    how can we do policy updations and insertion using procedures in insurence?
    please answer for this post i need faced in interview.how can we write the code for that procedure in policy details using procedures in plsql.

    997995 wrote:
    how can we do policy updations and insertion using procedures in insurence?
    please answer for this post i need faced in interview.how can we write the code for that procedure in policy details using procedures in plsql.You are asking about a specific business area (Insurance) and the nuances of that business (Insurance Policies) and providing no technical details about what is required, on a technical forum. There are many varied businesses in the world and not everyone here is going to be familiar with the area of business you are referring to.
    As a technical forum, people are here to assist with technical issues, not to try and help you answer questions in an interview for something you clearly know nothing about, so that you can get a job that you won't know how to do.
    If you have a specific technical issue, post appropriate details, including database version, table structures and indexes, example data and expected output etc. as detailed in the FAQ: {message:id=9360002}

  • Difference update and insert

    what is the difference between update and insert in the case of database tables?  what does update do  and what does insert do?

    Hi,
    Insert Functionality,
    Inserts new lines in a database table.By default, data is only inserted in the current client. Data can only be inserted using a view if the view refers to a single table and was defined in the ABAP Dictionary with the maintenance status "No restriction".
    Update Functionality,
    Updates values in a database table. Normally, lines are updated only in the current client.
    INSERT & UPDATE belongs to the Open SQL command set.
    Thanks
    Nimesh S. Patel

  • Is there a way to select all emails at once on the iPad and then delete them at one time?

    Is there a way to select all emails at once on the iPad and then delete them at one time?

    Tap on the edit button at  the top right of the email list. This will let you select the emails to delete, once all are selected, tap on the bottom right button that says delete to delete them all at once.

  • BMP EJB Load and Store is calling only one time calling in a loop

    Loop Iterating two times but ejb load and store is calling only one time.
    Application deployed in 0c4j 10.1.2.0.0 container.

    This sounds more like a Teststand quesstion. You might want to post it there.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Creation of a Single button for both Update and Insert

    Hi,
    I want to create a button which performs both Insert and Update function. As of now i have 2 seperate buttons. Can I combine them in to one by writing a procedure which checks for the data in the database...If the record exists, then it should update the record, if not it should insert...Please guide me
    Regards,
    Pa

    Hi,
    If I am inserting in to the table a new record, how do I check for that column in the table...
    It should work this way..
    I have a list of users in a page, if I click on any user name, it will redirect me to another screen which will allow me to create a record for the selected user name. I want to check the selected user name in the table. If it is already existing then need to update, else insert.
    Regards,
    Pa

  • Updating and inserting on Long Raw column

    Hi All,
    My source table contains LONG RAW column in XX databse. I have to fetch the data from this table in YY Databse using DB link and insert into same structured table. The problem is, i can not access the LONG RAW data for some rows which the size exceeding above 32k.
    My requirement is, i have to fetch and insert or update the record(Source and target table structure is same and dtabase is different).
    Please suggest the best way of handle this problem.
    Please let me know if you need more information.
    Thanks
    Ram
    Edited by: ram on Oct 19, 2008 2:11 PM
    Edited by: ram on Oct 19, 2008 2:12 PM

    We using the procedure to insert and update. Procedure will called to update or insert only one record at a time from XX databse to YY database.
    We are not using SQL * PLUS for this operation.
    Thanks
    Ram

Maybe you are looking for

  • My 8gb iPod Touch Battery Issues?

    My iPod has lived in my car, plugged into the USB / iPod slot for about 9 months with no problem at all. Over christmas, I unplugged it and took it on a trip with me. Upon unplugging, a problem immediately surfaced - the battery dies (on standby, not

  • Sender FCC , problem with Repeating Field under a Sub-structure

    Hi, I have an Input File as D,TH_ ,10/31/2008,ABC,pieces PF, 10/31/2008,11/2/2008,11/3/2008,11/4/2008 P,mat,CS,100,120,130,125,150,170,120 P,mat,CS,100,120,100,110,140,120,110 I need to Implement an FCC to convert this to a Structure like this   Reco

  • Exporting Versions without Version # included in name

    Hi all, I am trialing 1.5 and would like to upload lores Jpegs of a single version of each of my master files to Photoshelter. Everything works well except that I don't want to include the version # in the file name. I have renamed the files from the

  • Multiple channel AI measuremen​t in the same module with synchronis​ed AO

    I  am using NI -9172  for measurment. I am trying to mesure two  AI voltage signals on the same module (NI9215).A sinosoidal  analog input voltage is generated using NI 9263. The AI and AO are synchronised using Ai start trigger signal from NI 9263(

  • Problems formatting the partition in Windows XP

    I'm trying to install Windows XP Pro (SP2, OEM version) through bootcamp. I partition the hard drive (115gb) using the assistant and then start the installation. I get the screen that asks me to select the correct partition and I choose "C: Partition