Delete restrict for ABAP Dictionary database table

Hi,
I defined two database tables in ABAP dictionary, one with master data, and one with records referencing the master data.
I also defined a foreign key relationship in the second table, so that new entries in the second table are checked against the master data table.
In addition to this behaviour, I also want the Dicitionary to perform a check the other way round. In other words, if I try to delete a record in the master data table, this should not be possible if there are records in the second table referencing this record. Thats how foreign key relationships work in Oracle databases.
Is there a way to force this behaviour for ABAP Dictionary tables, too? Or is it possible to make the table maintenance view perform this check?
Thanks for your help!
Kind regards,
Tobias

Hello Tobias,
I can delete records in the master table which have dependent entries in the second table without an error or a warning.
How are you deleting the entries, via SM30?
If yes, you can use the [Event 03: Before Deleting the Display Data|http://help.sap.com/saphelp_nw04s/helpdata/en/91/ca9f14a9d111d1a5690000e82deaaa/content.htm]. In this TMG event you can check if the entry can be deleted at all!
If you're using Open SQL statements to delete the records, i don't think DB layer implicitly checks the dependency. You can always put an explicit check though
Btw, out-of-curiosity, is this a custom or standard table?
BR,
Suhas

Similar Messages

  • I want to delete the transactional record from database table

    Hai,
    I want to delete the transactional data from database table with out using the dialog programming is it there any trancation for this.
    for master data we have the transaction code for delete the records. The t.code is 'OBR2'.
    Plz help in that cse.
    Thanks and regards,
    P.Naganjana Reddy

    Hai,
    Plz help me urgent.
    I am asking i want to delete transactional data from database table without using the dialog programming.
    Thanks and Regards,
    P.Naganjana

  • Java dictionary database table in web dynpro application

    Hi,
    I want to access java dictionary database table in my web dynpro application in java.
    Right now I have created one java dictionary DC.
    and in that Dc i have created two database table .
    Now I want to use this table in my web dynpro application.
    Can anyone help me.

    You can use the Dictionary Projects to create tables in Database. You must use codes to access these database tables that is created using Dictionary projects.
    You have to use the DataSource in order to get connection ; Use Visual Administrator to see the data source name.
    You can use the following code to access the database table.
    ResultSet result = null;
    try
         InitialContext initialcontext = new InitialContext();
         DataSource datasource = (DataSource)initialcontext.lookup("jdbc/<DataSourceName>");
            Connection connection = datasource.getConnection();
         Statement statement = connection.createStatement();
         result = statement.executeQuery( <Query>);
         connection.close();
    } catch (NamingException e) {
         // TODO Auto-generated catch block          
              e.printStackTrace();
    } catch (SQLException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
    Regards
       Vinod

  • Delete all content in a database table

    i want to initialize a database table just before my specific program terminate.
    can i use the
    delete databasetable
    Edited by: Matt on Nov 7, 2008 8:04 AM

    Hi,
    If you want to delete all the contents of database table, use the following code:
    data itab type standard table of dbtab.
    select * from dbtab into table itab.
    delete dbtab from table itab.
    Hope this will help.
    Regards,
    Nitin.

  • Sample report for filling the database table with test data .

    Hi ,
    Can anyone provide me sample report for filling the database table with test data ?
    Thanks ,
    Abhi.

    hi
    the code
    data : itab type table of Z6731_DEPTDETAIL,
           wa type Z6731_DEPTDETAIL.
    wa-DEPT_ID = 'z897hkjh'.
    wa-DESCRIPTION = 'computer'.
    append wa to itab.
    wa-DEPT_ID = 'z897hkjhd'.
    wa-DESCRIPTION = 'computer'.
    append wa to itab.
    loop at itab into wa.
    insert z6731_DEPTDETAIL from wa.
    endloop.
    rewards if helpful

  • Optimize delete in a very big database table

    Hi,
    For delete entries in database table i use instruction:
    Delete from <table> where <zone> = 'X'.
    The delete take seven hours (the table is very big and  <zone> isn't an index)
    How can i optimize for reduce the delete time.
    Thanks in advance for your response.
    Regards.

    what is the size of the table and how many lines are you going to delete?
    I would recommend you to delete only up to 5000 or 10000 records in one step.
    do 100 times.
    select *
              from
              into table itab.
              where
              up to 10.000 records.
    if ( itab is initial )
      exit.
    endif.
    delete ... from table itab.
    commit work.
    If this is still too slow, than you should create a secondary index with zone.
    You can drop the index after the deletion is finished.
    Siegfried

  • BW - Unknown objects in ABAP Dictionary - DB Tables

    Hello gurus,
    As a result of the consistency check in DB02 transaction, our BW System is showing a high number of "DB Tables" and "DB Tables withouth unique index" as unknown objects in the ABAP dictionary.
    Is there any way to solve these consistency issues detected in DB02?
    Thanks
    Regards

    Hi Dibya,
    I checked the SAP note 33814 and it tooke me to the SAP note 449891 - Temporary database objects in BW 3.X
    According to the recommendations, I executed the report SAP_UPDATE_DBDIFF, and I got as result 579 secondary indexes missing in the DB from the and still the 5 DB Tables unknown in the ABAP dictionary and 2 DB Tables withouth unique index,
    I executed the report SAP_INFOCUBE_INDEXES_REPAIR in order to try to repair the secondary missing indexes that were shwon but withouth getting any results.
    Do you have any recommendation to solve this situation?  In the original scenario the DB02 transaction wasn't reporting any missing index.
    Thanks and regards,

  • Can I restore the deleted statistical data from the database tables?

    Hi all,
       I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete.
    Is there any way to restore the deleted data back? Thanks in advance.

    Now I'm really confused-
    Your first post said
    "<b>I have deleted the statistical data from the database tables like(Ex: RSDDSTAT, RSDDSTATWHM</b>,..) by mistake through RSA1> Tools> BW Statistics for Infoproviders--> Delete."
    but your last respsonse said
    "I have deleted the BW Statistics data, <b>not the actual data in RSDDSTAT tables</b> through
    RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' bin to delete data."
    If you used the RSA1 -> Tools -> BW Statistics for InfoProviders -> clicked 'Delete' - <b>then you deleted the data from the RSDDSTAT tables</b>. This assumes you accepted the default date range that would have popped up after the clicking on the Delete button which specified to delete thru the current date.  If this is what you did, the data is gone.  Your only hope is be to recover from a DB backup.  
    The data in the RSDDSTAT tables is what is used to feed the BW Statistics cubes, generally on a daily basis.

  • Deletion of data within the database tables

    The user is trying to clean up the 2014 data within the database tables. He is running a delete function which keeps causing the log files
    to exceed their limit. The tables are large and he is unable to delete the data in one command due to available size and logging. What is the best way to approach this?
    Thanks,

    Hi venkatesh1985,
    According to your description, the user fails to delete data in tables due to the limited space of log file. Based on my research, this issue could occur when you use the delete statement(DELETE FROM ExampleTable) in a single transaction and consume all
    available space on your transaction log disk.
    To avoid this issue, you could use the two methods below to delete the data.
    1. Use a loop combined with TOP and delete rows in smaller transactions as the following example. This method requires you to delete all the tables one by one.
    SELECT 1
    WHILE @@ROWCOUNT > 0
    BEGIN
    DELETE TOP (1000)
    FROM LargeTable
    END
    For more information about the process, please refer to the article:
    http://dbadiaries.com/how-to-delete-millions-of-rows-using-t-sql-with-reduced-impact
    2. If you want to delete all the data from all tables in the specific database, you could script the entire database and all database objects. Then drop the database and recreate it using the script as the steps below.
    a. In Object Explorer, expand the node for the instance containing the database to be scripted.
    b. Point to Tasks, and then click Generate Scripts and click Next.
    c. Select the option of 'Script the entire database and all database objects'.
    d. Specify how scripts should be saved. You could save the script to a file or new query window. Click Next, then click ok.
    e. Drop the database, and run the script in the query window to recreate it. For more information, please refer to the article:
    http://msdn.microsoft.com/en-us/library/bb895179.aspx#Introduction
    In addition, if possible, please increase the size of the log file or move the log file to a different disk with more disk space.
    Regards,
    Michelle Li

  • How to delete the complete contents of database table ? should be empty !!

    Hi Guys,
    I have requirement where i have delete the contents of database table..i have make it empty (no records at all) and then i have to fill it with the records from the excel sheet.
    I can upload data from the excel sheet.
    Please tell me how to delete the complete contents of the database table ??
    Regards
    Rahul

    hi ,
    just write like this,
    delete from <database table>.
    commit work.
    sample code, here edpar is database table.
    delete from edpar." FROM TABLE g_tab_delete.
      call function 'DB_COMMIT'.
      loop at g_tab_edpar into g_wa_edpar.
        insert into edpar values g_wa_edpar.
        if sy-subrc  eq 0.
          move-corresponding g_wa_edpar to g_wa_edpar1.
          append g_wa_edpar1 to g_tab_edpar1.
        else.
          move-corresponding g_wa_edpar to g_wa_edpar2.
          append g_wa_edpar2 to g_tab_edpar2.
        endif.
      endloop.
    that's all it works.
    reward points if helpful.
    regards,
    seshu.

  • Import Data from Office Control (Web Dynpro for ABAP) into internal-Table

    Hello,
    I have a question concerning the Office Control UI-Eelement in Web Dynpro for ABAP:
    How can I import spreadsheet data from the Office Control into  a internal-table?
    I have an Excel-sheet (without any data) which is shown initially in the Office Control. First the empty Excel-Sheet will be loaded and in the second step data from an alvxml-transformation will be loaded into the Excel-sheet with the method 'activatexmlsource'. This works so far. When I change the loaded data in the Office Control and save it it will be stored as XLS-File. The problem is that I'm not able to use existing Upload-FM because every function module I tried uses GUI-functions and WebDynpro has no GUI-functionality. I always get the error that data from clipboard cannot be imported.
    So now the question is:
    How can I import changed data from the Office control into a internal-table staying in Web Dynpro application?
    Please give some advice, if you have some useful code or ideas.
    Thanks
    ram
    Edited by: Ramakullay Challa on Sep 24, 2009 9:05 AM
    Edited by: Ramakullay Challa on Sep 24, 2009 9:07 AM

    Hi,
    Once you save to desktop again you have made some changes to that file, this file you want to upload it right.
    Then in that case you need to use the FILEUPLOAD UI element right.
    Regards,
    Lekha.

  • Build gui for existing oracle database tables with webdynpro java?

    hi
    i want to build a GUI to maintain existing oracle tables
    so far we used oracleFORMS to do so
    is there a good approach for webdynpro java? or do you recommend other sap tools?
    can we generate the gui with a wizard based on the fields in the table?
    do we have to generate sql statements or type in manually?
    regards
    joerg

    Hi Joerg,
    generally that is possible, but you'll have to implement the data access by yourself, by means of EJB or another Java persistance framework such as JDO, SQLMaps, Hibernate, whatever...
    Web Dynpro allows to build a GUI based upon a model - in this case this could be some POJOs (DTOs) representing your database tables, which are communicated to the GUI by your data access layer. Consider a model as a simple Java bean representing database data.
    This approach would require to build a data access layer which incorporates manually generated sql statements, so you'll have to have expert database and java knowledge.
    There might be other approaches, this is just to demonstrate one working possibility.
    regards,
    Christian

  • Import Data from Office Control (Web Dynpro for ABAP) into SAP-Table

    Hello,
    I have a question concerning the Office Control UI-Eelement in Web Dynpro for ABAP:
    How can I import spreadsheet data from the Office Control in a SAP-table?
    I have an Excel-sheet (without any data) which is shown initially in the Office Control. First the empty Excel-Sheet will be loaded and in the second step data from an alvxml-transformation will be loaded into the Excel-sheet with the method 'activatexmlsource'. This works so far. When I change the loaded data in the Office Control and save it it will be stored as XLS-File. The problem is that I'm not able to use existing Upload-FM because every function module I tried uses GUI-functions and WebDynpro has no GUI-functionality. I always get the error that data from clipboard cannot be imported.
    So now the question is:
    How can I import changed data from the Office control into a SAP-table staying in Web Dynpro application?
    Please give some advice, if you have some useful code or ideas.
    Thanks in advance,
    Philipp
    Edited by: Philipp Hiebler on Feb 11, 2008 10:15 AM

    Hi,
    Once you save to desktop again you have made some changes to that file, this file you want to upload it right.
    Then in that case you need to use the FILEUPLOAD UI element right.
    Regards,
    Lekha.

  • Deleteing the contents from the database table

    The aim of this code is to delete the whole contents from these 12 tables.  Is there any way to write the code more efficiently.
    TABLES: ZFFMCTL_AP, ZFFMHDR_AP, ZFFM_CHANGE_LOG, ZFFMDTL_AR, ZFFMHDR_AR,        ZFFMDTL_JV, ZFFMHDR_JV, ZFFMDTL_SKF,ZFFMHDR_SKF,ZFINVOICE_DETAIL,       ZFFMMASTER, ZFFMLOGREAD_CLUS, ZFFMCTL.
    DELETE ZFFMCTL_AP.
    IF SY-SUBRC = 0.
       DELETE ZFFMMHDR_AP.
       IF SY-SUBRC = 0.
          DELETE ZFFM_CHANGE_LOG.
          IF SY-SUBRC = 0.
             DELETE ZFFMDTL_AR.
             IF SY-SUBRC = 0.
                DELETE ZFFMHDR_AR.
                IF SY-SUBRC = 0.
                   DELETE ZFFMDTL_JV.
                   IF SY-SUBRC = 0.
                      DELETE ZFFMHDR_JV.
                      IF SY-SUBRC = 0.
                         DELETE ZFFMDTL_SKF.
                         IF SY-SUBRC = 0.
                            DELETE ZFFMHDR_SKF.
                            IF SY-SUBRC = 0.
                               DELETE ZFINVOICE_DETAIL.
                               IF SY-SUBRC = 0.
                                  DELETE ZFFMMASTER.
                                  IF SY-SUBRC = 0.
                                     DELETE ZFFMLOGREAD_CLUS.
                                     IF SY-SUBRC = 0.
                                        DELETE ZFFMCTL.
                                     ENDIF.
                                   ENDIF.
                                 ENDIF.
                              ENDIF.
                           ENDIF.
                        ENDIF.
                    ENDIF.
                 ENDIF.
               ENDIF.
            ENDIF.
         ENDIF.
    ENDIF.
    This is very urgent,
    Thanks in advance
    John

    Hi ,
    One more thing , Deleting conents of all table in single Loop may cause program .
    This depends on How much data you have in you Table . IF the data is Huge you can split the tables to be deleted . Check for Entry Exists in Table , if not go for Deletion  in the same pre-requisite order.
    Regards,
    sudhi

  • How to cancel the alter or delete purview for one's scheme table?

    I want to put down the user of some scheme table that is altered or deleted the field of its. But the scheme has the RESOURCE and CONNECT role for the user. I want to control the user can't delete or alter the table field.
    How can to do ? urgent!!
    Please tell me?
    regard.

    I'm not sure I understand your question correctly. Are you looking to audit the DDL a particular user issues or are you looking to prevent that user from issuing certain types of DDL?
    Justin

Maybe you are looking for