Pre Database Insert / Update Validation

Hi,
I have a maintenance view that allow user to insert / update.
Let's say, z_my_table is my table
key1
key2
field1
field2
field3
I want to validate whether field1, field2, field3 whether exist in my table before insert / update.
However, due to some restriction, I cannot make it as part of the key.
My question is, how can I capture OR validate it before the data get inserted into the table ?
I checked some online help, and found that suggestion is to write a function module OR enhancement point.
Just wonder what is the common practice and how should I do it ? Thanks.

I don't agree with the design but if you want to do it anyway it can be done using Events in the Maintenance View.
After you've generated the Maintenance View of your Z table, within SE11 pull out menubar Utilities->Table Maintenance Generator, then menubar Environment->Modifcation->Events. Create New Entries and I think for your requirement you would need 2 entries - one at event 05 and another at event 18. Input the name of your routine and write the code by clicking its corresponding button.
The following is an example of a scenario where text of an object is retrieved and filled into the view display-only column according to user input of its related object id - for your requirement you would validate the user input after checking the input values in your existing table:
form fill_text_05.
  data begin of w_total.
          include structure zfv_fbt_acct_rel.
  data: action,
        mark,
  end of w_total.
  data: w_extract type zfv_fbt_acct_rel.
  clear: zfv_fbt_acct_rel-fbt_rel_acc_txt,
         zfv_fbt_acct_rel-fbt_cost_grp_txt.
* populate GL a/c text
  select txt50 up to 1 rows
         from skat
         into zfv_fbt_acct_rel-fbt_rel_acc_txt
         where spras = sy-langu
         and   saknr = zfv_fbt_acct_rel-fbt_rel_acc.
  endselect.
* populate Cost Group text
  select single fbt_cost_grp_txt
         from  zft_fbt_cost_grp
         into  zfv_fbt_acct_rel-fbt_cost_grp_txt
         where company_code = zfv_fbt_acct_rel-company_code
         and   fbt_cost_grp = zfv_fbt_acct_rel-fbt_cost_grp.
  if sy-subrc <> 0.
    message e074(zf_enhancements) with zfv_fbt_acct_rel-company_code.
  endif.
endform.                    "fill_text_05
Hope this helps.
Cheers,
Sougata.

