Updating the key field in a table

I am trying to assign new values to the primary key column in a table. As it is necessary to hold a permanent record of the relationship between the new and old values, I am extracting the old values into another table and assigning the new values from a sequence with an insert trigger on this table.
Within the same mapping, I cannot seem to take the new values from this table and update the original table. Ideally, I would like to update key flexfield colum with the new primary key values using the old primary values as the in the where clause' of the update statement (as opposed to delete and reinsert the rows into) the originating table - as I only pull across the key flexfield column into the number allocation table, this is necessary to preserve the other data.
Can anyone let me know how this can be achieved?...I cannot find the concept of new and old in OWB table updates.
I have tried using the (unsuitable) load type of 'DELETE/INSERT' on this table, but this results in the contents of the table being deleted when I run the mapping.

If it's necessary to change the primary key then your database design is likely wrong. I don't understand why it would be necessary to update a PK unless you use PK with a certain meaning which is a design failure.
Regards,
Jörg

Similar Messages

  • Update the Street field in ADRC table.

    Hello !! Please I need some help.
    I have to update the Street field in ADRC table.
    I have this list.
    Where I can put a Flag and an Update to do it.
    Im really newbie.  Im doing it in IDES, to test it first.
    Help !
    REPORT  Z_LIST_ADRC      LINE-SIZE 190
                             LINE-COUNT 65
                             NO STANDARD PAGE HEADING.
    TABLES: ADRC.
    DATA: BEGIN OF ITAB OCCURS 0,
               ADDRNUMBER LIKE ADRC-ADDRNUMBER,
               date_to like ADRC-date_to,
               NAME1 LIKE ADRC-NAME1,
               CITY1 LIKE ADRC-CITY1,
               CITY2 LIKE ADRC-CITY2,
               STREET LIKE ADRC-STREET,
               MC_NAME1 LIKE ADRC-MC_NAME1,
               MC_CITY1 LIKE ADRC-MC_CITY1,
               MC_STREET LIKE ADRC-MC_STREET,
    END OF ITAB.
    SELECT ADDRNUMBER DATE_TO NAME1 CITY1 CITY2 STREET MC_NAME1 MC_CITY1 MC_STREET
      FROM ADRC INTO TABLE ITAB.
    LOOP AT ITAB.
    WRITE : /001 ITAB-ADDRNUMBER,
                    007 ITAB-DATE_TO,
                    016 ITAB-NAME1,
                    040 ITAB-CITY1,
                    070 ITAB-CITY2,
                    090 ITAB-STREET,
                    120 ITAB-MC_NAME1,
                    150 ITAB-MC_CITY1,
                    170 ITAB-MC_STREET.
    ENDLOOP.
    TOP-OF-PAGE.
      ULINE.
        WRITE:         /001 'n-addr',
                        007 'date',
                        016 'name',
                        040 'city1',
                        070 'city2',
                        090 'street',
                        120 'name-s',
                        150 'city1-s',
                        170 'city2-s'.
      ULINE.

    HI,
    data : itab like standard table of adrc.
    select * from adrc into table itab.
    loop at itab.
    itab-street2 = 'New value'.
    modify itab index sy-tabix.
    endloop.
    if not itab[] is initial.
    modify adrc from table itab.
    endif.

  • Updating the CUstomer fields in mARC table using BAPI_MATERIAL_SAVEREPLICA

    Hi friends,
    I want to update the Zfields in MARC table .Please provide me the details for updating these fields (Extension in bapi) Using the  BAPI_MATERIAL_SAVEREPLICA
    Thanks in advance

    Hi Varsha,
    There is documentation provided for this funtion module:
    If long texts (for example, basic data texts, internal notes, purchasing info texts, material notes or sales and distribution texts) or customer-specific fields have to be created for a material, some specific characteristics have to be taken into consideration. These characteristics are detailed in the documentation for parameters MATERIALLONGTEXT and EXTENSIONIN.
    Documentation is present for the parameters by clicking on EXTENSIONIN, EXTENSIONINX
    Regards,
    Swarna Munukoti

  • Problem with update of BLOB field in a table with compound primary key

    Hi,
    I've been developing an application in Application Express 3.1.2.00.02 that includes processing of BLOB data in one of the tables (ZPRAVA). Unfortunately, I've come across a strange behaviour when I tried to update value in a BLOB field for an existing record via a DML form process. Insert of a new record including the BLOB value is OK (the binary file uploads upon submiting the form without any problems). I haven't changed the DML process in any way. The form update process used to work perfectly before I'd included the BLOB field. Since than, I keep on getting this error when trying to update the BLOB field:
    ORA-20505: Error in DML: p_rowid=3, p_alt_rowid=ID, p_rowid2=CZ000001, p_alt_rowid2=PR_ID. ORA-01008: not all variables bound
    Unable to process row of table ZPRAVA.
    OK
    Some time ago, I've already created another application where I used similar form that operated on a BLOB field without problems. The only, but maybe very important, difference between both the cases is that the first sucessfull one is based on a table with a standard one-column primary key whereas the second (problematic one) uses a table with compound (composite) two-column PK (two varchar2 fields: ID, PR_ID).
    In both cases, I've followed this tutorial: [http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm]).
    Can anybody confirm my suspicion that Automatic Row Processing (DML) can be used for updating BLOB fields within tables with only single-column primary keys?
    Thanks in advance.
    Zdenek

    Is there a chance that the bug will be included in the next patch?No, this fix will be in the next full version, 3.2.
    Scott

  • Updation of Primary Key field in HR Tables (PA2001 and PA2002) - Urgent

    Can anyone please tell me how to update a primary key field in HR Tables (PA2001 and PA2002).
    I need to update sprps field in both the tables. I used HR_Infotype_Operation function module, but still it is not updating the field.
    Pls find the following code snippet for the table PA2001 and let me know if any discrepancies :
    TABLES: pa2001.
    DATA: it_pa2001 TYPE TABLE OF pa2001,
    wa_pa2001 LIKE LINE OF it_pa2001,
    DATA: date TYPE d.
    date = sy-datum - 100.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date and sy-datum.
    WRITE:/.
    WRITE:/ 'PA 2001 Records'.
    if sy-subrc <> 0.
    WRITE:/ 'No Data Exists'.
    else.
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.
    endif.
    LOOP AT it_pa2001 INTO wa_pa2001.
    wa_pa2001-sprps = 'X'.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    infty = '2001'
    number = wa_pa2001-pernr
    SUBTYPE =
    OBJECTID =
    LOCKINDICATOR =
    VALIDITYEND =
    VALIDITYBEGIN =
    RECORDNUMBER =
    record = wa_pa2001
    operation = 'MOD'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    NOCOMMIT =
    VIEW_IDENTIFIER =
    SECONDARY_RECORD =
    IMPORTING
    RETURN =
    KEY =
    ENDLOOP.
    if sy-subrc = 0.
    write:/ 'SY-subrc is zero'.
    write:/ ' Rows modified = ', sy-dbcnt.
    else.
    write:/ 'No Record(s) updated'.
    endif.
    commit work.
    WRITE: / 'Updated Records in the Internal Table IT_PA2001'.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date AND sy-datum..
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.

    Thanks Kiran.
    But I need to change this field as we need to lock the records, as soon as the employee fills his/her time sheets which will be sent for HR Payroll, later on.
    When I am updating directly the field the database table PA2001, its not updating but for table PA2002, only few records are being updated.
    Is there any other alternative for this problem?
    Pls reply.
    Thanks,
    Harish

  • Find the key for join between table "crhd" and "equi" for use field "answt"

    I make program for read data from table "crhd" for print  about machine report
    but I can not find the key for link join to table "equi" for print field "answt" (acquistion value)
    please help me  find the key field for join between table "crhd" and "equi" for use field "answt"
    thank you very much...

    This is how the Work Center is linked to a particular Equipment -
    Functional - In IE03 ( view Equipments) You see the Work Center of a particular Equipment.
    Technical - Go to view V_EQUI ( view of EQUI and EQUZ). Pass the Equipment number alongwith V_EQUI-PM_OBJTY = 'A' ( i,.e searching for the Object Type Work Center).  In this way u ll get the V_EQUI-GEWRK - this is the Work Center ID.
    You can pass this Work Center ID to CRHD. And you will get the Work Center text.
    CRHD-OBJTY = 'A'
    CRHD-OBJID = V_EQUI-GEWRK.
    and u ll get the CRHD-ARBPL - this is the Work Center.
    So u need to come backwards, alongwith ur CRHD-OBJTY and CRHD-OBJID , you pass the same to V_EQUI and u get the list of equipment numbers alongwith ur ANSWT(Acquisition value).
    I guess it solves ur problem.

  • How can i update the REMARK field in ADRT database table

    Hi all,
    How can i update the REMARK field in ADRT database table
    By using Function modules or BAPI’s
    Please reply me fast

    Hi,
    you can try this code:
        SELECT SINGLE * FROM KNA1 WHERE KUNNR = wa_kunnr.
        IF sy-subrc = 0.
          CLEAR adrct.
          SELECT SINGLE * FROM adrct WHERE addrnumber = kna1-adrnr.
          IF sy-subrc = 0.
            adrct-remark = wa_remark.
            MODIFY adrct.
          ENDIF.
        ENDIF
    best regards,
    Thangesh

  • How to update a custom field of MARC table using BAPI_MATERIAL_SAVEREPLICA

    Hi,
    I want to update a custom field (Appended field) of MARC table using  BAPI_MATERIAL_SAVEREPLICA. Please help me in this issue. I cannot use BAPI_MATERIAL_SAVEDATA as this updated the MARC table record by record. I have to update bulk records at a time.
    Thanks
    Rahul.

    Hi,
    Use the Documentation given for struture in BAPI docuemntation...
    For loading data into custom fields of MARC use the structure - BAPI_TE_MARC.
    First, structures BAPI_TE_<NAME> (<NAME> = MARA, MARC, MARD, MBEW, MLGN, MLGT, MVKE, MARM, MAKT) and the appropriate check structures BAPI_TE_<NAME> (<NAME> = MARAX, for example) have to be extended by the customer to include the required fields. The structures that are delivered as standard only contain the relevant key fields. When new fields are added to this structure, you should ensure that a field has the same name as the field in the database table. Furthermore, the fields in the structures BAPI_TE_<NAME> can only be CHARACTER fields. Data element BAPIUPDATE is to be used for the fields in the check structure (exception to this: key fields.)
    Parameters EXTENSIONIN and EXTENSIONINX are used for transferring data to the method. Field STRUCTURE contains the name of the structure (for example, BAPI_TE_MARA or BAPI_TE_MARAX). This names is used to identify the work area (for example,  WA_BAPI_TE_MARA or WA_BAPI_TE_MARAX) to which the data is transferred. The remaining fields in parameters EXTENSIONIN or EXTENSIONINX contain data for the key fields (for example, the material number) and the data for customer-specific fields. The number of characters reserved in both parameters for the contents of the customer-specific fields must match the number of characters for the relevant field in the work area. If the number of required characters is less, the remaining characters are left blank. Only when all characters have been filled can the contact for an additional field be transferred. Bear in mind that only data for which an appropriate indicator has been set in the work area can be updated to the database.
    Regards,
    Bhargava

  • Key fields and non-key field of condition table

    Hello Gurus,
          what is key fields and non-key field of condition table?
    thanks very much!

    Key field
    Each condition table contains keys that can be used for creating dependent condition records.
    for example let take condition type PR00.
    PR00 uses access sequence PR02 .
    Access sequence PR02 has following tables associated with it namely 304, 305 & 306
    When you create a conditon record for PR00 with transaction VK11 or VK31, you have a button 'key combination' which is nothing but fields associated with tables 304, 305 & 306.
    In brief, Condition records are always created using specific keys. Condition tables are used to define the structure of the keys of a condition record.
    Non key field
    For example take condition table 144 - sales deal basic data.
    Table 144 is associated with access sequence PBUD.
    If you check the fields associated with this table (click technical view button), there are three fields at bottom which do not have 'key' check mark -KDATU, PLTYP, KSTAF
    So, when you create a condition record for PBUD, system does not propose these 3 fields in 'key combination' and hence are non key fields.
    Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme.

  • Updation of Custom Fields in AFRU table Using Customerexit

    Hi all,
    I added two fields in CO11n Tcode using SCREEN EXIT - CONFPP07 and iam trying to update these two fields in AFRU table
    using CONFPP05.  But iam unable to update these two field .
    see this code in CONFPP05
      LOOP AT afrud_tab.
        afrud_tab-zzshift = wa_afrud-zzshift1 .
        afrud_tab-zzoperator = wa_afrud-zzoperator1 .
        MODIFY afrud_tab.
      ENDLOOP.
    Plz help me regarding this..

    Thanks for reply
    Ya i added two fields in confpp07 .
    see the code :
    *&  Include           ZXCOFTOP
    tables : afrud.
    DATA : WA_AFRUD TYPE AFRUD,
            IT_AFRUD TYPE TABLE OF AFRUD.
    Include           ZXCOFU24
    MOVE afrud-zzshift1 TO wa_afrud-zzshift1.
    MOVE afrud-zzoperator1 TO wa_afrud-zzoperator1.
    Even though it is not updating . except these two fields.
    Regards,
    Srinivas

  • About key fields in a table

    Hi,
    I'm actually finding out differences between two tables in remote systems. table name would be given as input parameter, and i'll query the remote SAP system and get the table entries in the remote system and compare them with the table entries in the logon system. Now is there any way, that I can find out which fields are the key fields of table, at run time, having in mind that since everything is at run time, i would be processing using field symbols. So is there anyway to find out which fields in any table are the key fields. Any inputs would be of great help.
    Regards,
    Vijay

    HI vijay
    use the FM
    CALL FUNCTION 'GET_KEY_FIELDS_OF_TABLE'
      EXPORTING
        TABNAME             =<b> <table name></b>
      MANDT_NEEDED        = ' '
      TABLES
        KEY_FIELDTAB        = <b><table to hold the key field ex. data: itab like dfies occurs 0. ></b>
    EXCEPTIONS
      NOT_SUPPORTED       = 1
      OTHERS              = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    <b>Loop at itab.
    write: itab-fieldname.
    endloop.</b>
    regards
    kishore
    Message was edited by: Harikishore Sreenivasulu

  • Logic to populate the key field of a DSO

    Hi SDN community,
    I have a very unique requirement and need ur help on this.
    I have a created a generic Datasource with two fields <b>Material Number</b> and <b>Minimum Quantity</b>. This is loaded into MINDSO01.
    The MINDSO01 in BW side will have two Key Fields:<b>Material Number and Load Date</b>. (Load Date is not a filed coming from the Datasource it is nothing but the date when the load is happened.)
    The reason to have Load Date as the key is, each time the DSO is loaded the records have to be unique.
    <b>Now my question is how do I populate the Load Date filed of the DSO which is the KEY field for the DSO???
    If I load on 9/25/2007 then the load date should be 9/25/2007.</b>
    <b>MAT01    9/25/2007</b>  5
    <b>MAT02    9/25/2007 </b> 8
    <b>MAT03    9/25/2007</b>  13
    bolded fileds are the keys of the DSO.
    Any suggestion are really appreciated and will award points for sure.
    Please do help me out with this issue.<b></b>

    Hi Snigdha,
    You can write a routine for the infoObject Load date is equal to sy-datum. So that it will take the value of the date as the day when the date is loaded and populates.
    If you are using 3.x, then write start / End routines in update rules or else if you using BI7, write routines in Transformations.
    Let me know details.
    Reg
    Pra

  • Key field in a table

    HI,
    I Created a Z table with a key field of type STRING when I activate the table its showing error that the field of type String not permitted can anybody help whether i should not use string for key field.
    thanks in advance,

    Hi,
    Use the data type CHAR for the Key field.
    Character string. Fields of type CHAR can have a maximum length of 255 in tables. If you want to use longer character fields in tables, you must choose data type LCHR. There are no restrictions on the length of such fields in structures.
    Regards,
    Arun

  • Implications of adding new key fields to existing table

    Hi All,
    I have searched forum regarding this. But didn't find exact answer.
    We are planning to add new key fields to existing Ztable. I want to know the implications of this.
    I have checked the where used list of table and found no impact. Only one point is making me to think again and again.
    If we add key fields to existing table then we have to adjust the table from SE14 to activate it. But this adjustment doesn't ask for TR.
    So if i release my TR, entries in other systems will also be adjusted accordingly??? Business is OK with the new fields values to be blank for existing entries.
    Thanks,
    Vinod.

    Yes the data in transported  systems will also be adjusted. If this table contains too much data make transport at late hours because it will take long and table can't be used while it's adjusted. In this adjustment process data is copied to a temporary table and moved back to original table using move-corresponding command after key added. There will data loss if you remove a key or key fields field length but in your case it shouldn't be a problem.
    Edited by: Gungor Ozcelebi on Jul 2, 2009 9:18 AM

  • How to update the Customer field value of PO Item under the Delivery Address Tab?

    Hi Friends,
         i tried to update the Customer field Using Bapi_PO_change.I passed the PO Order no,POADDRDELIVERY data with Item no,Adrees no,Customer no.But i am getting no data changed message from return table.I attached the screen shots.So please suggest me the helpful information for resoving this issue.
    Thanks,
    Dinesh

    Thank you friends,
                My Problem was resolved.In my case i have passed the customer value in BAPI_PO_CHANGE POITEM Table with updated customer value.
    Thanks,
    Dinesh

Maybe you are looking for

  • How to Check System Preference Settings with Time Machine

    I just found and fixed a problem caused by a bad System Preference/Universal Access setting and would like to go back in my Time Machine backup to see where the error was made. I may have been too quick to blame the 10.5.3 update on the problem so wa

  • Photoshop CS6 Extended 3D Problem

    I have reloaded Photoshop 3D Extended 6 times having removed every trace of ADOBE out of my registry, in order to try and get the 3D section to load - to no avail. I have tried everything I can but nothing seems to work ( I am a beginner) for me. Det

  • Can't open itunes or quicktime

    About a month ago I tried to copy a dvd on my computer, turned out the dvd was in very bad shape and I couldn't do it. A few days later, I tried to open my iTunes and I got the message, "iTunes has encountered a problem and needs to close." I can't r

  • Real time integration of controlling with financial accounting

    Hi friends, Can any one please explain the concept and as well as provide the configuration guide. Thanks & Regards T N R

  • Where can i found JSTL good Tutorial

    Hai Friends, Colud please tell me in which site (please give me complete path) can i found good JSTL metirial.. please help me thank u