Who updated the Row in Table
Hi Experts,
I wants to enable tracking for one of the table in my database.Tracking details must contains Time,new values ,old values and more importantly who/when made the changes.
Other than Triggers do we have any other way to track those changes.
Suggestions are highly appreciated.
Thanks,
Nandhu
Hi NandhuJana,
Please check my response above. I already gave the basic logic there. If you need the "who" then this is manually work, as CDC isn't designed for auditing but for data change tracking. Next step is to write the code for you, and for this
we need the DDL+DML and the CDC information (all element that it created for you),
but on the same time i recommended above
NOT to use CDC if you need the "who" information. The "when" is built-in in CDC and you can check the URL that I posted above for this.
I write again my recommendation here as I wrote above from what I assume is best for your case to lower:
1. create your own DML triggers on the tables (probably best solution in your case, if I understand it correctly)
2. Use Extended event or profiler (I don't like this solution for this case if this is permanent tracking)
3. Using OUTPUT in each query (need to change all query and not fit for most cases, but i some cases it is the best solution)
*** If you can post for us the table DDL for the table that you want to track, then we could help you with the
trigger. but first make sure that you understand the idea and you know what are
triggers :-)
Ronen Ariely
[Personal Site] [Blog] [Facebook]
Similar Messages
-
Who deleted the rows and tables
hi ,
Is it possible to find who deleted a bunch of rows or certain tables from HANA db .
Thank you
Jonu JoyHi Jonu,
You can set up an audit policy for it:
But be careful with ALTER TABLE policy as it will record all inserts, deletes and updates made to the table.
Regards,
Vivek -
How to update duplicate row from table
Hi,
how to update duplicate row from table?
First to find duplicate row then update duplicate row with no to that duplicate row in oracle.
can you give me suggestion on it?
Thanks in advance.
your early response is appreciated...In order to find a duplicate row, see:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1224636375004
(or search this forum, your question has been asked before)
In order to update it, just create and use an Oracle sequence, have it start and increment at a value that doesn't exist in your table.
If that doesn't get you going, post some CREATE TABLE + INSERT INTO statements, and the results you want from them, in other words: a complete testcase. -
Query to trace who updated the data
query to trace who updated the data
date
and time
and usernameahh, ok - there's a few articles around that will assist.
I suggest first
you experiment with triggers to familiarise yourself with them:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/triggers.htm#CNCPT118
this article here explains the process of putting in some audit processes using triggers:
http://www.oracle-base.com/articles/9i/CompleteDataAudit.php
it details creating the tables etc and then provides a procedure that will create the trigger text for you for each table you want to audit. it would be good to write your own trigger from scrath in order to learn and understand exactly what's happening, but it's up to you.
let us know if you encounter any problems and we can help your specific problem -
Updating certain rows of table by external file??
Hello gentlemen,
I need your help.I have a very large table.I need to update certain rows of table every day(around 200 per day)
I would like by using an external file (.csv or .txt) to update certain column on the 200 rows i have in the external file.
Can this be done?Do i need to write down a pl/sql procedure?Please help.I am a newbie to pl/sql but it will save me much time every day if i manage to do this.
Thank you in advance for your help.I made a first attempt to create the external table from a .txt file.
I used the below:
CREATE TABLE pol_test
(STATUS VARCHAR2(30 CHAR),
ASFAL VARCHAR2(20 CHAR)
ORGANIZATION EXTERNAL
(TYPE ORACLE_LOADER
DEFAULT DIRECTORY def_dir1
ACCESS PARAMETERS
(RECORDS DELIMITED BY STRING
FIELDS (STATUS VARCHAR2(30 CHAR),
ASFAL VARCHAR2(20 CHAR)
LOCATION ('C:\Users\t.christopoulos\Desktop\TEST.TXT')
I get the below error :
Error report:
SQL Error: ORA-06564: object DEF_DIR1 does not exist
06564. 00000 - "object %s does not exist"
*Cause: The named object could not be found. Either it does not exist
or you do not have permission to access it.
*Action: Create the object or get permission to access it.
I suppose that it goes to create the directory on the server where i dont have access.I run these commands from my desktop using SQL developer. -
How to delete the row in table control with respect to one field in module pool programming?
Hi,
Can I know the way to delete the row in table control with respect to one field in module pool programming
Regards
Darshan MSHI,
I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
I have written this code,
module USER_COMMAND_9000 input.
DATA OK_CODE TYPE SY-UCOMM.
OK_CODE = SY-UCOMM.
CASE OK_CODE.
WHEN 'DELETE'.
LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
APPEND LS_SOURCE TO LT_RESTORE.
DELETE TABLE LT_SOURCE FROM LS_SOURCE.
SOURCE-LINES = SOURCE-LINES - 1.
ENDLOOP.
But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
So I thought of doing with respect to the field. -
Function module updating the data base table
Hi,
This post is regarding the function module not updating the data base table.
I am calling the FM SD_SHIPMENT_HEADER_CHANGE inside the ZFM. It's returning success an changing the table c_xvttk_new with the new TDLNR value. But it's not updating the Shipment table VTTK-TDLBR or VT02N Forwarding agent.
When I directly updating Forwarding agent in VT02N it's updating fine.
Please let me know what the extra step need to be included to update or COMMIT the FM for updating
Forwarding Agent(VTTK-TDLNR).
Best Regards,
Maheshhi friend,
This link wont five u the complete help but if u ananyse it then it might provide u some idea......
BAPI change shipment doc
regards
kanishak -
Hi i need help on BAPI to Update the ADRT & ADR6 tables
hi,
i need help on BAPI to Update the ADRT & ADR6 tables
these are the fields to be updated
ADRT-Remark Table
ADR6-SMTP_ADDR
ADR6-DFT_RECEIV
Please guide me what parameters to be passed to update
ADR6 & ADRT tablesLook at this function Group
<b>BUBA_3 SAP BP: External BAPI Function Modules </b>
BAPI_BUPA_ADDRESS_ADD SAP BP, BAPI: Add Address
BAPI_BUPA_ADDRESS_CHANGE SAP BP, BAPI: Change Address
BAPI_BUPA_ADDRESS_GET_NUMBERS SAP BP, BAPI: Read Address Numbers
BAPI_BUPA_ADDRESS_GETDETAIL SAP BP, BAPI: Read Address
BAPI_BUPA_ADDRESS_REMOVE SAP BP, BAPI: Delete Address
BAPI_BUPA_ADDRESSES_GET SAP BP, BAPI: Determine All Addresses
BAPI_BUPR_CONTP_ADDR_ADD SAP BP, BAPI: Add Contact Person Relationship Address
BAPI_BUPR_CONTP_ADDR_CHANGE SAP BP, BAPI: Change Contact Person Relationship Address
BAPI_BUPR_CONTP_ADDR_GETDETAIL SAP BP, BAPI: Read Contact Person Relationship Addresses
BAPI_BUPR_CONTP_ADDR_REMOVE SAP BP, BAPI: Delete Contact Person Relationship Address
BAPI_BUPR_CONTP_ADDRESSES_GET SAP BP, BAPI: Read Contact Person Relationship Addresses
BAPI_BUPR_EMPLO_ADDR_ADD SAP BP, BAPI: Add Employee Relationship Address
BAPI_BUPR_EMPLO_ADDR_CHANGE SAP BP, BAPI: Change Employee Relationship Address
BAPI_BUPR_EMPLO_ADDR_GETDETAIL SAP BP, BAPI: Read Employee Relationship Address
BAPI_BUPR_EMPLO_ADDR_REMOVE SAP BP, BAPI: Delete Employee Relationship Address
BAPI_BUPR_EMPLO_ADDRESSES_GET SAP BP, BAPI: Read Contact Person Relationship Addresses
Look also at OSS <a href="https://service.sap.com/sap/support/notes/306275">Note 306275 - Transferring address data</a>
Regards -
How to select all the rows of table control in BDC
Hi All,
While I am doing BDC for Transaction Code MC88, After the first screen I will get another screen with tabble control, Here I need to select all the rows of table control, I am assignng the 'X' to the first field of Table Control which is the indicator for selection.
Here I am getting message called Indicator field is not in program and screen.
While doing Recording I am not able to record the indicator, Please any one let me know how to record the Entire table control selection.
Thanks in advance..Sorry about that lakshmi. Here is my code.
PERFORM dynpro USING : 'X' 'SAPMMCP6' '0105',
' ' 'RMCP2-MATNR' t_matnr,
' ' 'RMCP2-WERKS' t_werks,
' ' 'BDC_OKCODE' '=AKTV'.
PERFORM dynpro USING : 'X' 'SAPLMCPA' '0707',
' ' 'BDC_OKCODE' '=MRKE'.
PERFORM dynpro USING : 'X' 'SAPLMCPA' '0707',
' ' 'BDC_OKCODE' '=GRAO -
Update the stastics of tables BKPF and GLFUNCA
Hello All,
update the stastics of tables BKPF and GLFUNCA not updataing
I have execute via Brtools
7 - Database statistics >> 1 = Update database statistics >> 9 ~ Tables for update (table) ......... [BKPF]
same for table GLFUNCA
7 - Database statistics >> 1 = Update database statistics >> 9 ~ Tables for update (table) ......... [GLFUNCA]
But in .sta file it is not collected
<DB20>
Table GLFUNCA
Statistics are current (|Changes| < 50 %)
New Method E
New Sample Size P1
Old Method E Date 17.08.2008
Old Sample Size P1 Time 19:52:15
It is one year old , so please help me how to update this table
Is this table causing performance problem for job RSUVM007
Regards
Mohsin MBefore all,
Why do you wnat to calculate statistics on those tables?
Do you have performance problems and you have identified that they are caused by "bad" statistics?
or simply you "must" collect them because they are "OLD"?
If it is the latter, remember that statistics MUST be representative not current. Please read the SAP Note 825653 "Oracle: Common misconceptions" point 7
Regarding the options of BRtools, it works as designed.
BRCONNECT will check if the table needs statistics:
- if it has changed more than 50% since last time (in your case 17.08.2008) and, if so it will do, otherwise it will not do it. See the output of DB20 that you pasted:
> Statistics are current (|Changes| < 50 %)
IF you need new statistics (and I mean, need, not like) then you have to force them. On BRTOOLS you go to the next screen and choose the option:
> 7 ~ Force options (force) ............... []
In your version/patch could be located in a different place
and here input collect
I strongly recommend you to read the BR*tools documentation as ALL this information is there.
In case you do not know where to find it, it is quite easy:
SAP on Oracle => Oracle DBA Overview => SAP Database Guide: Oracle -
How to update the change log table?
Hi
I am doing some manipulation on the ODS records and writing few new records directly into the active table of my ODS. how do i update the change log table so that i can do a delta from my ODS to further data targets??
i see the fields REQUEST, DATAPAKID, PARTNO and RECORD in the change log table. what values should these fields have for my new records??
Regards
SujaiHi,
Please try this option. In stead of writing directly into DSO, do it in another Custom Z DSO. From there, do the FULL load to your previous DSO. This will ensure that the data consistence through the system. Also, do not forget to delete the data from Custom Z DSO once you successfully loaded the data.
Thanks,
Saru
Edited by: P. Saravana Kumar on Apr 1, 2009 6:23 PM -
New BIOS release - "Updated the ACPI SLIC table"
Hi.
Can anybody explain what "Updated the ACPI SLIC table" means in the new released BIOS update for Toshiba Qosmio x505? That explanation is really vague.This Microsoft article should give you an idea what it's about.
You receive an error message when you try to activate Windows Vista or Windows 7 on a computer that ...
Don't ask me for more..
-Jerry -
How to update all the rows of table using stored procedures
Hi,
I want to update all the rows of a table of a specific column
sp_a male
sp_b female
sp_c male
sp_d female
in above table
gender of all the columns has to be interchanged.Sir table is like this detail(name varchar(10),gender varchar(10))
Where Details are like this
Name Gender
sp_a
male
sp_b
female
sp_c
male
sp_d
female
I want to create a stored procedure which automtically updates gender from male to female and female to male
for all the rows . i.e., all the rows are updated for column gender by just running a stored procedure.
So after execution of stored proc the above table looks
Name Gender
sp_a
female
sp_b
male
sp_c
female
sp_d
male -
How to update the data base table with data
i have two ztables, one is zfm_kfz and other one is zfm_kmvrg
zfm_kfz is maintained by using table maintenance generator as well as alv grid control for list display.
zfm_kfz the field r like this KFZR, GERAET, KOSTENTRAEGER, BEZEICHNUNG, TUVDATUMMMYYYY, ASUDATUMMMYYYY, KMSTAND, HISTO AND REIFEN.
PROBLEM: all the data in grid control r updated except KMSTAND
fields in zfm_kmvrg are kostentraeger, kfznr and kmstand i m creating table control for this screen here what ever enter the last km stand is updated in the list.for one kfznr many kostentraegers and kmstand, the last km stand is updated here , go through this code plz hepl me
CONTROLS tabctrl TYPE TABLEVIEW USING SCREEN 100.
DATA: cols LIKE LINE OF tabctrl-cols,
lines TYPE i.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA: itab TYPE TABLE OF zfm_kmvrg,
fs_itab LIKE LINE OF itab,
fl_change TYPE c,
fl_error TYPE c.
*TABLES fs_itab.
LOOP AT tabctrl-cols INTO cols.
cols-screen-input = '0'.
MODIFY tabctrl-cols FROM cols INDEX sy-tabix.
ENDLOOP.
*SELECT * FROM spfli INTO TABLE itab.
CALL SCREEN 100.
MODULE status_0100 OUTPUT
MODULE status_0100 OUTPUT.
SET PF-STATUS 'SCREEN_101'.
DESCRIBE TABLE itab LINES lines.
tabctrl-lines = lines.
ENDMODULE. "status_0100 OUTPUT
MODULE cancel INPUT
MODULE cancel INPUT.
LEAVE PROGRAM.
ENDMODULE. "cancel INPUT
MODULE read_table_control INPUT
MODULE read_table_control INPUT.
MODIFY itab FROM fs_itab INDEX tabctrl-current_line.
ENDMODULE. "read_table_control INPUT
MODULE user_command_0100 INPUT
MODULE user_command_0100 INPUT.
DATA:
lw_index TYPE i.
save_ok = ok_code.
CLEAR ok_code.
CASE save_ok.
WHEN 'ADD'.
LOOP AT tabctrl-cols INTO cols.
cols-screen-input = '1'.
MODIFY tabctrl-cols FROM cols INDEX sy-tabix.
ENDLOOP.
CLEAR fs_itab.
APPEND fs_itab TO itab.
WHEN 'SAVE'.
IF NOT itab[] IS INITIAL.
LOOP AT itab[] into FS_ITAB.
lw_index = sy-tabix.
IF NOT fs_itab IS INITIAL.
MODIFY ZFM_KMVRG FROM fs_itab.
IF sy-subrc EQ 0.
UPDATE ZFM_KFZ set kmstand = fs_itab-kmstand
WHERE kfznr = fs_itab-kfznr.
ELSE.
fl_error = 'X'.
WRITE:/ 'The record number', lw_index,
'has not been updated'.
ENDIF.
ENDIF.
ENDLOOP.
ELSE.
MESSAGE s000(0) WITH 'No data is present to update'.
ENDIF.
ENDCASE.
IF fl_error = 'X'.
LEAVE TO LIST-PROCESSING.
ELSE.
MESSAGE s000(0) WITH
'All the records have been updated successfully'.
ENDIF.
ENDMODULE. "user_command_0100 INPUT
IN SE51
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
LOOP AT ITAB INTO fs_itab WITH CONTROL tabctrl.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE CANCEL AT EXIT-COMMAND.
LOOP AT ITAB.
module read_table_control.
ENDLOOP.
module user_command_0100.
i m trying many times i m not getting proper output, plz help me on thisHi,
I am hereby givng the similar sample code.Check this with your requirement.
In the flow logic of the screen 9000, write the following code.
PROCESS BEFORE OUTPUT.
MODULE set_status.
MODULE get_t_ctrl_lines.
LOOP AT i_makt WITH CONTROL t_ctrl CURSOR t_ctrl-current_line.
* Dynamic screen modifications
MODULE set_screen_fields.
ENDLOOP.
PROCESS AFTER INPUT.
LOOP AT i_makt.
FIELD i_makt-pick MODULE check.
FIELD i_makt-zmatnr MODULE zmatnr .
ENDLOOP.
MODULE user_command_9000.
In the program, write the following code.
PROGRAM SAPMZTC MESSAGE-ID zz.
* Tables Declaration
TABLES: zzz_makt.
* Internal table Declaration
DATA : i_makt TYPE STANDARD TABLE OF zzz_makt WITH HEADER LINE.
* Table control Declaration
CONTROLS: t_ctrl TYPE TABLEVIEW USING SCREEN '9000'.
* Variable Declaration
DATA : flg, "Flag to set the change mode
ln TYPE i. "No. of records
*& Module get_T_CTRL_lines OUTPUT
* Populating data
MODULE get_t_ctrl_lines OUTPUT.
SELECT zmatnr zmaktx
INTO CORRESPONDING FIELDS OF TABLE i_makt
FROM zzz_makt.
DESCRIBE TABLE i_makt LINES ln.
* To make the vertical scroll bar to come on runtime
t_ctrl-lines = ln + 100.
ENDMODULE. " get_T_CTRL_lines OUTPUT
*& Module USER_COMMAND_9000 INPUT
* Triggering event according to the user command
MODULE user_command_9000 INPUT.
DATA :lv_fcode LIKE sy-ucomm, "Function Code
lv_answer(1) type c. "Storing the answer
lv_fcode = sy-ucomm.
CASE lv_fcode.
WHEN 'CHANGE'.
* Setting the flag to make the table control in editable mode[excluding
* primary key].
flg = 'Y'.
WHEN 'DELETE'.
* Setting the flag to make the table control in editable mode after
* deleting the selected line
flg = 'Y'.
* Confirmation of delete
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Confirm'
text_question = 'Are you sure to delete from database?'
TEXT_BUTTON_1 = 'Yes'(001)
TEXT_BUTTON_2 = 'No'(002)
IMPORTING
ANSWER = lv_answer.
if lv_answer eq '1'.
* Updating the database table from the internal table
UPDATE zzz_makt FROM TABLE i_makt.
* Deleting the selected row from the internal table
DELETE i_makt WHERE pick = 'X'.
* Deleting the selected row from the database table
DELETE FROM zzz_makt WHERE pick = 'X'.
MESSAGE s005 WITH 'Deleted Successfully'.
ENDIF.
WHEN 'SAVE'.
* Inserting new record or updating existing record in database table
* from the internal table
MODIFY zzz_makt FROM TABLE i_makt.
MESSAGE s005 WITH 'Saved Successfully'.
WHEN 'BACK'.
SET SCREEN '0'.
WHEN 'EXIT' OR 'CANCEL'.
* Leaving the program
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " USER_COMMAND_9000 INPUT
*& Module set_screen_fields OUTPUT
* Setting the screen fields
MODULE set_screen_fields OUTPUT.
LOOP AT SCREEN.
IF flg IS INITIAL.
screen-input = 0.
ELSEIF ( flg EQ 'Y' ).
IF ( ( screen-name = 'I_MAKT-ZMAKTX'
OR screen-name = 'I_MAKT-CHECK1' )
AND t_ctrl-current_line LE ln ) .
* Making the screen fields as editable
screen-input = 1.
ELSEIF ( ( screen-name = 'I_MAKT-ZMATNR' )
AND t_ctrl-current_line LE ln ).
* Making the screen field as uneditable
screen-input = 0.
ENDIF.
ENDIF.
* Modifying the screen after making changes
MODIFY SCREEN.
ENDLOOP.
ENDMODULE. " set_screen_fields OUTPUT
*& Module zmatnr INPUT
* Appending records to the internal table
MODULE zmatnr INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
IF t_ctrl-current_line GT ln.
READ TABLE i_makt WITH KEY zmatnr = i_makt-zmatnr.
IF sy-subrc NE 0.
* Inserting record if it does not exist in database
APPEND i_makt.
ELSE.
MESSAGE i005 WITH 'Material Number' i_makt-zmatnr 'already exists'.
ENDIF.
ENDIF.
ENDMODULE. " zmatnr INPUT
*& Module set_status OUTPUT
* Setting the GUI status
MODULE set_status OUTPUT.
SET PF-STATUS 'ZSTATUS'.
SET TITLEBAR 'ZTITLE'.
ENDMODULE. " set_status OUTPUT
*& Module CHECK INPUT
* Modify the internal table using the current line in table control
MODULE check INPUT.
MODIFY i_makt INDEX t_ctrl-current_line.
ENDMODULE. " CHECK INPUT -
How to refer to fact table to update the same fact table
Here is my scenario. Fact table is having measures basic_sal, Tax, net_sal with dimension key to employee dimension.
I neet to update the net_sal = basic_sal - tax in fact table.
I tried to do a map with fact_table as source and also target. but after deploying the map, it's not updating the net_sal to the existing rows. It's inserting the new rows with dimension key and net_sal columns. so now fact table is having the double the existing rows.
Thanks,
Srini.Ola Srini,
We have some experience that updating a table while using that same table as source often takes a lot of time... Specially when the table contains a lot of data (which is mostly the case with fact tables).
You can use two solutions. Expand the mapping u use to fill the fact table... The calculations looks not that complex to me... But I could be wrong.
Other solution is to create a temp table where you store all sal types. You could load the fact table from this temp table. Disadvantage of this solution is maintenance of the temp table...
Regards,
Moscowic
Maybe you are looking for
-
How to use Paintcomponent using parameters/variable
Hi, I am new to Java.have looked in many topics of this forum, references and could not find the answer. thanks for helping. I am trying to test a simple procedure to draw a line from (0,0) to (x,x), where x is an integer entered by the user using a
-
Saving a file('s) to a database
Hi, I want to be able to store a file to a database regaurdless of its file type. It could be a doc, txt, pdf or a custom file format.. as long as the computer can read the file format... how can I do this? btw.. I am using VS 2013, SQL 2008 R2 and w
-
How can I program a PL/SQL procedure/function to return a cursor (recordset) to JDBC calling program AND have Oracle NOT reparse the select statement in the package? I presently return a ref cursor which works, but am dismayed that the statement is h
-
Project Systems - Outstanding Balances in Previous Financial Year
Hi gurus I recently joined a company that implemented SAP PS and IM It became apparent that year end processing was never completed. Amongst others, project balances was never settled (AUC as well as settlement to CO cost centres) How do I handle thi
-
Intel 5100 AGN replacement with an Intel 5300 AGN
I have an Intel WiFi 5100 and I was told to purchase a 5300 card as a replacement. The laptop starts, but stops and tells me that there is unregistered hardware trying to start and windows will stop it immediatley. HOW DO I INSTALL THE NEW DRIVERS