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

Similar Messages

  • Update the database table inside an user exit.

    Hi Experts,
    I have a issue where i have to update a custom table in an User exit.
    I am using Lock object for ENQUE/DEQUE.
    I have tried to use statements like UPDATE/MODIFY inside the user exit.
    But the problem is that it's not updating the database table at the same time.
    I know if i use COMMIT WORK it can update at the same time but it's not advisable to use COMMIT inside a work.and also it gives a short dump.
    The real issue is that this custom table is read for batch creation at the same time for different users.
    Now if it the program does not update the database table at the same time then other users also read the same data and create the same Batch number..
    While requirement is to create a different/unique batch numbers.
    Program is updating the table but it's taking time..so in between other users are creating the same batch number.
    Please guide me what would be the best solution for this.
    Regards,
    Amit Kumar Singh

    Thanks for your quick reply.
    My actually requirement is like that.
    I have to create a Process Order using tcode COR1.
    After passing some input value it goes inside an User Exit.
    There one Custom table is maintained which stores some fields like month,year,numeric key field,etc.
    The new batch number is created using the combination of these table fields.
    Once a new batch number is created it increment the numeric key field number by one.
    Issue is we have to update this new numeric field value into the database field so that other users can read a diffrent numeric field value.hence it will create a new/different batch number.
    Here i am not able to update the database table inside this User Exit.
    Table is geeting updated but after some time and out of this User Exit.
    Please suggest what's required in that case?
    Regards,
    Amit Kumar Singh
    Edited by: Amit  Singh on Feb 3, 2009 11:33 AM

  • Field value is getting double while updating the database table

    Hi Experts,
    A simple doubt :
    there is a standard program through which a zfunction module is getting triggered, through this zfunction module i am updating the database table.
    Now what happening is one of the field(KCQTY) value in database is getting double at a time when i am executing the Program with same variant only.
    I have also done the CLEAR & REFRESH internal tables starting of the Function module.
    Can you please help me out.
    Max points wil be awarded.
    thanks
    rico.

    Hi Nicole,
    this is the part of the coding where you can see how the field KCQTY is getting moved in the loop statement.
      DELETE IT_CE20002B_815 WHERE
          KONDA = SPACE  OR
          WERKS = SPACE  OR
          VVB01001 < 0.
        LOOP AT IT_CE20002B_815.
          INDX = SY-TABIX.
          CONCATENATE IT_CE20002B_815-PERBL0(4) IT_CE20002B_815-PERBL5(2)
                                                    INTO MONAT.
       MOVE itab_ce20001b-perbl TO monat.
          CLEAR S815.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                           BINARY SEARCH.
            SELECT SINGLE * FROM S815 WHERE VRSIO = '000'
                                         AND SPMON = MONAT
                                         AND KONOB = 'APO'
                                         AND MVGR2 = IT_CE20002B_815-KONDA
                                         AND PRODH = IT_CE20002B_815-PRDHA
                                         AND WERKS = IT_CE20002B_815-WERKS.
                                        AND VTWEG EQ CO_VTWEG_99.
    BREAK SAMEE.
          IF SY-SUBRC EQ 0.
    Eintrag in S810 existiert
            IF S815-AEMENGE <= IT_CE20002B_815-VVB01001.
    wenn die Auftragseingangsmenge kleiner gleich der Kontingentsmenge
    wird die Kontingentmenge in das Steploop übernommen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
    *Liste ausgeben
             PERFORM AUSGABE4.
              PERFORM AUSGABE4_815.
            ELSE.
    Ausgabe Fehlermeldung, wenn die Auftragsmenge größer als die
                           Kontingentmenge ist.
    *Liste mit fehlermeldungen ausgeben, Kontingent trotzdem übernehmen
              MOVE IT_CE20002B_815-VVB01001 TO  W_T_DATA_815-KCQTY.
             PERFORM AUSGABE_FEHLER4.
              PERFORM AUSGABE_FEHLER4_815.
            delete it_ce20002b index indx.
            continue.
            ENDIF.
          ELSE.
    Es existiert kein Eintrag in S810, dann direkt eingeben
            MOVE IT_CE20002B_815-VVB01001 TO W_T_DATA_815-KCQTY.
            MODIFY IT_CE20002B_815 INDEX INDX.
    *Liste ausgeben (Kein Eintrag in S810)
           PERFORM EINTRAG2.
            PERFORM EINTRAG2_815.
          ENDIF.
    *Übergabestructur für die Weiterverarbeitung durch das Copymanagement
    *im Functionsbaustein wird gefüllt.
          W_T_DATA_815-SPMON = MONAT.   "itab_ce20001a-perbl.
          W_T_DATA_815-KONOB = CO_KONOB_APO.
          READ TABLE IT_ZPL_MCS5 WITH KEY KONDA = IT_CE20002B_815-KONDA
                                          BINARY SEARCH.
          IF SY-SUBRC EQ 0.
            W_T_DATA_815-MVGR2 = CO_MVGR2_999.
          ELSE.
            W_T_DATA_815-MVGR2 = IT_CE20002B_815-KONDA.
          ENDIF.
          W_T_DATA_815-WERKS = IT_CE20002B_815-WERKS.
          W_T_DATA_815-PRODH = IT_CE20002B_815-PRDHA.
         W_T_DATA_815-VTWEG = '99'.
         W_T_DATA_815-KUNNR = '9999999999'.
          W_T_DATA_815-KCQTY = IT_CE20002B_815-VVB01001.
          W_T_DATA_815-BASME = IT_CE20002B_815-VVB01_ME.
    JR181005 - begin of ins.
         w_t_data_810-matkl = it_ce20002b-matkl.
    JR181005 - end of ins.
          APPEND W_T_DATA_815 TO TAB_DATA.
          CLEAR IT_CE20002B_815.
        ENDLOOP.
    thanks for reply
    rico

  • How  and where does SAP standard programs update the master tables...

    Hello there,
    How  and where does SAP standard programs update the master tables...
    to be precise.. if a (any) transaction occurs  the programs behind it holds the data in temporary structures.
    where and when does it get updated in the master table.
    can anyone tell me how it happens?
    I Know that from the where used list one can find the corresponding table but most of the time it wont suffice
    I am expecting a proper answer.
    Santosh B

    Hello Santosh,
    you need to do some self-reading on the following topic
    Updates in the SAP System (BC-CST-UP)
    http://help.sap.com/saphelp_47x200/helpdata/en/e5/de86e135cd11d3acb00000e83539c3/frameset.htm
    Regards,
    Siddhesh

  • 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 have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    I have two apple id's because my hotmail account is no longer active. How can I delete the old one and use or update the new one?  Every time I try it won't allow me and now my iPad thinks there are two accounts and they are arguing with each other. Help!

    You can't merge accounts or copy content to a different account, so anything that you bought or downloaded via the old account is tied to that account - so any updates that those apps get you will only be able to download via that account. You can change which account is logged in on the iPad via Settings > Store

  • 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.

  • How to update the VBFA table without entries in VBRK and VBRP tables

    Hello,
    I have a requirement , where the sales order , delivery happens in one SAP system say X system and billing document wil happens in other sap system say Y.
    Now in this particular case , if the user want to know the billing document number in X system. what would be the solution.
    Is there any possibility to update the VBFA table with invoice number of Y system (without updating the VBRK and VBRP tables).
    User want to see the billing doc number from sales order in the form of document flow in X system
    Thanks in advance
    Pradeep

    Hii
    Without updating VBRK/VBRP table and updating VBFA is not possible, So you have to play with work arround to create one Z TABLE, so whenever system Y will create billing document with the reference of System X data you have to update Ztable with Invoice number created in System Y, The primary key will be in Z TABLE is Delivery document number to track one to one with billing doc.
    Thanks and Regards
    Shambhu Sarkar

  • How do I update the result table ?

    I am having problem to design and update the competition results in WPC_RESULTS table.
    I have 3 tables
    1. WPC_COMPETITION - It has details of the competition to be conducted.
    2. WPC_MEMBERS - Member details.
    3. WPC_RESULTS - Competition results which will have Member_ID, Competition_ID and Status.
    In Region 1. I have a drop down list from which I can select the Competition.
    Problem is with region 2.
    ==================
    In Region 2. I plan to have All the Member's Name from WPC_MEMBERS, a Status column (W=Win or L=Lost or X=NotPlayed) from WPC_RESULT which can be updated. But the table WPC_RESULTS dosenot have a primary key but has 2 foreign key one from WPC_COMPETITION and one from WPC_MEMBERS.
    I am just not able to plan & create this region 2.
    Can someone login to my wokspace and give me a helping hand.
    Please mail me at [email protected] and I would give you the password for my workspace.
    Regards,
    Nikhil Karnik

    My problem is since the WPC_RESULT table has two master tables. I cannot use a Master Detail form.
    What I am trying is,
    On a form which displays all the member in WPC_MEMBERS, Drop down list of competition name from WPC_COMPETITION table and a there should be checkbox for status column of WPC_RESULT. So my challenge is to update the WPC_RESULT table with the respective member id and competition id and status in WPC_RESULT table.
    As you said I can use a PL/SQL, but I could not understand how do create my PLSQL block to identify each member on the form and update the competition status associated with that member.
    in short the table definition is like
    CREATE TABLE "WPC_COMPETITION"
    (     "COMPETITION_NAME" VARCHAR2(100),
         "COMPETITION_CODE" NUMBER,
         "DATE_CONDUCTED" DATE,
         CONSTRAINT "WPC_PK1" PRIMARY KEY ("COMPETITION_CODE") ENABLE
    CREATE TABLE "WPC_COMPETITION"
    (     "COMPETITION_NAME" VARCHAR2(100),
         "COMPETITION_CODE" NUMBER,
         "DATE_CONDUCTED" DATE,
         CONSTRAINT "WPC_PK1" PRIMARY KEY ("COMPETITION_CODE") ENABLE
    CREATE TABLE "WPC_RESULTS"
    (     "COMPETITION_CODE" NUMBER,
         "STATUS" VARCHAR2(1),
         "MEMBER_ID" NUMBER
    ALTER TABLE "WPC_RESULTS" ADD CONSTRAINT "WPKD_FK1" FOREIGN KEY ("COMPETITION_CODE")
         REFERENCES "WPC_COMPETITION" ("COMPETITION_CODE") ENABLE
    ALTER TABLE "WPC_RESULTS" ADD CONSTRAINT "WPKD_FK2" FOREIGN KEY ("MEMBER_ID")
         REFERENCES "WPC_MEMBERS" ("MEMBER_ID") ENABLE
    /

  • In OWB I need to update the target table with same field for match/update

    In OWb I am trying to update the target table with the match and the update on the same field can this be done. I am getting a error match merge error saying you cannot update and match on the same field. But in SQl my select is
    Update table
    set irf = 0
    where irf = 1
    and process_id = 'TEST'
    Hwo do i do this in OWB.

    table name is temp
    fields in the table
    field1 number
    field2 varchar2(10)
    field3 date
    values in the table are example
    0,'TEST',05/29/2009
    9,'TEST',05/29/2009
    0,'TEST1',03/01/2009
    1,'TEST1',03/01/2009
    In the above example I need to update the first row field1 to 1.
    Update temp
    set field1 = 1
    where field1 = 0
    and field2 = 'TEST'
    when I run this I just need one row to be updated and it should look like this below
    1,'TEST',05/29/2009
    9,'TEST',05/29/2009
    0,'TEST1',03/01/2009
    1,'TEST1',03/01/2009
    But when I run my mapping I am getting the rows like below the second row with 9 also is getting updated to 1.
    1,'TEST',05/29/2009
    1,'TEST',05/29/2009
    0,'TEST1',03/01/2009
    1,'TEST1',03/01/2009

  • Change the data in fieldcat and update the database table in alv oops

    Hi,
    my requirement is i have displayed a fieldcat in change mode and when i change the data and click on save it has to be updated the database table..
    this has to be done using alv oops...

    Hi,
    This code will reflect all the changes into the internal table that is being displayed.
    * to reflect the data changed into internal table
          DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
          IF ref_grid IS INITIAL.
            CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
              IMPORTING
                e_grid = ref_grid.
          ENDIF.
          IF NOT ref_grid IS INITIAL.
            CALL METHOD ref_grid->check_changed_data.
          ENDIF.
    Now after this code is executed the internal table is modified as per the changes done in alv output.
    Now you can use this internal table to update the database table.
    Hope this helps you.
    Regards,
    Tarun

  • Updating the VETVG table while creating the purchase order

    hi all,
       I have one requirement to calculated the delivery creation date while creating the Purchase Order. It is calculated based on the delivery date of PO. I have calculated that one but how to update it after calculation. Can any body give a user exit or BADI with implementation which will update the VETVG table while creating the PO.
    Thanks
    rajkumar

    hi sanjay,
    thanks for reply, I am using same BADI(ME_PROCESS_PO_CUST) and implementation(FIELDSELECTION_ITEM_REFKEYS). In this implementation i am setting the shipping data with SET_SHIPPINGDATA method . but after that the values are not updating the EKPV and VETVG tables but it is only showing in the screen. Can you give a idea where to pass these values so it will update the tables.
    thanks
    rajkumar

  • 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 a PLSQL API for update the oe_order_headers_all table

    Hi all,
    I need a PLSQL API for update the oe_order_headers_all table.
    Anyone know please help me.
    Regards,
    M.Soundrapandian.

    Use the Process Order API to update this table.
    Note: 746787.1 - Process Order API In Order Management
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=746787.1
    Oracle Order Management Open Interfaces, API, & Electronic Messaging Guide
    http://download-uk.oracle.com/docs/cd/B25516_14/current/acrobat/115omapi.zip
    Oracle Integration Repository
    http://irep.oracle.com

  • Update the JEST table

    Hi,
    Is there a BAPI that updates the JEST table - status of scheduling agreements?
    Thanks,
    Leon

    Hi,
    I want to insert new user status in JEST table but I can't find any suitable function. I have tried all function listed above, but it not works. Did anyone know what function module to insert new user status in JEST table?
    example:
    MANDT OBJNR                         STAT       CHGNR
    140   NV000000097200000007     E0004       001 
    140   NV000000097200000007     E0006       001 
    140   NV000000097200000007     I0001       001 
    140   NV000000097200000007     I0028       001 
    I would like to add stat = 'E0007' in JEST table. Thanks.

Maybe you are looking for

  • Where can I buy an iPhone 3GS for cheap?

    Hello. Does anyone know where I can buy a used iPhone 3GS for cheap, and how much money do they go for?

  • Timer in Gallery

    Hello, Just experimenting a bit but has anyone tried to add different timers to a gallery? Scenario add minutes input to gallery in that gallery a timer with each time a separate start / stop / reset function Functional requirement is for each of the

  • Subreport Error

    I have a report that is nothing more than a compilation of 6 subreports.  This report works perfectly locally in design mode (using VS 2008).  It was migrated to a report manager instance and worked perfectly.  It was migrated to a second report mana

  • Unable to run the rxe file

    Hello, I am Japanese, so excuse me if my question is hard to understand. I have a problem in running rxe file on NXT. I tryed to use Basic Chart.vi in the examples using debug command in the NXT terminal. The VI was succesfully compiled and downloade

  • SAP Business Objects Explorer app Sybase SUP settings

    Hello Community, Is there a guide or a how to for setting up the SAP Business Objects Explorer application with Sybase Unwired Platform? I found a guide to setup the SAP BusinessObjects Mobile application but nothing for Explorer. Could someone pleas