Similar Messages

  • Insert, update and delete trigger over multiple Database Links

    Hello guys,
    first of all I'll explain my environment.
    I've got a Master DB and n Slave Databases. Insert, update and delete is only possible on the master DB (in my opinion this was the best way to avoid Data-inconsistencies due to locking problems) and should be passed to slave databases with a trigger. All Slave Databases are attached with DBLinks. And, additional to this things, I'd like to create a job that merges the Master DB into all Slave DB's every x minutes to restore consistency if any Error (eg Network crash) occurs.
    What I want to do now, is to iterate over all DB-Links in my trigger, and issue the insert/update/delete for all attached databases.
    This is possible with the command "execute immediate", but requires me to create textual strings with textually coded field values for the above mentioned commands.
    What I would like to know now, is, if there are any better ways to provide these functions. Important to me is, that all DB-Links are read dynamically from a table and that I don't have to do unnecessary string generations, and maybe affect the performance.
    I'm thankful for every Idea.
    Thank you in advance,
    best regards
    Christoph

    Well, I've been using mysql for a long time, yes, but I thought that this approach would be the best for my requirements.
    Materialized View's don't work for me, because I need real-time updates of the Slaves.
    So, sorry for asking that general, but what would be the best technology for the following problem:
    I've got n globally spread Systems. Each of it can update records in the Database. The easies way would be to provide one central DB, but that doesn't work for me, because when the WAN Connection fails, the System isn't available any longer. So I need to provide core information locally at every System (connected via LAN).
    Very important to me is, that Data remain consistent. That means, that it must not be that 2 systems update the same record on 2 different databases at the same time.
    I hope you understand what I'd need.
    Thank you very much for all your replies.
    best regards
    Christoph
    PS: I forgot to mention that the Databases won't be very large, just about 20k records, and about 10 queriees per second during peak times and there's just the need to sync 1 Table.
    Edited by: 907142 on 10.01.2012 23:14

  • How to use the mirrored and log shipped secondary database for update or insert operations

    Hi,
    I am doing a DR Test where I need to test the mirrored and log shipped secondary database but without stopping the mirroring or log shipping procedures. Is there a way to get the data out of mirrored and log shipped database to another database for update
    or insert operations?
    Database snapshot can be used only for mirrored database but updates cannot be done. Also the secondary database of log shipping cannot used for database snapshot. Any ideas of how this can be implemented?
    Thanks,
    Preetha

    Hmm in this case I think you need Merge Replication otherwise it breaks down the purpose of DR...again in that case.. 
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Insert , Update & Delete Not working in BDB Berkley Database

    Hi,
    Anybody has used Oracle ADF & BDB ,to insert/ update & delete?
    imported db.jar,dbexample.jar,sqlite.jar ,derby.jar. still not working (Only Query working)
    Pls lets us know

    Hi,
    Do you have a small test case program that demonstrates this? A JDeveloper project showing what exactly is the problem when trying to use the BDB SQL JDBC driver to insert data into the BDB SQL database? What do you mean by "not working", do you get any errors, you do not get errors but you do not see the data in the database etc?
    What are the versions of Java, JDeveloper, ADF and BDB SQL you are using, and on what OS?
    Regards,
    Andrei

  • Inserts/Updates on replicated tables Logical Standby Database ??

    Hello all,
    We have a Logical standby database on 10.2.0.5. Can you please suggest if there is a way we can do data inserts/updates on replicated tables ?
    Can this be done by doing a alter database guard none; or alter session disable|enable guard; ?? Even if it completes succesfully , will this have any effect on replication later ?

    Hello all,
    We have a Logical standby database on 10.2.0.5. Can you please suggest if there is a way we can do data inserts/updates on replicated tables ?
    Can this be done by doing a alter database guard none; or alter session disable|enable guard; ?? Even if it completes succesfully , will this have any effect on replication later ?

  • OWB : INSERT/UPDATE IS GIVING  VLD-2752 WARNING WHEN VALIDATING MAPING

    I desing maping for dept,emp tables in OWB,
    I AM USING INSERT/UPDATE TABLE OPERATOR PROPERTIES FOR TARGET TABLE,
    WHEN I TRY TO VALIDATE IT I AM GETING THIS WARNING
    VLD-2752: Attributes of update matching criteria are not mapped in dept_emp_merge
    can any body explain me about this problem and how to solve it?
    Thanks & Regards,
    k azamtulla khan

    Hi azamtulla khan,
    It seems your mapping is fine. i thought problems is contsratints. 
    can you check in your target table having primaykeys are not.
    if target table has primay key set the target properties insert/update.
    if target does not have any keys try to add key's.
    regards
    venkat
    [pre]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Access is not inserting, updating or deleting records in my database table on the server

    I am having a problem with an application I developed using Dreamweaver 8 and Access 2000 several years ago which is no longer working correctly. The problem is that Access is not inserting, updating or deleting records in my database table on the server but is reflected in changes to my Web site. I used the Dreamweaver server behaviors: insert record, update record and delete record to make the changes to my Access table on the server. My Access table on the server shows all of the records I inserted or updated in the past, but not any of the newly inserted on updated records.
    does any one have any ideas as to what my problem is?
    Jim

    No, that has nothing to do with your problem. Let's make sure I understand the symptoms.
    1) Your site is online at a remote host.
    2) You use a dynamic page in your online site to update a database record (insert, delete, or update)
    3) The update then appears correctly on your dynamic content page.
    4) You download the mdb and it appears to not have any of the upates you just made.
    Please correct any of these statements if they are wrong.
    If the above is correct, then you must be looking at a cached mdb, or the mdb you are looking at is in the wrong location. Do this: search your entire drive for copies of the mdb, including in the Windows temp directories which is likely where the cached copy is located. Delete any extra copies and download again.

  • Get the list of table's last Inserted/Updated date from a database

    Hi All,
    Good afternoon!
    Please help me to find the last inserted/updated date from different tables in a database.
    Consider I have a database called testDB, which contains 20 tables. Most of these tables will get data inserted/updated daily. But sometimes it may not happen due to some issues . We will not be knowing about this issue until we check  in each table
    manually. Now, somebody should be daily checking for the issues in this db. So, we have decided to make an alert mail to send this informations to us.
    We need to check whether any of the table's in TetsDB has got inserted/updated data in one day difference.
    I have tried this..
    SELECT OBJECT_NAME(OBJECT_ID) AS Object_, last_user_update,*
    FROM sys.dm_db_index_usage_stats
    WHERE database_id = DB_ID( 'TestDB')
    Thanks,
    Julie

    The solution depends on the version and edition of your SQL Server.
    If you use SQL Server 2000 or SQL Server 2005, please visit these links: 
    How do I audit changes to SQL Server data?
    Table Auditing with SQL Server 2000
    If your SQL Server 2008 or above (only on the Enterprise edition), please have a look at this link:
    Change Data Capture
    If your SQL Server 2008 or above (all editions),
    you can use Change Tracking, but Change tracking captures the fact that rows in a table were changed, but does not capture the data that was changed.
    more info: 
    Comparing Change Data Capture and Change Tracking
    Saeid Hasani [sqldevelop]
    HI,
    I've read about change tracking change data capturing now. 
    We need to track the data daily and we need to know whether any modification happens in those tables.
    Will it make any performance issue if I enable change data capturing on multiple tables.. lets say 20+ tables.?

  • Hello, i tried to update my iPhone 3GS and it work and my phone switched back on but it says insert a valid SIM with no PIN lock, what do i do?

    hello, i tried to update my iPhone 3GS and it work and my phone switched back on but it says insert a valid SIM with no PIN lock, what do i do?

    http://support.apple.com/kb/ts3694#error29
    Error 20, 21, 23, 26, 28, 29, 34, 36, 37, 40
    These errors typically occur when security software interferes with the restore and update process. Use the steps to troubleshoot security software issues to resolve this issue. In rare cases, these errors may be a hardware issue. If the errors persist on another computer, the device may need service.
    Also, check your hosts file to verify that it's not blocking iTunes from communicating with the update server. See the steps under the heading "Blocked by configuration (Mac OS X / Windows) > Rebuild network information > Mac OS X > The hosts file may also be blocking the iTunes Store." If you have software used to perform unauthorized modifications to the iOS device, uninstall this software prior to editing the hosts file to prevent that software from automatically modifying the hosts file again on restart.

  • Insert/Update/Delete in forms6i using Objects table in Oracle9i server

    I am using Oracle 9i server and dev 6i (forms6i).
    i have a form based on Object tables (including REF's items). when i try to insert update, delete the reocrd in the form, it gives error.
    Insert/Update/Delete failed because of OCI_22132: hexadecimal string does not corresopond to a valid REF.
    when i remove REFs items from form (not from database) then it does all functions (insert,update,delete,query).
    Actually i haved used this form with Oracle 8i and it did all functions(insert,update,delete,query). i am using the same tables and types definations in Oracle 9i but it is not working.
    Note: Insert, Update, Delete, or Query is not being done through forms when using REFs items. Others tools like sql*plus are performing the same actions very well.
    Please help.
    I will be thankful to you.
    M. Faisal.

    user563114,
    As James (padders) told you in his reply to a similar question that you posted (Typed tables is treated in the same way as a relational table?) in the Typed tables is treated in the same way as a relational table? forum, the only way you can tell for sure is to try it out both ways, measure and compare the times.
    Of-course, there are many factors that effect the time, apart from whether you use a nested table or a regular table.
    Good Luck,
    Avi.

  • Server stored procedure to convert date format before insert/ update

    The source which has date in dd-MMM-yy format, have to convert it to
    yyyy-mm-dd hh:mm:ss:SS and insert/update into the database using stored procedure.
    ALTER PROCEDURE [dbo].[uspEmployeeData]
    @emp_id char(35),
    @emp_title varchar(64),
    @start_date datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    IF EXISTS (SELECT 1 FROM [dbo].[employee] WHERE emp_id= @emp_id)
    BEGIN
    UPDATE [dbo].[employee]
    SET emp_title = @emp_tit,
    start_date = @start_date
    WHERE emp_id = @emp_id
    END
    ELSE
    BEGIN
    INSERT INTO [dbo].[employee](emp_id, emp_title, start_date)
    VALUES ( @emp_id, @emp_title, @start_date);
    END
    "The input data for the field/parameter "e_date" is invalid according to the expected SqlDbType DateTime. ---> System.FormatException: The string '04-DEC-65' is not a valid AllXsd value.". Where and
    how to convert the date format

    Format() - new to SQL SERVER 2012 or later - allows you to format an input value to a character string based on a .NET format string, with an optional culture parameter:
    ALTER PROCEDURE [dbo].[uspEmployeeData]
    @emp_id char(35),
    @emp_title varchar(64),
    @start_date datetime
    AS
    BEGIN
    SET NOCOUNT ON;
    IF EXISTS (SELECT 1 FROM [dbo].[employee] WHERE emp_id= @emp_id)
    BEGIN
    UPDATE [dbo].[employee]
    SET emp_title = @emp_tit,
    start_date = Format(@start_date,'yyyy-mm-dd')
    WHERE emp_id = @emp_id
    END
    ELSE
    BEGIN
    INSERT INTO [dbo].[employee](emp_id, emp_title, start_date)
    VALUES ( @emp_id, @emp_title, Format(@start_date,'yyyy-mm-dd'));
    END
    Example:
    SELECT FORMAT(getdate(),'d','en-us') AS us
    SELECT FORMAT(getdate(),'d','de-DE') AS de
    SELECT FORMAT(getdate(),'d','pt-BR') AS br
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.
    Ricardo Lacerda

  • Can not insert/update data from table which is created from view

    Hi all
    I'm using Oracle database 11g
    I've created table from view as the following command:
    Create table table_new as select * from View_Old
    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)
    Anybody tell me, what's happend? cause?
    Thankyou
    thiensu
    Edited by: user8248216 on May 5, 2011 8:54 PM
    Edited by: user8248216 on May 5, 2011 8:55 PM

    I can insert/update data into table_new by command line.
    But I can not Insert/update data of table_new by SI Oject Browser tool or Oracle SQL Developer tool .(read only)so what is wrong with the GUI tools & why posting to DATABASE forum when that works OK?

  • Insert / update data to a table through DBLINK (oracle)

    I try to insert / update a table from one instance of oracle database to another one through oracle dblink, get following error:
    java.sql.SQLException: ORA-01008: not all variables bound
    ORA-02063: preceding line from MYLINK
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:289)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:582)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1986)
    at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:1144)
    at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2152)
    at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2035)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2876)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:609)
    The same code to insert / update the exact same table in local instance works fine.No any binding problem. So i am pretty sure all ? mark in SQL are set with some value before sending to Oracle.
    Someone please advise what is possible problem. Db link is not set correctly? or we can not update remote table by dblink.
    By the way i can do insert / update from TOAD to the remote table through DBLINK. Problem happens only in Java code.
    thanks!
    Gary

    dblink links from one database instance to another.
    So it is certainly a source of possible problems when it works on one database and not another.
    You should start by looking at the dblink and it possible testing it in the database not via java.
    Note as well that that error suggests that it is coming from the Oracle database. I believe if you had a bind parameter problem in your java code that the error would come from the driver. But that is a guess on my part.

  • Insert/update japanese langunage data in a column of datatype varchar2(..)

    Hello,
    I am using ORACLE DATABASE 11g (EE) and RHEL 5.
    I want to insert/update japanese language data in a column which has the datatype as varchar2(256).
    I tried to change the NLS_LANGUAGE and NLS_TERRITORY parameters with 'ALTER SESSION set ...' command but no effect.
    I tried to bounce back ( shutdown and startup ) the DB but still no effect.
    I tried to inset the NLS_LANGUAGE and NLS_TERRITORY in init.ora file but still no use.
    If anybody knows the detail steps which i have mentioned above .... let me know. Might be that i am wrong in my method.
    Can you please guide me how to change the language of DB for a perticular session to japanese ???
    Thanks in advance...
    Edited by: VJ4 on May 9, 2011 6:21 PM

    VJ4 wrote:
    Thanks for the info.
    Yes i tried with UNISTR function and was able to insert the data successfully.
    but the point is that we can't remember unicode for each of the letter. It's their any method that we can directly insert japanese character using an insert.
    As you said :-
    Note that changing database character set is something complicated that requires many steps.
    Can you please provide me some links or some stuffs to study about the detail steps of chaining database character set.
    I have gone through the Oracle online documentation.. if you can pin point any good link in it you can else provide me some other stuff.
    Thanks .You will need to convert your database characterset to AL32UTF8. This is not a trivial exercise if your database already has data in it. See these MOS Docs
    Changing the NLS_CHARACTERSET to AL32UTF8 / UTF8 (Unicode)          (Doc ID 260192.1)
    AL32UTF8 / UTF8 (Unicode) Database Character Set Implications          (Doc ID 788156.1)
    http://download.oracle.com/docs/cd/E11882_01/server.112/e10729/ch11charsetmig.htm#g1011430
    HTH
    Srini

  • Inserting/updating data in control block based on view

    Hi!
    I`ve created a block based on a view to display data.
    I want this block to be insertable and updateable, that is I will use a on-insert/update trigger to call an insert/update procedure located in the database.
    When trying to change/insert a value in the block, the error message "Error: Can not insert into or update data in a view" pops up. I`ve tried to get rid of this error, without success.
    How can I make a data block based on a view insertable and updateable?
    My guess is that this have something to do with locking the records(there is no rowid in the view)... but I'm not sure.
    Pls advise!!

    Morten
    As well as on-update, on-insert, on-delete triggers you also need an on-lock,
    (even though it might just contain null;) otherwise the form will try to lock the view and fail.
    Actually your terminology is wrong, the block being based on a table or view is not a control block. A control block is not based on anything and has no default functionality for communicating with the database. If it was a control block, the on- triggers would not fire.

