Sunday 18 January 2009

Creation-Change log for Custom Transaction

Creation of the change log for a custom transaction

1.Lets assume that we have a single table associated with this custom transaction.(Same process will be followed if there are multiple tables).

2.Go to transaction SCDO.

3.Create the object for that particular table name.

4.The update function module in the generation info is used to write the changes in CDHDR and CDPOS tables.





5.The table technical settings should be set to log the changes and check the Change document button at the data element level for the fields.

6.In the Custom transaction where you are making changes .
Select the old values from the custom table.

7.When updating the Custom table call the FM
Check if there is any difference between the old value and the new value you are currently updating into Custom table.
If there is a difference then call the below FM.
*No need to send any data into table l_i_cdtxt_chgcstprf.But keep clearing it.
*The object id l_v_object_id may be a concatenation of the key fields of the custom table.

CALL FUNCTION 'SWE_REQUESTER_TO_UPDATE'.

* FM is called to update the change log in database
CALL FUNCTION '/GLB/CHGCSTPRF_WRITE_DOCUMENT'
EXPORTING
objectid = l_v_object_id
tcode = sy-tcode
utime = sy-uzeit
udate = sy-datum
username = sy-uname
object_change_indicator = 'U'
upd_icdtxt_chgcstprf = 'U'
n_glb_ogtt_cstprf = l_wa_cstprf_new
o_glb_ogtt_cstprf = l_wa_cstprf_old
upd_glb_ogtt_cstprf = 'U'
TABLES
icdtxt_chgcstprf = l_i_cdtxt_chgcstprf.

This will update the data into CDHDR and CDPOS tables.

Regards,
Sasidhar

No comments: