Copy a record

Hi,
How can I copy a record through APEX? Clearly I want it all to be the same except for the ID, which should be different and unique.

Hi,
You will need to have some PL/SQL that is triggered by a button, perhaps, on your page. This should be something like:
BEGIN
INSERT INTO MYTABLE (COLUMN1, COLUMN2, ...) VALUES (COLUMN1, COLUMN2, ...)
SELECT COLUMN1, COLUMN2, ...
FROM MYTABLE
WHERE PK = :P1_PK;
END;PK being the primary key that should be created by a sequence or other method - all other fields should be included where I have shown COLUMN1 etc
Andy

Similar Messages

  • While copying condition records in pricing from one customer to another

    While copying condition records from one customer to another for one material, need to give select rule, when I click that it supposed to come with values like "rule 1" but it does not have values. So I cannot copy data.
    Any experts solution?
    Fully rewarded.
    Thanks,
    Manohar

    Hi,
    for the condition copy, you must maintain the copy control for condition. the path:Sales and Distribution>Basic Functions>Pricing-->Copy Control For Conditions.
    this is the reqirement.
    I hope this useful for you.

  • Copy Condition record

    Hi,
    I am Having Condition record for Pricing (PR00) with Key combination as sales org/ Customer/ Material.
    Now I want to copy same Record for another customer with same materials
    How to do this?
    I tried In VK11 in with ref. to option in which i given previous records's ref. system is copying but in this i want to
    change customer code but that field is in Grey I m not able to change customer code for the same materials.
    regards,
    akshay

    Hi
    Just make previous record invalid
    Just go to VK12 and give the validity date of today.
    From                 01.12.2008
    Valid to             31.12.9999 (21.07.2009)
    So from today onwards this condition type will be invalid
    Just create the new condition record in VK11 for your different customer.
    Now just create new record sales org/ Customer/ Material
          1000 / 594944 /   M10
    New condition record valid.
    Regards
    Adi

  • Help in Query to copy same records

    Hi, I want to copy same records TEN times. How I can do from query.
    Select * from travel_info
    Code1  Code2 Code3  Code4  Code5  Code 6
    TR        Y         N         Y         N          TR
    /*Desired output - Record should be copied exactly same 10th times*/
    Code1  Code2 Code3  Code4  Code5  Code 6
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    TR        Y         N         Y         N          TR
    Thanks.

    >> Hi, I want to copy same records [sic] TEN times. How I can do from query. <<
    One the
    many ways a row is not like a record is that a row has to have a key. The
    goal of all databases is to remove redundancy. You want to create redundancy and destroy any possible key!  WHY? You also do not know that a query cannot create new rows; that would require an INSERT INTO statement. 
    What are you trying to do? 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to copy last record to a new record ?

    Hello,
    i have a question pls.
    i want to copy last record to every new record
    say,
    multirecord forms has : Tank_no Last_measured Lab_Denisty
    record1 : 1009aw 1532.94 .5796
    what i want to do next record is copying last record (record1 ) as
    record2 : 1009aw 1532.94 .5796
    so the user may change the Last_measured only and not to have to rewrite the Tank_no and the Lab_Denisty cause it doesn't change.
    May i do this ? if yessss, but How..?
    Regards,
    Abdetu..

    Hello poelger
    i check it then found the following code :
    DUPLICATE_RECORD Examples /*
    ** Built-in: DUPLICATE_RECORD;
    ** Example: Make a copy of the current record and increment
    ** the "line_sequence" item by one.
    DECLARE
    n NUMBER;
    BEGIN
    ** Remember the value of the 'line_sequence' from the
    ** current record
    n := :my_block.line_sequence;
    ** Create a new record, and copy all the values from the
    ** previous record into it.
    Create_Record;
    Duplicate_Record;
    ** Set the new record's 'line_sequence' to one more than
    ** the last record's.
    :my_block.line_sequence := n + 1;
    END; but then which trigger best fit the procedure should i use
    w-c-r or w-n-r-i Triggers
    and what is meant by line_sequence pls. ?
    Regards,
    Abdetu..

  • When we click on the copy botton record with same name should not be saved

    Hi,
    Copy button will copy the record with the same name and will save it.our requirement is when we click on the copy botton ,record with same name should not be saved
    we are performing this task in custom object 12 and exposed Opportunity Name in the layout.
    Records with same Opportunity Name should not save ..when we copy the record
    Can we perform any field validation on Opportunity Name field?
    Please help
    please email me @ [email protected]
    Thanks
    Srinivas Merugu

    Opportunities that are assoicated to the same account cannot have the same name. You cannot make this unique for your whole instance. The only way that you could do this would be to create a webservice application that checks this before you save the record.
    What about defaulting the name each time this could make the record unique?

  • Copy Engineering Record

    Hello Gurus,
    SAP allows Engineering Records to be copied only when the status is in the following and does not allow in other status
    Change Enquiry
    Change Request in Process
    Is there any specific reason for this functionality ( not allowing you to copy Engineering Record from other status)?
    Is there a config setting to override this?
    Kindly advice.
    Thanks & Regards
    Jo

    Hi Jo,
    it can not be changed with customizing as it is hard-coded in the Engineering Record:
    class/method: /PLMI/IF_EX_ECR_ENHANCEMENTS~CHECK_BEFORE_COPY
    * check if change record status
    * when status of template ECR is 10 or 20,only then it can be used as
    * template
       IF ls_header_std-status = '10'
       OR ls_header_std-status = '20'.
         ev_veto = abap_true.
       ELSE.
         ev_veto = abap_false.
    *   raise message "Change record of status "Approved" and above cannot be used
         MESSAGE e095(/plmi/ecr_bo) INTO gv_msg.
    I think the reason is not technical rather it is business related.
    You cannot save the change record as an engineering record template if any of the following statuses are set:
    Change Request Approved
    Change Order in Process
    Change Implementation
    Change Completed
    Closed
    Change Request Rejected
    You can change this behaviour with imnplementing the following BAdI:
    Product Lifecycle Management (PLM) - PLM Web User Interface - Objects in PLM Web UI - Engineering Record - BAdI: Change Items Settings
    See documentation:
    "Checks the engineering record templates for validity before copying"
    Best regards
    Tamas

  • How to copy a record into a new one

    I would like to copy a whole record into a new one. Duplicate_Record doesn't help, because I do not necessarily want to copy the last record, but any record.
    The user should be able to open a record and then call "copy" and the current record is beeing copied into a new one. The user can also choose "new record" and nothing will be copied into the new record.
    So, if I want to copy the record, it's always the last one that has been opened.
    Should I save the values from the last record in globals and pack them into the new record?

    Sorry, the data is very complex, so I can't give an example. But to say it in a simpler way: I would like to copy any record, opened by the user. But not the last record in the database -> therefore I can't use duplicate_record.
    Hope it is clearer this time?still you have not given the data and output which you want.
    But not the last record in the database
    what did you mean here...
    oracle doesnt have a track of the records which were inserted to the db.

  • How to copy a record with an Automatic Row Processing (DML) ?

    Hi,
    I want to duplicate (to copy) a record.
    I have a form, with an Automatic Row Processing (DML), looking for the PK stored into an item named P26_ID and populating the values into the corresponding items of the form.
    I have an Automatic Row Processing (DML) which permit to update, delete and modify the row.
    So far so good.
    I thought it would be good if I calculate a new value for the PK and stored it into the P26_ID.
    Then I thought the Automatic Row Processing (DML) would see that it is a new value for the PK and would "decide" insert a new record.
    But it does not work like that. I thought it was because the item P26_ID is database column type; so I switched to another item named P26_ID_NEW and put this new pk into this item. I then created another Automatic Row Processing (DML), triggered by this button, and which will look into this new item. It does not work either.
    Where do i go wrong ?
    Thank you for your kind help !
    Christian

    Christian:
    Assuming that the 'Duplicate' function is available only when the page is in 'Edit' mode, ie. a record has already been loaded into the form you can do the following to duplicate this record
    1) Define a button named 'Duplicate'
    2) Set the target of this button to be 'URL'
    3) Set the URL for this button to be
    javascript:duplicate();
    4) Add this bit of JS into the page HTML header<script>
    function duplicate() {
    $s('<name_of_PK_page_item>','');
    doSubmit('CREATE');
    </script>Varad

  • Copy a record with URL - Address Fields

    Hi All,
    Is it possible when using a weblink to copy a record to copy the address fields also? I'm copying a contact record and my URL is as follows:
    https://secure-ausomx###.crmondemand.com/OnDemand/user/DefContactInsert?
    OMTGT=ContactEditForm&OMTHD=ContactNewNav&OMRET0=ContactHomePage&OCTYPE=&ContactEditForm.Primary Account Name=%%%Primary_Account_Name%%%&ContactEditForm.Account Id=%%%Account_Id%%%&ContactEditForm.Parent Alternate Address.Personal Country=%%%Personal_COUNTRY_Country%%%
    This works and the contact country copies as expected. However when I try and add the other contact address fields which I believe are as follows it wont copy:
    ContactEditForm.Parent Alternate Address.Personal Street Address
    ContactEditForm.Parent Alternate Address.Personal Street Address 2
    ContactEditForm.Parent Alternate Address.Personal Street Address 3
    ContactEditForm.Parent Alternate Address.Personal City
    ContactEditForm.Parent Alternate Address.Personal County
    ContactEditForm.Parent Alternate Address.Personal State
    ContactEditForm.Parent Primary Address.Primary Province
    %%%Personal_ADDR_Address1%%%
    %%%Personal_ADDR2_Address2%%%
    %%%Personal_ADDR3_Address3%%%
    %%%Personal_CITY_City%%%
    %%%PERSONAL_LIST_COUNTY%%%
    %%%PERSONAL_LIST_USSTATE%%%
    %%%Personal_PROVINCE_Province%%%
    Any Ideas?
    Thanks

    Thanks Venky,
    We've been playing and this is possible, for example... In this scenario the user is on the Account Record and they wish to create a Contact for this account. The account and it's corresponding address details should be populated through into the new record, this will include the contact address and account address. You need to ensure the weblink is setup to open in the current window:
    javascript:openQuickCreatePopup('https://secure-ausomxdsa.crmondemand.com/OnDemand/user/ContactQuickCreate?OMTHD=New&OMTGT=PopupNewForm&OCTYPE=&ophpd=2&OMCR0=%%%Row_Id%%%&OMCBO=Account&OCPRF=AlternateCountry:%%%Ship_To_COUNTRY_Country%%%|AlternateAddress1:%%%Ship_To_ADDR_Address1%%%|AlternateAddress2:%%%Ship_To_ADDR2_Address2%%%|AlternateAddress3:%%%Ship_To_ADDR3_Address3%%%|AlternateCity:%%%Ship_To_CITY_City%%%|AlternateZipCode:%%%SHIP_LIST_ZIP%%%|AlternateCounty:%%%SHIP_LIST_COUNTY%%%|AlternateStateProvince:%%%SHIP_LIST_USSTATE%%%|AlternateProvince:%%%Ship_To_PROVINCE_Province%%%',0,0)
    The field names "AlternateCountry" etc come from the WSDL, the destination field names come from the HTML page source. Give it a try.. I will get around to documenting this as I have seen many different techniques and documents based on copying records, this seems to be the better of them all though.
    Oli @ Innoveer

  • How to Copy LSO records of an employee to another employee

    Hi LSO Experts,
    I have a requirement to copy existing employee's LSO records andassign the same to another employee. This scenario comes in when same guy is rehired with a Wrong iring action (having a new Pernr). Thus we need to allocate all his previous training details to this new pernr.
    I think FM LSO_GET_BOOK_PARTICIPANT will provide all training records details of a guy. However, what should be the appoach to copy these records to a brand new Pernr ?
    While digging up deep, I found, linking with LSO records with PERNR lies in the table HRP1001 and hrpad614. However linking field between these two tables are auto generated by SAP.
    I want to transfer all existing records of one employee to another employee. Please let me know the right aproach.

    Hi LSO Experts,
    I have a requirement to copy existing employee's LSO records andassign the same to another employee. This scenario comes in when same guy is rehired with a Wrong iring action (having a new Pernr). Thus we need to allocate all his previous training details to this new pernr.
    I think FM LSO_GET_BOOK_PARTICIPANT will provide all training records details of a guy. However, what should be the appoach to copy these records to a brand new Pernr ?
    While digging up deep, I found, linking with LSO records with PERNR lies in the table HRP1001 and hrpad614. However linking field between these two tables are auto generated by SAP.
    I want to transfer all existing records of one employee to another employee. Please let me know the right aproach.

  • Copy result recording

    Dear gurus,
    when ever i  am doing copy result recording ( Eg 04 to 89 ), Long text from 04 is not copied to 89 lot
    i dont know why it is happening pls guide me ( qualitative ).
    Regards,
    s.sakthivel
    Edited by: sakthivel subramanian on Feb 16, 2009 8:01 AM

    Hi,
    Refer below Article by Mr. Shyamal Joshi on Copy Inspection Lot.
    - [Article|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60221c69-0f8b-2b10-eebf-bec51a601dd6]
    Also refer below threads on the same topic.
    - [Copy Inspection Lot 1|Copying inspection results from one lot to another]
    - [Copy Inspection Lot 2|Re: PROCEDURE FOR COPY INSPECTION RESULTS FROM ONE LOT TO ANOTHER]
    - [Copy Inspection Lot 3|copy inspection result]
    Regards,
    Dhaval

  • Copy all records in a tabular block into another block..

    hi guys,
    i am in a situation and have to solve it as early as possible.
    I have created 2 tabular blocks on my form. Lets say i have created emp block with table emp and emp1 block with the same table emp. I have 2 blocks with same fields. I have execute query in block 1 that is emp and now i want to copy all records of emp block in emp1 block.
    i have to do this thru code.
    pliz help how to copy records in another block with same fields.
    its urgent.
    regards, Imran Baig

    Try with the following code.
    If it works let me know.
    Regards,
    shalauddin.
    from Bangladesh.
    begin
    GO_BLOCK('B2');
    first_record;
    LOOP
    GO_BLOCK('B1');
    LAST_RECORD;
    IF :SYSTEM.LAST_RECORD='TRUE' THEN
    NEXT_RECORD;
    :B1.ID:=:B2.ID;
    NEXT_RECORD;
    GO_BLOCK('B2');
    ELSE
    :B1.ID:=:B2.ID;
    NEXT_RECORD;
    GO_BLOCK('B2');
    END IF;
    IF (:SYSTEM.last_record='TRUE') THEN
    EXIT;
    ELSE
    NEXT_RECORD;
    END IF;
    END LOOP;
    GO_BLOCK('B1');
    END;

  • Copying condition records in SD

    Hi,
    We are in SAP 4.7. In condition type VA00, I have about 100 condition records in sales orgn 0001 for material 0001. I would like to copy all these 100 condition records within the same condition type VA00, but into a different sales orgn 0002 for the same material 0001.
    Can anyone guide me in this process.
    Thanks and regards.

    Hi,
    I just joined this group, and wanted to know how I can ask a question.
    I couldn't find a place where i could post a new question.
    Thanks.
    Imran..

  • [Cisco FAQ] - How can I copy my recorded programs from my DVR to my PC?

    Can I move copies from my DVR hard drive to my PC?

    The ability to record or copy programming is categorized under specific copy protection specifications regulated by the FCC and set by the content providers.
    In general, over-the-air or local broadcast programs should be set to copy freely, and allow you to make another copy for your pc or mobile device. Other subscription-based programming and premium channels may allow copying to your DVR, but might not be available to make extra copies. Additionally, PPV movies and events may be DVR recordable, but have a timeframe to view before it expires.
    The copy protection on channels usually varies from provider to provider.

Maybe you are looking for

  • Reader and Windows 8.1 FULL SCREEN?

    Is there a way to view a document in Reader and Windows 8.1 other than on FULL SCREEN.  In previous versions, I could look at a.pdf file while working on another file on my computer screen.  This allowed me to get info from the .pdf file and input in

  • PDF Form Takes More Time To Open  when using designer 7.1.3129.1.296948 + Reader 8 above

    Hi All, When i am developing the adobe interactive form Using designer 7.1.3129.1.296948,After that I converted to PDF. When I am opening the PDF form its takes more time(Using reader version 8.1.2). How to resolve This problem ? Regards, Boopathi M

  • Web Service Security not configured on this component.

    Hi Experts,                        Before configuring the scenario, i went to RWB to check whether the comopnents are in active mode or not.                               Integration Engine XID                                Business Process Engine X

  • App photos problem

    Hi it's normal when using app photos and edit directly from the app  with other apps the final result is an image with low resolution? I Use iPhone 5s with iOS 8.02

  • I just downloaded the latest OS upgrade and since I can not connect to the internet using my cellular data plan.

    I just downloaded the latest iOS.7 upgrade on my ipad2, and since I can not connect to the internet using my cellular data plan.  I have checked my data plan and it's both current and over 2GB remaining.  However the indicator shows no service, thus