Maybe you are looking for

  • Unable to download 10.6.3 Itunes to my Power Mac G5 (running on OSX 10.5.8)

    I have an Iphone 4S which brought up a message to upgrade software to IOS 6.0.  I did this (stupidly!) - now can't access my ITunes and, worse still, can't upgrade ITunes to required 10.6.3 to run my IOS6.0 upgraded Iphone 4S!!!  I feel like bunging

  • Quark Files seen as unix executables after upgrade

    Upgraded to Tiger from 10.3.9 (Panther). We store all work files on another mac (as a server). During upgrade (using archive and install) ran out of disk space. Had to reboot in OS9. Moved the Previous system folder that had been created to another p

  • Assigning a song to multiple albums

    I've been collecting a nice library by now and I really like iTunes, but there is one thing not present (or I can't find it). The option to assign a song to multiple albums, I have a lot of physical CD's digitalized in iTunes and almost a quarter of

  • How to hide the main window menu ?

    Hi, Im developing a Java app that has an horizontal menu bar,which has the option to exit the program . So I want to hide, or get rid of the main window menu bar, the one that has the close, minimize and maximize buttons..is it possible ? Thanks in a

  • Disk Menus aren't working?

    Hey.  I'm using Premier Elements 8 and am trying to add a disk menu, but have been unsucessful. Click the magenta Disk Menus tab and see only a few options.  Click one of them and then apply This box pops up... Do I really have to sign up for somethi