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: 

Change Log for Custom Table

satya_p5
Explorer
0 Kudos

Hi,

I want to capture change log for a custom table.

I am aware 2 options are availble for this

First one is:

Setting REC/CLINET parameter and checking in SCU3 but we don't want to check this as its causing performance issues.

Second one is:

Check data element change log and configure table in SCDO.

Here i have multiple questions?

1. Is the configuration is sufficient to update CDPOS and CDHDR or do i need to write a program by providing old values, new values.. to the generated Function Module?

2. Each time i am executing a new CDPOS and new CDHDR records are generating but i am not able to get new and old values in cdpos, i don't understand what i am missing.

irrespective of whether i pass 'I' or 'U' for few parameters in the generated Function module, it updating new record

Below is the code i wrote:

 SELECT SINGLE * FROM ZTMM_TEST
     INTO WA_OLDVALUES
    WHERE TEST_ID = P_FCAST
      AND ARTICLE_VAR = P_ARTICL
      AND ERD         = P_ERD.
 IF SY-SUBRC EQ 0.
   CLEAR WA_NEWVALUES.
   WA_NEWVALUES = WA_OLDVALUES.
   wa_newvalues-ARTICLE_COST = '96'.


   modify ZTMM_TEST from WA_NEWVALUES.


DATA:
 lv_TEILOBJID TYPE  CDTABKEY.
  concatenate SY-MANDT WA_OLDVALUES-TEST_ID WA_OLDVALUES-ARTICLE_VAR WA_OLDVALUES-ERD INTO lv_TEILOBJID.
   wa_cdtxt-TEILOBJID = lv_TEILOBJID. 
   wa_cdtxt-TEXTART   = 'KEY'. 
   wa_cdtxt-TEXTSPR   = 'EN'.
   wa_cdtxt-UPDKZ     = 'U'.
   APPEND wa_cdtxt to it_cdtxt.
   clear wa_cdtxt.
   CLEAR lv_TEILOBJID.
 ENDIF.




CALL FUNCTION 'ZMM_TEST_CD_WRITE_DOCUMENT'
  EXPORTING
    objectid                         = 'ZMM_TEST_CD'
    tcode                            = sy-tcode 
    utime                            = sy-uzeit 
    udate                            = sy-datum 
    username                         = sy-uname 
   PLANNED_CHANGE_NUMBER            = ' '
   OBJECT_CHANGE_INDICATOR          = 'I' 
*   PLANNED_OR_REAL_CHANGES          = ' ' 
*   NO_CHANGE_POINTERS               = ' ' 
   UPD_ICDTXT_ZMM_FORECAST_CD       = 'I' 
    N_ZTMM_TEST                  = WA_NEWVALUES
    O_ZTMM_TEST                  = WA_OLDVALUES
   UPD_ZTMM_TEST                = 'I' 
   LV_OPT                           = ' ' 
  TABLES
    icdtxt_zmm_TEST_cd           = IT_CDTXT


          .
6 REPLIES 6

DoanManhQuynh
Active Contributor

I think you tried to update old record then it should be 'U' in your parameter...below wiki have detail of the setting, you may cross check with yours:

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+-+Data+Change+Tracker+for+Custom+Tables

jack_graus2
Active Contributor
0 Kudos

The parameter OBJECTID should hold the table key as in the table ZTMM_TEST. Now it holds the value 'ZMM_TEST_CD'.

Regards Jack

0 Kudos

Hi Jack,

Whatever the value i am passing as OBJECTID, the same value is appearing in CDPOS-OBJECTID,

and already tried by providing table key but its not working.

I referred many links in google in many links they are passing Object created in SCDO only as Objectid.

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+-+Data+Change+Tracker+for+Custom+Tables

I am not getting Table name, field name, new value and old values in CDPOS,

in TABNAME i am getting ObjectID

in FNAME its coming from whatever i passed in CDTXT-textart, this field also has length of 4 characters

Thanks,

Satya

0 Kudos

satya.p5 : from your referred link, i saw they dont modify table before call function module, pls cross check if there is any difference between your code and wiki code.

BaerbelWinkler
Active Contributor
0 Kudos

Hi Satya,

could you please elaborate a bit on this statement and where/when you notice performance issues?

"Setting REC/CLINET parameter and checking in SCU3 but we don't want to check this as its causing performance issues."

We often set the flag to track changes for custom tables and aren't aware of this causing performance issues. We are on NW750, EHP8 with HANA-DB.

nabheetscn
Active Contributor
0 Kudos

What kind of table it is? is it master or transaction? Secondly if you are planning to use data element level change logs via SCDO then you will need to code for it, google it for more detail.

Nabheet