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: 

How to maintain change history for a field

Former Member
0 Kudos

Hi All,

I am working in ISU module. I have added a new field in contract account screen (T-codes CAA1, CAA2, and CAA3). Now I have to maintain change history for this field. This change history should appear from contract account screen when in click on 'Field changes' or 'Account changes' option in Extras menu.

Please suggest.

Regards,

Venkat

5 REPLIES 5

Former Member
0 Kudos

Hi,

for maintaingnt he change details of the particular filed we have check the flag ( "Change documets" ) in the further charecterstis tab of the data element. it will reflect automatically for any changes of that filed.

or else

For the change documents of any transaction details will be stored in the table

CDHDR - Change document header

CDPOS - Change document items

i hope it will useful.

Former Member
0 Kudos

hi ,

U can use the FM CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

but before that u need to maintain the relevent entry in this table T77CDOC_CUST otherwise Fm will not return any thing.

EXPORTING

date_of_change = v_lastrundate

objectclass = c_objectclass

time_of_change = v_lastruntime

username = v_username

date_until = sy-datum

time_until = sy-uzeit

TABLES

i_cdhdr = it_cdhdr

EXCEPTIONS

no_position_found = 1

wrong_access_to_archive = 2

time_zone_conversion_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

ajoy_chakraborty
Participant
0 Kudos

Please try using FM: STATUS_CHANGE_DOC_ACTIVATE

Former Member
0 Kudos

If you want to maintain the change history for the particular field, than

Select the Data element of the field and mark the Change document check box in the Data element definition tab

Regards

Sasi

Former Member
0 Kudos

you have to check the flag Chnaged Document in that domain

you have to create the 'XXXXXXXXXXX'_WRITE_DOCUMENT' FM and include all the includes from that Fm.

pass the chnaged value and original value to this FM and it will update the CDHDR and CDPOS table.

Include

FZ_SER_MODIFYCDT.

PARAMETERS p_matnr type marc-matnr.

parameters p_werks type marc-werks.

end-of-SELECTION.

OBJECTID = 'ZMAT_CHDOC'. "Object Key of the object

TCODE = 'MM02'. "Tran with which changes are made

UTIME = SY-UZEIT. "Change time

UDATE = SY-DATUM. "Change date

USERNAME = SY-UNAME. "Changed by

data : i_zmsvp_replby_changed type STANDARD TABLE OF zmsvp_replby.

data : i_zmsvp_replby_dbcopy type STANDARD TABLE OF zmsvp_replby,

i_zmsvp_replby_dbcopy_line type zmsvp_replby,

i_zmsvp_replby_changed_line type zmsvp_replby.

select * from zmsvp_replby into table i_zmsvp_replby_dbcopy

where matnr = p_matnr and werks = p_werks.

i_zmsvp_replby_changed = i_zmsvp_replby_dbcopy.

  • read table

read table i_zmsvp_replby_changed into i_zmsvp_replby_changed_line

INDEX 1.

delete zmsvp_replby from i_zmsvp_replby_changed_line.

delete i_zmsvp_replby_changed index 1.

data : i_upd_dbcopy type STANDARD TABLE OF YZMSVP_REPLBY,

i_upd_run type STANDARD TABLE OF YZMSVP_REPLBY,

i_upd_dbcopy_line type YZMSVP_REPLBY,

i_upd_run_line type YZMSVP_REPLBY.

loop at i_zmsvp_replby_dbcopy into i_zmsvp_replby_dbcopy_line.

MOVE-CORRESPONDING i_zmsvp_replby_dbcopy_line to i_upd_dbcopy_line.

i_upd_dbcopy_line-KZ = 'U'.

append i_upd_dbcopy_line to i_upd_dbcopy.

clear i_upd_dbcopy_line.

ENDLOOP.

loop at i_zmsvp_replby_changed into i_zmsvp_replby_changed_line.

MOVE-CORRESPONDING i_zmsvp_replby_changed_line to i_upd_run_line.

i_upd_run_line-KZ = 'U'.

append i_upd_run_line to i_upd_run.

clear i_upd_run_line.

ENDLOOP.

CALL FUNCTION 'Z_SER_MODIFY_WRITE_DOCUMENT'

EXPORTING

objectid = 'ZMAT_CHDOC'

tcode = 'SE37'

utime = SY-UZEIT

udate = SY-DATUM

username = SY-UNAME

  • PLANNED_CHANGE_NUMBER = ' '

  • OBJECT_CHANGE_INDICATOR = 'U'

  • PLANNED_OR_REAL_CHANGES = ' '

  • NO_CHANGE_POINTERS = ' '

UPD_ICDTXT_Z_SER_MODIFY = ' '

UPD_ZMSVP_REPLACES = ' '

UPD_ZMSVP_REPLBY = 'U'

UPD_ZMSV_REPLACES = ' '

UPD_ZMSV_REPLBY = ' '

tables

icdtxt_z_ser_modify = icdtxt_z_ser_modify

xzmsvp_replaces = xzmsvp_replaces

yzmsvp_replaces = yzmsvp_replaces

xzmsvp_replby = i_upd_run

yzmsvp_replby = i_upd_dbcopy

xzmsv_replaces = xzmsv_replaces

yzmsv_replaces = yzmsv_replaces

xzmsv_replby = xzmsv_replby

yzmsv_replby = yzmsv_replby

.

if sy-subrc eq 0.

endif.