11-05-2007 6:17 AM
Hi all,
How to maintain table history for z-tabels
Reward points for helpful answer
Thanks & Regards
SEK
11-05-2007 6:21 AM
Hi
SE11 -> Your Ztable -> Tehnical settings -> Log data changes.
Tick this checkbox for logging all changes.
The existing logs can be displayed with Transaction Table history (SCU3).
Regards
Arun
11-05-2007 6:30 AM
HI,
Please check this thread.
http://www.sapdevelopment.co.uk/tips/changedoc/cd_createch.htm
Once you create your change document object using generate update pgm option then please check the WRITE document fm.
I have done this long back i am updating CDHDR and CDPOS for 2 table YATT and YATTPLANTS. Here YATT have single record (header table) and YATTPLANTS have multiple records (item table)
function yatt_write_document .
call function 'CHANGEDOCUMENT_OPEN'
exporting
objectclass = 'YATT '
objectid = objectid
planned_change_number = planned_change_number
planned_or_real_changes = planned_or_real_changes
exceptions
sequence_invalid = 1
others = 2.
case sy-subrc.
when 0. "ok.
when 1. message a600 with 'SEQUENCE INVALID'.
when 2. message a600 with 'OPEN ERROR'.
endcase.
if upd_yctc ne space.
call function 'CHANGEDOCUMENT_SINGLE_CASE'
exporting
tablename = 'YATT '
workarea_old = o_yatt
workarea_new = n_yatt
change_indicator = upd_yattc
docu_delete = 'X'
exceptions
nametab_error = 1
open_missing = 2
position_insert_failed = 3
others = 4.
case sy-subrc.
when 0. "ok.
when 1. message a600 with 'NAMETAB-ERROR'.
when 2. message a600 with 'OPEN MISSING'.
when 3. message a600 with 'INSERT ERROR'.
when 4. message a600 with 'SINGLE ERROR'.
endcase.
endif.
if upd_yctcauthplnts ne space.
call function 'CHANGEDOCUMENT_MULTIPLE_CASE'
exporting
tablename = 'YATTPLANTS '
change_indicator = upd_yattplants
docu_delete = 'X'
tables
table_old = yyattplants
table_new = xyattplants
exceptions
nametab_error = 1
open_missing = 2
position_insert_failed = 3
others = 4.
case sy-subrc.
when 0. "ok.
when 1. message a600 with 'NAMETAB-ERROR'.
when 2. message a600 with 'OPEN MISSING'.
when 3. message a600 with 'INSERT ERROR'.
when 4. message a600 with 'MULTIPLE ERROR'.
endcase.
endif.
call function 'CHANGEDOCUMENT_CLOSE'
exporting
objectclass = 'YATT '
objectid = objectid
date_of_change = udate
time_of_change = utime
tcode = tcode
username = username
object_change_indicator = object_change_indicator
no_change_pointers = no_change_pointers
exceptions
header_insert_failed = 1
object_invalid = 2
open_missing = 3
no_position_inserted = 4
others = 5.
case sy-subrc.
when 0. "ok.
when 1. message a600 with 'INSERT HEADER FAILED'.
when 2. message a600 with 'OBJECT INVALID'.
when 3. message a600 with 'OPEN MISSING'.
WHEN 4. MESSAGE A600 WITH 'NO_POSITION_INSERTED'.
do not abort, if positions are not inserted!!!
when 5. message a600 with 'CLOSE ERROR'.
endcase.
endfunction.
regards
siva
11-05-2007 6:30 AM
Hi Raja Sekhar,
If you check the Log data changes check box of a custom table technical settings then the updates/insert/delete would be logged in a separate table.
i am sorry i am not sure you can view this log using tcode scu3 or suc3, by entering the table name.
Thanks,
Sam.
11-05-2007 6:32 AM
Hi
just switch on table logging for the table in dictionary, SE11, technical settings, Log data changes.