Update db table for duplicate entries.

Hi,
If i want to update a ztable
i have 3 to 5 different ways.
1.   UPDATE ztab FROM workarea.
2.   UPDATE ztable SET field1 = wa-f1 field2  = wa-f2
               WHERE keyf1 = wa-kf1
               AND   keyf2 = wa-kf2.
3.  UPDATE ztable FROM TABLE itab.
4.  MODIFY ztable FROM TABLE itable  or from  wa.
but if i want to update some 2 to 3 fields
by checking with the fields in db table with values in flat file
and when i check the dbtable values with flat file and i find the entries in dbtable are multiple because i am not putting all key fields in where condition
because i know only some of them .
so duplicate entries are available and i wanted to update the same values to all those duplicate records .
then how should i update them.
i don't want to use update between
select and end-select because the records that i am updating are many.
i will store records into itab and then i will compare with values i file
and for all records i want to update the two or three fields with the values  in flat file.
help me.

Hi Ashish,
Thanks for your help.
If i do this way always it satisfies the first record of the multiple records that are satisfied when we put where condition with some of the key fields.
then always it might update the same record.
I stead i can loop through the itab having the DB table and read the file.
Anyways thanks for the help.
and i am waiting for the correct file, once i get it, then i will try this and update points.
Thanks,
Neetu.

