UPDATE dbtable FROM TABLE itab .

Hi All,
UPDATE dbtable FROM TABLE itab.
For the above statement, if there are entries in itab that do not have primary key in dbtable, then are they created in the dbtable or ignored.
if they are ignored, how would i know which are ignored. or how to insert those ignored lines into the dbtable.
Thanks in advance..!

MODIFY will update current records and create ones that do not exists.   Not sure about UPDATE as I never use it.
MODIFY dbtable FROM TABLE itab.
Regards,
Rich Heilman

Similar Messages

  • How to update DBtable in table control (MPP) for selected lines.

    Hi Folks,
    I need to update DBtable from the table control after modification of  only multiple selected rows.
    But my issue. any row if edited is being modified in DBtable.
    Client does not want me to use Check box so im using Selcolumn in module pool table control.
    Please help me in resolving the issue. Let me know if you have any queries
    Thanks
    Reddy

    Hi Reddy,
    Hope it helps.
    For  Sel column.
    Declare:
    Data : SEL  TYPES XFELD in Structure.
    Double click on the sel  field     give the structure name and field name as below in screen shoot.
    In Flow logic.
    PROCESS AFTER INPUT.
    loop at it_tab.
        FIELD YTBLCTRL-SEL.
    MODULE update.
    ENDLOOP.
    MODULE Updatedb.
    In Editor.
    MODULE UPDATE INPUT.
       MODIFY it_tab FROM YTBLCTRL INDEX tbc1-current_line.
       if ytblctrl-sel IS NOT INITIAL.
       lv_cnt = lv_cnt + 1.
       endif.
    ENDMODULE.
    MODULE UPDATEDB INPUT.
    Case sy-ucomm.
    WHEN 'SAVE'.
    if lv_cnt is NE '1'.
    Message 'select more than one item.
    else.
    Update DB.
    endif.
    Endcase.
    Regards,
    Venkat.

  • Can not insert/update data from table which is created from view

    Hi all
    I'm using Oracle database 11g
    I've created table from view as the following command:
    Create table table_new as select * from View_Old
    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)
    Anybody tell me, what's happend? cause?
    Thankyou
    thiensu
    Edited by: user8248216 on May 5, 2011 8:54 PM
    Edited by: user8248216 on May 5, 2011 8:55 PM

    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)so what is wrong with the GUI tools & why posting to DATABASE forum when that works OK?

  • Fetch Insert / Update Query From Table Trigger

    Hi everyone !,
    I have a situation, is there any way where I can get insert/update query by before-insert / after insert trigger when a user inserts/updates any row in the table.
    Plz....help me....champs.....
    Regards,
    Naushad

    That was a nice thing but it works only on some oracle 9i with DML statements.
    On database versions 9.2.0.1 to 9.2.0.6 ora_sql_text works and returns the calling text for dml triggers, where as starting from 9.2.0.7 the behavior has changed and returns NULL.
    Cause
    This issue had surfaced from 9.2.0.7.0 patchset. After discussions in Bug 4171597 which was closed as a duplicate of Bug 4230721 it was concluded that it was the expected behavior i.e ORA_SQL_TXT should return null when dml triggers are used.
    ORA_SQL_TXT is a "System defined event attribute" and is supposed to work only with "System triggers". This is also what the Documentation says - "Application Developers Guide : Fundamentals(9.2)
    Chapter 16 Working with System events".
    Bye Alessandro

  • Regardig error while updating the database table

    hi experts,
       i m trying to update the database table from the values containig in my internal table  ,,,but the system is giving this error plz help me::::
    The type of the database table and work area (or internal table)
    "ITAB_UPDATE" are not Unicode convertible. Unicode convertible.          
    my internal table name itab_update and the database table name yitab.i m using this statement::
        modify yitab from itab_update.

    Hi
    1. You  have to Declare the Itab with the same structure as DB table.
    2. Use the statement
        Modify <DBtable> from TABLE <itab>.
    or
       Update <DBtable> from TABLE <itab>.
    Hope this will solve.
    Reward .....if so.
    Regards.

  • Regarding "Update .. From Table" Statement

    Hi,
    I have an existing piece of code which I'm trying to understand.
    There are two scenarios regarding the UPDATE statement.
    1) Scenario 1:
    There exists a database table with around 100 or more fields/columns [Eg: DB_TABLE1].
    An Internal Table exists with the same key as the above database table [EG: I_TABLE1].
    code:
    loop at I_TABLE1.
      update DB_TABLE1
      set kf1 = I_TABLE1-kfa
       kf2 = I_TABLE1-kfb
       kf3 = I_TABLE1-kfc
       kf4 = I_TABLE1-kfd
      where key1 = I_TABLE1-keya AND key2 = I_TABLE1-keyb.
    Endloop.
    In the above scenario the records in database table [DB_TABLE1] with matching condition are updated and the rest of the fields are not touched.  - Correct me if I am wrong.
    2) Scenario 2:
    There exists a database table with around 100 or more fields/columns [Eg: DB_TABLE1].
    Two Internal Tables exist with the same key as the above database table [EG: I_TABLE1 And  I_TABLE2].
    Code part a:
    SELECT * FROM DB_TABLE1 INTO TABLE I_TABLE2
          WHERE  KF1 <> 0.
    Internal Table 1 has some data.
    Code part b:
    loop at I_TABLE1.
      update DB_TABLE1
      set kf1 = I_TABLE1-kfa
       kf2 = I_TABLE1-kfb
       kf3 = I_TABLE1-kfc
       kf4 = I_TABLE1-kfd
      where key1 = I_TABLE1-keya AND key2 = I_TABLE1-keyb.
    Endloop.
    Code part c:
    update DB_TABLE1 FROM TABLE I_TABLE2.
    In the second scenario what will be the final effect of DB_TABLE1?
    As i understand it, there is no use of Code part b. Am I right?
    I thought that the records in I_TABLE2 with matching key in DB_TABLE1 will be updated and the rest of the records will be deleted.
    But actually there is not change in the DB_TABLE1 when the above code is executed.
    Help is appreciated.
    Thanks.

    Hi Joey,
    Scenario 1: In the above scenario the records in database table DB_TABLE1 with matching condition are updated and the rest of the fields are not touched.
    - That's right.
    Scenario 2: As i understand it, there is no use of Code part b.
    - Exactly because of the following reasons:
    1. Code part a shows data selected from DB_TABLE1 INTO TABLE I_TABLE2.
    2. Code part c shows DB_TABLE1 updated from TABLE I_TABLE2 whereas Code part b uses ONLY internal table I_TABLE1.
    3. If there are any operations performed in Code Part b on 'I_TABLE2', then this would have been different.
    Regards,
    Pranav.

  • How to update whole external table(in ABAP dictionary) from internal table at once

    Hi,
    How can I update the content of the external table (in ABAP dictionary) from the content of internal table data at once. I created the internal tables with out the header line, with the work area. I tried UPDATE TARGET_EXTERNAL_TABLE FROM TABLE INTERNAL_TABLE. But it returns 4 for sy-subrc and did not work.
    Thank you
    Regards.
    CHINTHAKA

    Hi Feiyun Wu,
    Thank you very much. Your code worked. Is there any way to replace the whole content of the external table from internal table data ?
    Regards,
    Chinthaka

  • Update ztable from internal table

    I want to update the Ztable from internal table datas.
    what is the syntax to update.
    Its urgent send with coding example is better

    Hi
    PARAMETERS: p_carrid TYPE sflight-carrid,
                percent(1) TYPE p DECIMALS 0.
    DATA sflight_tab TYPE TABLE OF sflight.
    FIELD-SYMBOLS <sflight> TYPE sflight.
    SELECT *
           FROM sflight
           INTO TABLE sflight_tab
           WHERE carrid = p_carrid AND
                 fldate = sy-datum.
    IF sy-subrc = 0.
      LOOP AT sflight_tab ASSIGNING <sflight>.
        <sflight>-price =
          <sflight>-price * ( 1 - percent / 100 ).
      ENDLOOP.
    ENDIF.
    <b>UPDATE sflight FROM TABLE sflight_tab.</b>
    Thanks
    Vijay
    PLZ reward points if helpful

  • Update the Z table taking Max time.

    Dear Friends,
    I am updating a Z table for a sigle field value, I am doing it in loop and giving all the primary key fields in where condition, Its updating the records properly.
    But The time is taking more if there are more records ( say 3000 + reacords ) , Now I am planning to update it in a single statement but the Sy-subrc is giving me 4 and the records were not updated in Z table.
    pls let me know how to update the Z table in a single statement??
    pls find the below code:
    corent code:
        UPDATE zXX CLIENT SPECIFIED
                        SET zyy = it_finaldata-zyy
                     WHERE mandt = sy-mandt AND
                           matnr = it_finaldata-matnr AND
                           matkl = it_finaldata-matkl .
    this is within a loop and working fine but taking max time more than 30 mins.
    now I have moved all the data into anothere internal table ( the internal table is same like Z table )
    I am using the below statement but its not working:
    update zXX FROM table it_savedata.
    Pls help me.
    Thanks,
    Sridhar

    Hi
    If u use update that line should exist in DB table otherwise the sy-subrc will be 4. You can use MODIFY statement . The advantage is that if a line exist it will modify that particular line otherwise it will create a new line in DB table.
    MODIFY dtab FROM TABLE itab.
    Regards
    Sathar

  • How to update a standard table

    Hi all,
    I want to update table makt with a program from table itab.
    Loop at itab into wa.
          modify makt from wa.
    endloop.
    I even can not debug the loop...
    Is it not possible to update sap tables?
    Thanks.

    You can definitely modify Standard Database table from ABAP Program.
    1.Syntax for modifying Database table from Workarea is,
    MODIFY dbtab FROM workarea.
    Effect
    When a wa work area that is not table-type is specified, which meets the requirements for use in Open SQL statements, a line is searched for in the database table that has the same content in the primary key as the corresponding beginning part of the work area.
    If such a line is not found, a new line is inserted according to the same rules as for the INSERT statement.
    If such a line is found, this line is overwritten according to the same rules as for the UPDATE statement.
    If the change would lead to a double entry in a unique secondary index, then it is not executed and sy-subrc is set to 4.
    Notes
    The wa work area should always be declared with reference to the database table or the view in the ABAP Dictionary.
    If the the database table or view is specified statically, then you the specification of the work area using FROM wa can be ommitted outside of classes if a dbtab table work area is declared for the corresponding database table or for the view using the TABLES statement. The system enhances the MODIFY statement implicitly with the FROM dbtab addition.
    Eg. :
    DATA message_wa TYPE t100.
    message_wa-sprsl = 'EN'.
    message_wa-arbgb = 'MYMSGCLASS'.
    message_wa-msgnr =  '100'.
    message_wa-text =  'Some new message ...'.
    MODIFY t100 FROM message_wa.
    2. Syntax for changing Database table from internal table is ,
    MODIFY dbtab FROM TABLE itab.
    Effect
    If an itab internal table is specified, the system processes all lines in the internal table according to the rules for the wa work area. The line type of the internal table has to meet the requirements for use in Open SQL statements.
    If the change to a line in the internal table would lead to a double entry in a unique secondary index, the corresponding line is not inserted and sy-subrc is set to 4. If the internal table is empty, sy-subrc is set to 0. The sy-dbcnt system field is always set to the number of lines that were actually processed
    Reward if helpful.

  • Update the database table with the content of the internal table

    Hello!
      I have the next form:
      FORM erase_data.
    SELECT * FROM zadrress INTO CORRESPONDING FIELDS OF TABLE itab_adrress.
      DELETE TABLE itab_adrress: FROM zadrress,
                                 WITH TABLE KEY adrid = '456'.
      WRITE 'The information after the DELETE operation'
      COLOR 2.
      LOOP AT itab_adrress INTO wa_adrress .
        WRITE:/
               wa_adrress-adrid COLOR 5,
               wa_adrress-name COLOR 7,
               wa_adrress-email COLOR 5,
               wa_adrress-depart COLOR 7,
               wa_adrress-display COLOR 5.
      ENDLOOP.
      SKIP.
    LOOP AT itab_adrress INTO wa_adrress.
       MODIFY zadrress FROM wa_adrress.
       COMMIT WORK.
       IF sy-subrc = 0.
         WRITE 'OK !'.
         SKIP.
       ELSE.
         WRITE 'FAIL !'.
         SKIP.
       ENDIF.
    ENDLOOP.
      MODIFY zadrress FROM TABLE itab_adrress.
      UPDATE zadrress FROM TABLE itab_adrress.
    TRANSPORTING adrid, name, email, depart, display.
    INSERT zadrress FROM TABLE itab_adrress ACCEPTING DUPLICATE KEYS.
    PERFORM display_data .
    ENDFORM.                    "erase_data
    I see that my record is deleted  when I display the records from my internal table, but
    now I want to delete the record from database table.
       For that I want to move the content of the modified internal table in the database table. You can see the methods I tried (some of them commented), but nothing seems to work.
    Any advice ?
    Thank you.

    FORM erase_data.
    SELECT * FROM zadrress INTO CORRESPONDING FIELDS OF TABLE itab_adrress.
    DELETE TABLE itab_adrress: FROM zadrress,
    WITH TABLE KEY adrid = '456'.
    WRITE 'The information after the DELETE operation'
    COLOR 2.
    LOOP AT itab_adrress INTO wa_adrress .
    WRITE:/
    wa_adrress-adrid COLOR 5,
    wa_adrress-name COLOR 7,
    wa_adrress-email COLOR 5,
    wa_adrress-depart COLOR 7,
    wa_adrress-display COLOR 5.
    ENDLOOP.
    SKIP.
    LOOP AT itab_adrress INTO wa_adrress.
    MODIFY zadrress FROM wa_adrress.
    COMMIT WORK.
    IF sy-subrc = 0.
    WRITE 'OK !'.
    SKIP.
    ELSE.
    WRITE 'FAIL !'.
    SKIP.
    ENDIF.
    ENDLOOP.
    <b>DELETE FROM zadrress.</b>  "Make this change and try
    MODIFY zadrress FROM TABLE itab_adrress.
    UPDATE zadrress FROM TABLE itab_adrress.
    TRANSPORTING adrid, name, email, depart, display.
    INSERT zadrress FROM TABLE itab_adrress ACCEPTING DUPLICATE KEYS.
    PERFORM display_data .
    ENDFORM. "erase_data'.

  • Updating a custom table

    I am trying to update a custom table in BW with the following statement.
    UPDATE customtable FROM TABLE ITAB1.
    itab1 has entries but the customtable is not getting updated do i need to use any commit statement for that.

    Hi,
    Yes..Give COMMIT WORK statement after the update statement.
    Example
    UPDATE customtable FROM TABLE ITAB1.
    IF SY-SUBRC = 0.
      COMMIT WORK.
    ENDIF.
    Thanks,
    Naren

  • Update the database table

    Hi All,
      i need to do  direct update to the database table and the table has apprx 60,000 records . i am getting all records from database table to internal table and has to chnage the one of the field value and pass it to the database table .  So  i am looping  the internal table and what is the best approach to update the database table is it to  use UPDATE Pa0001 SET KOSTL = it_0001-KOSTL from table it_0001  each time in the loop to update each record  and commit work which hits database for each record or use the statement UPDATE  pa0001 from table it_0001 and if count = 1000 then  COMMIT work in this way it will hit the database for every 1000 records . Appreciate your suggestions,
    Thanks,
    Latha.

    My Code to update PA0006 is :
    DATA:  t_pa0006 TYPE STANDARD TABLE OF pa0006 INITIAL SIZE 0,
           wa_pa0006 LIKE LINE OF t_pa0006,
           w_lin TYPE i.
    FIELD-SYMBOLS:  <fs_pa0006> LIKE LINE OF t_pa0006.
    SELECT * FROM pa0006 INTO TABLE t_pa0006 WHERE uname = 'PKHAROR'.
    LOOP AT t_pa0006 ASSIGNING <fs_pa0006>.
      <fs_pa0006>-stras = 'My Street'.
    ENDLOOP.
    DESCRIBE TABLE t_pa0006 LINES w_lin.
    UPDATE pa0006 FROM TABLE t_pa0006.
    IF sy-subrc EQ 0.
      COMMIT WORK.
      WRITE:/ w_lin, ' Records have been updated..'.
    ENDIF.
    Reward points for useful answers
    Regards
    Pradeep
    Regards
    Pradeep

  • I want to update the Custom table using the data available in ITAB.

    Hi,
    I want to updaste the Custom Table which is created by me (Ztable) using the data available in itab.(which i got from defferent standard tables)
    I want to update the custom table using the itab data How is it possible?
    Is any possible by using Modify ?
    DPK.

    example here
    modifying datbase table useing internal table
    advises before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
    MODIFY fkkvkp FROM TABLE lt_fkkvkp .
    and finally unlock the table
    example
    *To lock table for further operations
    constants: lc_tabname TYPE rstable-tabname VALUE 'FKKVKP' . "FKKVKP
    CALL FUNCTION 'ENQUEUE_E_TABLE'
    EXPORTING
    tabname = lc_tabname
    EXCEPTIONS
    foreign_lock = 1
    system_failure = 2
    OTHERS = 3.
    IF sy-subrc EQ 0.
    To fetch all the contract accounts for customers of the segment
    Households/SME.
    PERFORM fetch_contract_accounts using lc_tabname .
    ENDIF. " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
    MODIFY fkkvkp FROM TABLE lt_fkkvkp .
    *unlock the tbale
    CALL FUNCTION 'DEQUEUE_E_TABLE'
    EXPORTING
    TABNAME = uc_tabname .

  • Need to update Ztable from final internal table

    Hi,
    ITAB   = Final internal table has 9 fields : 1 2 3 4 5 6 7 8 9
    Ztable = Ztable has 6 fields ex : 1 3 4 6 7 8
    Structure of both Itab and Ztable are different.
    I have data in the Final Internal table and needs to update data into a ztable.
    If condition is true...
      Modify ztable from itab
    endif.
    Any suggestions how I can update Ztable from the INternal table
    Regards,
    Kittu

    Hello,
    First keep the loop to the final internal table then move all the records to the work area after moving to workarea then create another workarea for the Ztable then move only the field values which are there in Ztable then use modify keyword.
    example
    move:
    y_wa_final_itab-kdauf to y_wa_zhr_item-vbeln,
    y_wa_final_itab-kdpos to y_wa_zhr_item-posnr,
    y_wa_final_itab-receiptno to y_wa_zhr_item-receiptno
    modify zhr_item from y_wa_zhr_item

Maybe you are looking for

  • ITunes crash on start up after upgrade to 10.7

    Hi, I'm using window 7 32bit SP1 and after upgrade ITunes crash on start up. this is what i get in event viewer. Faulting application name: iTunes.exe, version: 10.7.0.21, time stamp: 0x504d85d9 Faulting module name: KERNELBASE.dll, version: 6.1.7601

  • Installation of forms 10G

    Hi all, I am struggling to install Forms 10G on Windows server 2008 machine. Can you please help me finding the solution. Its very urgent and nobody in our team or onsite team knows about it. Please, its very urgent and really helpful to me. Thank yo

  • Problems in Material Master Upload by LSMW

    Dear Experts, The question was asked to me in interview, What Problems you face while uploading your material master data by LSMW ? Please give me some information on this question. Thanks in Advance

  • HOW TO: Broadcasting the email with the different schedule?

    Hello all, first time to post to the forum, please help with the following question. We have a requirement to broadcast a query view only every Wednesday morning and also data loading is completed successfully (data is loaded every day). we are runni

  • Add Resource Files

    Can anyone tell me how to add images or audio files, to my java application so I can then access them using this.getClass().getResource(URL); ? I'm using NetBeans 6.7.1 Thanks