Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Z-Table

Former Member
0 Kudos

Hi all,

How to maintain table history for z-tabels

Reward points for helpful answer

Thanks & Regards

SEK

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi

just switch on table logging for the table in dictionary, SE11, technical settings, Log data changes.