Similar Messages

  • How to create a scenarios for duplicate entries

    Hi friends,
    Please help me how to create a scenarios for duplicate entries, we are using stock transfer orders from there we need to create scenarios for duplicate entries, please guide me on the same.

    Hi,
    F-01 can be used to create a sample document.
    Regards
    Aditya

  • OBA5 : Error Message for duplicate entry

    Hi
    In Tcode OBA5 - i enter F5 as Apllication area and i select new entries - i Enter 117 - and i Enter E before i save.
    but when i go to MIRO to check if there is an error message for duplicate entry, i find just a Warning Message !
    Please did i forget any thing ? please advise.
    Thank You,

    Hello,
    OBA5 should be enough, but you must remenber that the following fields must be identical for duplicate invoice check:
         Company code                           (BUKRS)         
         Vendor number                           (LIFNR)         
         Currency                                    (WAERS)         
         Reference number                       (XBLNR)         
         Amount in document currency      (WRBTR)         
         Document date                           (BLDAT)         
    Note 305201 is also helpful.
    Cheers

  • Best way to update RBSELBEST table for invoice

    what is the best way to update RBSELBEST table for PO invoice? Is there any BAPI or FM for this?

    Thanks. I tried this one also, but it does not update the table.
    in case if someone used this, what parameters i need to pass for this to work?

  • Table for service entry sheet quantity

    Hello,
    I know the table for service entry sheet detail is ESSR.
    I want to find out the qunaity which i booked in service entry sheet from table.
    I am not able to get it. I tried table ESLL. But still it does not show the quantity.
    Please guide me to the table name in which when i put service entry sheet no , i will get the quantity
    Thanks
    Nilesh

    hi,
    FRom ESSR  table for the corresponding po , find out package no .Then the pass the same package no in table ESLL table where you can get the desired service qty.
    Regards,
    velu

  • T-Code to update condition table for delivery & transport scheduling to SCM

    Hello,
    Could you tell the T-code to update condition table for delivery & transport scheduling to SCM system
    These are the some SAP fileds
    /SAPCN1/KOTABNR (Condition Table)
    /SAPCND/KAPPL(Application)
    /SAPCND/KSCHL(Condition type)
    /SAPCND/KOLNR(Access sequence)
    Thanks in Advance
    RK
    Edited by: RK on Jun 9, 2009 5:58 PM

    HI
    The TCODE for this is /SAPAPO/ATP_GCM.
    Regards
    Anurag.

  • Select fom table for all entries where field starts with value

    Hello
    I want to write a select like this
    select * from bsis
    into lt_bsis
    for all entries in lt_itab
    where xblnr like lt_itab-belnr%
    I want to select all the entries from bsis where the field xblnr starts with the values found in lt_itab-belnr.
    for example
    ls_itab-belnr = 5100000028
    bsis-xblnr = 510000002810001
                        510000002810002
                        510000002810003
                        520000002810001
    and i want to select only the entries that start with 5100000028 in this case
    Can anybody help?
    Thanks

    Hi,
    I hope below example code will help you to fix your issue,
    REPORT  ytest.
    TYPES : BEGIN OF ty_typ1,
              val TYPE i,
            END OF ty_typ1.
    TYPES : BEGIN OF ty_typ2,
              val1 TYPE hrobjid,
              val2 TYPE hrobjid,
            END OF ty_typ2.
    DATA : int_typ1 TYPE TABLE OF ty_typ1,
           int_typ2 TYPE TABLE OF ty_typ2,
           wa_typ1  TYPE ty_typ1,
           wa_typ2  TYPE ty_typ2,
           int_1001 TYPE TABLE OF hrp1001,
           wa_1001  TYPE hrp1001.
    REFRESH : int_typ1, int_typ2, int_1001.
    CLEAR : wa_typ1, wa_typ2, wa_1001.
    wa_typ1-val = 500001.
    APPEND wa_typ1 TO int_typ1.
    wa_typ1-val = 500002.
    APPEND wa_typ1 TO int_typ1.
    wa_typ1-val = 500003.
    APPEND wa_typ1 TO int_typ1.
    wa_typ1-val = 500001.
    APPEND wa_typ1 TO int_typ1.
    SORT int_typ1 ASCENDING BY val.
    DELETE ADJACENT DUPLICATES FROM int_typ1 COMPARING val.
    LOOP AT int_typ1 INTO wa_typ1.
      wa_typ2-val1 = ( wa_typ1-val * 100 ) + 1.
      wa_typ2-val2 = wa_typ2-val1 + 98.
      APPEND wa_typ2 TO int_typ2.
      CLEAR : wa_typ1, wa_typ2.
    ENDLOOP.
    SELECT * FROM hrp1001 INTO TABLE int_1001
             FOR ALL ENTRIES IN int_typ2 WHERE
                 plvar EQ '01'          AND
                 otype EQ 'S'           AND
                 sclas EQ 'O'           AND
                 begda LE sy-datum      AND
                 endda GE sy-datum      AND
                 objid GE int_typ2-val1 AND
                 objid LE int_typ2-val2.
    LOOP AT int_1001 INTO wa_1001.
      WRITE : / wa_1001-objid.
    ENDLOOP.
    Thanks & Regards,
    Harish Kumar N

  • Software update show installed and duplicate entries

    I ran software update today. It listed an update for "iTunes + Quicktime" and two security updates 2007-001. Also listed were security update 2007-002 and the daylight savings time update.
    What is odd is the duplicate entry and that the security update is listed in the install log.
    Also, the "iTunes + Quicktime" update refers to version 7.0.2; in the install log "iTunes" version 7.0.2 is listed, note different names. No mention of Quicktime in the update from last year.
    Both the security and iTunes updates failed to download completely.
    This scenario was played out on both a dual G5 tower and a PowerBook.
    What might be going on here?
      Mac OS X (10.4.8)  

    The same has happened to me.
    I updated yesterday with the DST Updates (including Java 5.0) and ran it again today to find the 'iTunes + Quicktime' and security update 2007-001 listed. Tried to download them - it wouldn't complete - and then checked my install log to find that I have both of these anyway!
    Hopefully it's just a glitch. Has Apple perhaps changed the ID of these updates?
    iMac G5   Mac OS X (10.4.8)  

  • Updating database table with DUPLICATE keys

    i have an internal table having data as follows.
    emp_id     name     date           proj_id  activity_id    Hours  Remarks
    101     Pavan    09.10.2007      123     1         2.00       Coding
    101     Pavan     09.10.2007   124     2         1.00        Documentation
    102     Raj     09.10.2007   123        3         6.00     Testing
    Now i need to update a Ztable with above mentioned data.
    The structure of the Ztable is as follows.
    Mandt     emp_id  name    date    proj_id   activity_id   Hours   Remarks
    NOte: i have ticked both check boxes for the field MANDT in table.
    Rest didnt select the check boxes.
    I believe now the field MANDT alone is a primary key for the z-table.
    NOw i have tried with UPDATE/INSERT statments to update the database table.
    But instead of inserting all the rows, the system is over writing on the same emp_id row.
    Even tried with the statments like INSERT INTO <Ztable> values <Internal table> ACCEPTING DUPLICATE KEYS.
    But its not getting inserted as a separate row in the table.
    Requirement is to insert the multiple rows in the database table without any over writing activity.
    Can anyone give me the code to do this?
    Regards
    Pavan

    Hi Pavan,
        Please let me know what are the key fields in your Ztable. Try with below code it may help you. change the "Ztablename" as your database table name and I_INTERNAL TABLE  as your internal table name. still you are facing the problem please let me know.
    lock the custom table before updating the table.
      CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
      MODE_RSTABLE         = 'E'
         TABNAME              = 'ZTABLENAME'
      VARKEY               =
      X_TABNAME            = ' '
      X_VARKEY             = ' '
      _SCOPE               = '2'
      _WAIT                = ' '
      _COLLECT             = ' '
       EXCEPTIONS
         FOREIGN_LOCK         = 1
         SYSTEM_FAILURE       = 2
         OTHERS               = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        INSERT  ZTABLENAME FROM TABLE I_INTERNALTABLE ACCEPTING DUPLICATE KEYS.
        COMMIT WORK.
      ENDIF.
    unlock after updating the custom table After updation is done.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
        MODE_RSTABLE       = 'E'
         TABNAME            = 'ZTABLENAME'
        VARKEY             =
        X_TABNAME          = ' '
        X_VARKEY           = ' '
        _SCOPE             = '3'
        _SYNCHRON          = ' '
        _COLLECT           = ' '

  • What is the transid in incoming payment tables for canceled entry

    The transid for document No. 1267 is 5555 in tables ORCT & OJDT.
    if canceled the document no. 1267 then reverse entry transid in ojdt table for this document is 5556.
    But where I have to find the reference 5556 in Incoming tables.
    I don't want to in a report the both 5555 & 5556 JEs.

    Hi
    you have two entries for OJDT table with the same document number and source, one for the original and another one for the cancellation.
    Kind regards
    Agustin Marcos Cividanes

  • Join Internal Table for all entries

    Hi,
       I have put the LIKP data in the internal table and then use the for all entries statement to join the table with LIPS.  Besides, i specifiy an additional condition to filter empty batch.
    But, i found that the empty batch record still exist in the result.  Any idea??
        SELECT *
        FROM LIPS INTO  TABLE I_DELIVERY_INFO
        FOR ALL ENTRIES IN I_DELIVERY
        WHERE
        VBELN = I_DELIVERY-VBELN.
        AND
        CHARG IS NOT NULL.
    Regards,
    Kit

    Hi Kit,
    If you are using LIKP and LIPS then you can directly join them since these tables are HEADER & ITEM table.
    regd ur query you can use CHARG NE ' '.
    Regards
    Gopi

  • Update Bseg table for one field (Functional Area)

    Dear all
    I need to update function area in bseg table for existing records. How can i modify for that particular field without using update command. Is any BAPI is there for update document no. I have Lakhs records. So is any other way to modify that field.
    This is happening in production. please give your valuable guide how to do it?

    I'm not sure it is advisable to perform, take a look at OSS [Note 966428 - FB02: Functional area (FKBER) can be changed on coding block|https://service.sap.com/sap/support/notes/966428],*this note seems to imply that this area should not be changed..
    Look alsio to Customizing (SPRO) Financial Accounting, Financial Accounting Global Settings, Document, Line Item, Document Change Rules, Line Item.
    Keep in mind that this field is replicated from FI line items to other applications and tables.
    If you must perform this change at you own risk, you may build a huge batch-input based on FB02 or FB09 transactions. Another solution is to reverse the documents and then post again those documents with functional area.
    Regards

  • Update EKKO table for the custom field through BAPI

    Hi Experts,
    I need to create an Custom field in EKKO table through Include Structure.
    Now I have to update that custom field in my program.
    I have gone through the following but could not solve my question.
    Update EKKO table
    User Exit for ME21 PO Creation at the time of saving--Urgent
    I don't need to update when I hit the save button or any thing
    I have the PO's which needs to be updated with that field...
    Any suggestions would be greatly helpful.
    Thanks,
    Chaithanya...
    <removed_by_moderator>
    Edited by: Julius Bussche on Jul 7, 2008 10:47 PM

    Hi Patrick,
    Sorry Patrick you are right.. The structure is at header level.
    I have made the changes still I could not achieve it.
    I have made the following
    In EKKO table I have append the structure with a custom field ZZBUY.
    Now I have also appended BAPI_TE_MEPOHEADER and BAPI_TE_MEPOHEADERX with the custom field
    ZZBUY.
    Here is my program
    Data: wa_bapi_poheader  type BAPIMEPOHEADER,
             wa_bapi_poheaderx type BAPIMEPOHEADERX.
    Data: it1_bapi_poheader  like BAPI_TE_MEPOHEADER,
             it1_bapi_poheaderx like BAPI_TE_MEPOHEADERX.
    CALL FUNCTION 'BAPI_PO_GETDETAIL1'
      EXPORTING
        PURCHASEORDER            = wa_DATA-ebeln
    *   ACCOUNT_ASSIGNMENT       = ' '
    *   ITEM_TEXT                = ' '
    *   HEADER_TEXT              = ' '
    *   DELIVERY_ADDRESS         = ' '
    *   VERSION                  = ' '
    *   SERVICES                 = ' '
      IMPORTING
        POHEADER                 = wa_bapi_poheader
    *    POEXPIMPHEADER           =
      TABLES
        RETURN                   = it_bapireturn
    it1_bapi_poheader-ZZBUY = 'X'.
    it1_bapi_poheaderx-ZZBUY = 'X'.
    it_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
    it_extensionin-valuepart1 = it1_bapi_poheader.
    append it_extensionin.
    Clear  it_extensionin.
    it_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
    it_extensionin-valuepart1 = it1_bapi_poheaderx.
    append it_extensionin.
    Clear  it_extensionin.
       CALL FUNCTION 'BAPI_PO_CHANGE'
         EXPORTING
           PURCHASEORDER                = wa_data-ebeln
           POHEADER                     = wa_bapi_poheader
           POHEADERX                    = wa_bapi_poheaderx
    *      POADDRVENDOR                 =
    *      TESTRUN                      =
    *      MEMORY_UNCOMPLETE            =
    *      MEMORY_COMPLETE              =
    *      POEXPIMPHEADER               =
    *      POEXPIMPHEADERX              =
    *      VERSIONS                     =
    *      NO_MESSAGING                 =
    *      NO_MESSAGE_REQ               =
    *      NO_AUTHORITY                 =
    *      NO_PRICE_FROM_PO             =
    *    IMPORTING
    *      EXPHEADER                    =
    *      EXPPOEXPIMPHEADER            =
         TABLES
           RETURN                       = it_bapireturn
    *      POITEM                       =
    *      POITEMX                      =
    *      POADDRDELIVERY               =
    *      POSCHEDULE                   =
    *      POSCHEDULEX                  =
    *      POACCOUNT                    =
    *      POACCOUNTPROFITSEGMENT       =
    *      POACCOUNTX                   =
    *      POCONDHEADER                 =
    *      POCONDHEADERX                =
    *      POCOND                       =
    *      POCONDX                      =
    *      POLIMITS                     =
    *      POCONTRACTLIMITS             =
    *      POSERVICES                   =
    *      POSRVACCESSVALUES            =
    *      POSERVICESTEXT               =
           EXTENSIONIN                  = it_extensionin
    *      EXTENSIONOUT                 =
    *      POEXPIMPITEM                 =
    *      POEXPIMPITEMX                =
    *      POTEXTHEADER                 =
    *      POTEXTITEM                   =
    *      ALLVERSIONS                  =
    *      POPARTNER                    =
    *      POCOMPONENTS                 =
    *      POCOMPONENTSX                =
    *      POSHIPPING                   =
    *      POSHIPPINGX                  =
    *      POSHIPPINGEXP                =
    *      POHISTORY                    =
    *      POHISTORY_TOTALS             =
    *      POCONFIRMATION               =
    It gives me messages saying that
    Please also populate interface parameter POHEADERX
    No data changed
    Where am I going wrong..
    Waiting for your replies....
    Thanks,
    Chaitanya

  • Mass update tool/report for RSADMIN entries/ note 1064273

    I am looking for mass update report to input entries to RSADMIN table as recommended in the note 1964273.
    SAP_RSADMIN_MAINTAIN is for one record at a time.
    Regards ,Raghav

    Hi,
    The issue I encountered is that you must select your Target Group, not the segment neither the Segmentation Profile.
    And if your Target Group has the same name as your Segment or your Segmentation Profile, it won't work.
    So 2 important conditions to work:
    * Select the TG
    * Change the TG name to be different from Segment and Segmentation Profile
    Best Regards,
    Tom

  • Compare combintaion of two columns in two tables for duplicates

    Compare company+model combination in dbo.cars table with company+Model combination in dbo.details and update the Duplicate column in dbo.cars with ‘Y’ if the combination is already there in dbo.details table
     dbo.cars                                                                                                   
    dbo.details
    Company
    Model
    Released
    Duplicate
    Company
    Model
    Year
    Price
    Nissan
    N2011
    2011
    Nissan
    N2011
    2011
    30000
    Honda
    H2013
    2013
    Honda
    H2012
    2013
    31000
    Toyota
    T2009
    2009
    Toyota
    T2010
    2009
    32000
    For Example: In the above table only Nissan column should have ‘Y’ bcoz Nissan+N2011 exists in both table.
    dbo.cars                                                                                                    
    dbo.details
    Company
    Model
    Released
    Duplicate
    Company
    Model
    Year
    Price
    Nissan
    N2011
    2011
     Y
    Nissan
    N2011
    2011
    30000
    Honda
    H2013
    2013
    Honda
    H2012
    2013
    31000
    Toyota
    T2009
    2009
    Toyota
    T2010
    2009
    32000
    How to achieve this
    Thanks in advance

    Try the below:
    SElect A.*,Case when B.Model is not null then 'Y' else '' end as duplicate From dbo.Cars A
    Left Join dbo.details B on A.company= B.Company and A.Model = B.Model
    To Update the values:
    create table Cars (company varchar(100),model varchar(100),Duplicate char(1))
    Insert into Cars(Company,model) Select 'Nissan','2011'
    Insert into Cars(Company,model) Select 'Toyota','2011'
    create table details (company varchar(100),model varchar(100))
    Insert into details(Company,model) Select 'Nissan','2011'
    Insert into details(Company,model) Select 'Toyota','2012'
    update A Set Duplicate = Case when B.Model is not null then 'Y' else '' end
    From dbo.Cars A
    Left Join dbo.details B on A.company= B.Company and A.Model = B.Model
    Select* From Cars
    Drop table Cars,details

Maybe you are looking for