How to delete the master records when corresponding details records exist.

What is the SQL statement to delete the records of master when the corresponding detail records are present.
Note: No Cascade clause was used at the time of creation of referential integrity constraint.
"M"- Master Table
"D"- Detail Table
I used, "Delete from M cascade". This statement is not working.
Your favour in this will be deeply appreciated.
Cheers
PremChin

Hi folk,
i appreciate your suggestion,
my crux of the situation is to know whether there is a way to make it without disabling,removing or modifying the referential integrity constraint.
If so, modifying, please help me out how to modify the constraint in order to remove the master records keeping detail records in-tact.
Cheers
Premz

Similar Messages

  • How to Delete the condition record in CRM

    HI,
    Can you please help me how to delete the condition record from condition table in CRM.
    Please explain the usage of FM CRMXIF_CONDITION_SEL_DELETE with examples.
    I have also read the documention of the function module. How to use this FM for custom defined condition table.
    (this is the code given in Documentation)
    DATA-OBJECT_REPRESENTATION         = 'E'
    DATA-SEL_OPT-CT_APPLICATION              = 'CRM'
    DATA-SEL_OPT-OBJECT_TASK                    = 'D'
    DATA-SEL_OPT-RANGE-FIELDNAME        = 'PRODUCT_ID'
    DATA-SEL_OPT-RANGE-R_SIGN                  = 'I'    (Including)
    DATA-SEL_OPT-RANGE-R_OPTION           = 'EQ'
    DATA-SEL_OPT-RANGE-R_VALUE_LOW  = 'PROD_1'
    Thanks
    Shankar

    Hi Shankar,
    I am using the same CRMXIF_CONDITION_SEL_DELETE function module to delete condition record present in CRM.
    But it is giving me below error in the return table of the FM after i run the program. Can you please correct me if I am doing any thing wrong?
    Error in  lt_return: SMW3     CND_MAST_SEL_DEL_EXT_VALIDATE     CND_M_SD
    code:
    ls_range-fieldname = 'PRODUCT_ID''.
    ls_range-R_SIGN = 'I'.
    ls_range-R_OPTION = 'EQ'.
    ls_range-R_VALUE_LOW = '123456'.
    APPEND ls_range TO lt_range.
    MOVE lt_range TO ls_entry-SEL_OPT-range.
    ls_data-SEL_OPT-object_task = 'D'.
    ls_data-SEL_OPT-ct_application = 'CRM'.
    ls_data-object_representation = 'E'.
    CALL FUNCTION 'CRMXIF_CONDITION_SEL_DELETE'
      EXPORTING
        DATA          = ls_date
    IMPORTING
       RETURN        = lt_return
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      IMPORTING
        return = lt_ret.
    Edited by: Saravanaprasad Nadar on Jul 7, 2010 1:27 AM

  • How to delete the temporary files when we log out from ESS

    Hello expert,
    In my company we are running ESS using ITS server, do you know how to delete the temporary files when we log out from ESS?
    Thanks.

    The temporary files used by ESS. For example paystub pdf file.

  • How to delete a master record with transaction data?

    Hi,
        Iam able to delete master record(GL/Vendor/Customer)through OBR2 when there is no transaction data in those respective master records. Despite of clearing all open items in a particular vendor Account, Iam unable to delete that master record. Please suggest me how we can delete vendor master data having transactional data.
                               Thanks in Advance
    Regards,
    Satish

    Hi...
    Not sure whether this helps....you can mark the vendorrecord for deletion and later try to delete it.
    Logistics >> Materials management >> Purchasing >>
    (new menu) Master data >> Vendor >> Central >> Flag for deletion
    try using XK06/FK06
    Assign points if useful
    Regards
    Aravind

  • DELETING THE MASTER RECORDS

    Hi gurus,
    i want to upload the new master records into my system regarding the MM. first thing i want to delete the old records in the system and freshly want to load into the system. please give me the soluion how to do it.
    it is a development server..
    thanks in advance..
    ravi

    i want to upload the new master records into my system regarding the MM. first thing i want to delete the old records in the system and freshly want to load into the system. please give me the soluion how to do it.
    >
    > it is a development server..
    When uploading the new master records, just assign the previous numbers used by the old master records and the new upload will overwrite those old records. In this case deleting/overwriting the old records.
    If you dont assign the new upload any numbers, it will append below the exisiting records, that way not deleting the old records.

  • How to delete the material records related to storage type

    Dear SAP guru's,
    I got a situation that if the material "XXXXXX" exists in two different storage type (let say 001 & 002 ) and the material needs to be removed out of one (Let say 002) to avoid the picking and putaway in future.
    Inorder to accomplish an above requirement we tried the below cases
    Case 1: By flagged the material "XXXXXX" under storage type 002 in MM06 transaction.But it didn't restrict the system on allocating and removing the stock from /to to the storage type 002.
    Case 2:After we flagged the material for deletion under storage type 002 ,we used to MM71 transaction to archive & delete the material record that assocaited with the storage type 002 completely.
    I am kind of queiries to know if there is any other method or procedure available to delete the storage type associated material records in SAP.
    Please guide me with the other options.Thanks.
    Regards,
    John.

    Hi John,
    Its very simple, remove the Storage type indicators from the material master - Warehouse View 1 at Stock placement & Stock removal section, with this it won't pickup or place the materials in the concerned storage type.
    If you have extended this materials to more than 1 storage type, you need to do the same for all the storage types.
    Reward if it is helpful.

  • How to delete the single record from the  ODS

    HI,
       I want to DELETE  the particular record from ODS.. how to delete that..
    plz give me the solution.. it's urgent..
    with regards
    @jay

    Hi Prakash,
        You can delete a particular record from ODS by specifying the key field name in Selective deletion button available in Contents tab in the manage screen of ODS. But it will only delete the record from the active data table and not from the Change log and new data table . You should be very carefull if you are doing in Production system as there is chance of deleting other records accidentally.
    Go to Selective deletion button - > Click on delete selection -> Enter the key field values of the record you want to delete-> Press save button to save as Variant -> Go back and click on selection button -> Chosse the background job type -> Click on start button.
    Regards,
    Prakash

  • How to rectify "No master record exist for the vendor TEST"  in ME41

    I created an Vendor TEST in XD01
    while creating a RFQ number in ME41 . It showing "No master record exist for the vendor TEST".
    Why is this error occurs, what is the mistake how to rectify it

    Hello,
    Create the vendor with all details ie) Accounts, Purchase Org. Etc..
    If useful reward points.
    Vasanth

  • How to delete the matching records from two internal tables

    Hi ,
    I have two internal tables say A and B of the same type. If A has 10 records and B has 4 records , I want to delete the 4 records in B from A .
    loop at B into wa .
    delete A where key = wa - key .
    endloop.
    takes a long time if the table B is huge. how can I improve the performance.
    Thanks.
    Gayathri

    Hi Gayathri,
    You could try field-symbols. It reduces the data transfer from the internal table B to the work area.
    field-symbols <fs_itab_b> like line of B.
    loop at B assigning <fs_itab_b>.
      delete A where key = <fs_itab_b>?-key.
    endloop.
    Regards,
    <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=zwcc%2fwm4ups%3d">anand Mandalika</a>.

  • How to delete the duplicated records, not just surpress the records?

    I am new to CR. Right now I am doing a project which needs CR get query from Oracle. I got the query from Oracle. There are records with duplicated fields. For example (the following only show part of fields):
    ID    body_code  
    1            10            
    2             10            
    3             15            
    4              15           
    5              15           
    6              16           
    I need to only select records (not surpress, because I will do some caluculate later) like following:
    ID         body_code        
    1             10         
    2              15
    3               16   
    I tried to creat selection fomula in fomula workshop, shown as follows:
    onlastrecord;
    <>next
    but CR said next can be evaluated. I think it must have something to do with the print-time. So what show I do to delete the duplicated records.Thank you very much.

    Ting,
    Try this:
    Insert a group on body_code.  Then create a running total called Distinct Count.  Field to summarize -> ID, Evaluate on change of group Group # 1 Body Code, and Never Reset.
    Then insert a chart in the report header:
    In the advanced layout, select body_code on change of and select Distinct Count running total in the Show values.
    I hope I understood what you're looking to accomplish.
    Z

  • How to delete the duplicate records in a table without promary key

    I have a table that contains around 1 million records and there is no promary key or auto number coulums. I need to delete the duplicate records from this table. what is the simple effective way to do this.

    Please see this link:
    Remove duplicate records ...
    sqldevelop.wordpress.com

  • How to delete the Initialization records in  2LIS_03_BX

    BW3.5 - R/3 4.6c - LO-Cockpit - SCM Implementation - Inventory Management 0IC_C04 InfoCube.
    I wanted to use 2LIS_03_BX and RSA3 was showing zero records. I ran MCNB to collect records for this extract and it collected 815000 stock records. When I checked the extractor, I realized that the zero quantity records were not exactly what I was expecting for. I was looking for zero quantity records for valid/active bins. But it seems that we are receiving 100's of zero quantity record for every material that we don't really care for anylonger. I definitely want to see the zero quantities in case the bin is active but we've just run out of material.
    I turned off the zero quantity collection in MCNB but at the end of run, it only over writen the 815000 records rather than deleting them all and collecting about 70,000 entries as expected.
    My question is how can we delete the results of a previous initialization of open stock transfer structure (trans# MCNB)so I can run it again?
    I'll appreciate any hints or comments.
    Thanks a lot.
    Bilal

    Hi,
    I assume using OLIX, we will be able to delete the data from either 2LIS_03_BX or 2LIS_03_BF. As opposed to using LBWG, where if we select '03' the data is cleared off from the set up tables of both datasources.
    If that is true, could you please mention the 'Info structure' to be used in OLIX for 2LIS_03_BX and 2LIS_03_BF?
    Thanks a lot.
    Regards,
    Sri.

  • How to delete the double records connected to one or more than one tables in SQL 2008?

    Hi
    Can anyone please help me with the SQL query. I Im having a table called People with columns names: personno., lastname, firstname and so on. The personno. is having duplicate records,so all the duplicate records i have written with "double" in
    the beginning of the numbers. I tried deleting these double records but they are linked to one or more than one tables. I have to find out, all the tables blocking the deleting of double person. And then create select statements which creates update statements
    in order to replace the current id of double person with substitute id. (The personno. is in the form of id's in the database)
    Thanks

    You should not append "double" in the personno. When we append it will not be able to join or relate to other table. Keep the id as it is and use another field(STATUS) to mark as duplicate. Also we will require another field(PRIMARYID) against
    those duplicate rows i.e the main or the primary personno.
    SELECT * FROM OtherTable a INNER JOIN
    (SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
    ON a.personno = b.personno
    UPDATE OtherTable SET personno = b.primaryid
    FROM OtherTable a INNER JOIN
    (SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
    ON a.personno = b.personno
    NOTE: Please take backup before applying the query. This is not tested.
    Regards, RSingh

  • How to delete the master data of a Customer created in a SALES AREA?

    Hi All,
    I've deleted a Customer (master data) by t.code OBR2. But it exists again in its SALES AREA.
    Could anyone tell me how to delete it in the sales area too?
    Thanks

    Hi,
    I dont think you can delete a customer. you can market it for deletion in XD06.
    for deleting customer master data you have to setup an archiving project.
    Also check the similar thread
    doubt in obr2
    Hope it helps you.
    Regards,
    Sats.

  • How to delete the all records in Ztable from report program

    Hi Guys,
    Good Day!
    How to delete all records in Ztable from report program(Means I want to clean Ztable records from report program) .  Please send me the code.
    Thanks & Regards,
    Reddy

    Use this.
    DELETE { {FROM target [WHERE sql_cond]}
           | {target FROM source} }.
    *But before deleting the rows please check if this Ztable is being used in any other programs or used by others.
    Check "where-used-list"
    in se11 give the table name
    utilities- where-used list.
    I hope this helps.
    thanks.

Maybe you are looking for