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: 

SCDO - Change Document

Former Member
0 Kudos

Hye,

Facing problem with the change document with update status. The tables CDHDR & CDPOS are getting updated , however my custom table ZEMPTABL is not getting updated with new values.

The steps for creation i followed is as:

1) Custom table : ZEMPTABL with Change document ticked for data elements

2) SCDO - Object created.

3) My program which calls function module for write document:

REPORT ZMSR_TRACKCHNG_CUSTOMTBL.

TABLES : ZEMPTABL.

DATA : GS_EMPTABL LIKE ZEMPTABL,

LS_EMPTABL LIKE ZEMPTABL.

DATA : T_CDTXT TYPE STANDARD TABLE OF CDTXT WITH HEADER LINE.

BREAK-POINT.

SELECT SINGLE * FROM ZEMPTABL INTO GS_EMPTABL

WHERE EMPNUM = '101'.

LS_EMPTABL = GS_EMPTABL.

GS_EMPTABL-EMPNUM = '101'.

GS_EMPTABL-EMPNAME = 'TET'.

T_CDTXT-TEILOBJID = 'ZTEST_TABL_CHNG'.

T_CDTXT-TEXTART = 'TEST'.

T_CDTXT-TEXTSPR = 'EN'.

T_CDTXT-UPDKZ = 'U'.

APPEND T_CDTXT.

CALL FUNCTION 'ZTEST_TABL_CHNG_WRITE_DOCUMENT'

EXPORTING

OBJECTID = 'ZTEST_TABL_CHNG'

TCODE = SY-TCODE

UTIME = SY-UZEIT

UDATE = SY-DATUM

USERNAME = SY-UNAME

PLANNED_CHANGE_NUMBER = ' '

OBJECT_CHANGE_INDICATOR = 'U'

PLANNED_OR_REAL_CHANGES = 'U'

NO_CHANGE_POINTERS = 'U'

UPD_ICDTXT_ZTEST_TABL_CHNG = 'U'

N_ZEMPTABL = GS_EMPTABL "new values

O_ZEMPTABL = LS_EMPTABL "old values

UPD_ZEMPTABL = 'U'

LV_OPT = ' '

TABLES

ICDTXT_ZTEST_TABL_CHNG = T_CDTXT

.

COMMIT WORK.

WAIT UP TO 3 SECONDS.

Can anyone let me know why the table is not getting updated with new values

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Hope you changing the contents EMPNAME of existing record. Code written by you will only update the change records. You have to update the z table explicitly using UPDATE or MODIFY statements.

Regards

Vinod

5 REPLIES 5

Former Member
0 Kudos

Hi,

Hope you changing the contents EMPNAME of existing record. Code written by you will only update the change records. You have to update the z table explicitly using UPDATE or MODIFY statements.

Regards

Vinod

Former Member
0 Kudos

Change documents will not be updated in your Z table, it will be updated in the CDHDR CDPOS tables, for which they are ment for, to store change documents..

raymond_giuseppi
Active Contributor
0 Kudos

You should have TWO function modules to call, like

* Update Database Table(s)
CALL FUNCTION 'ZTEST_TABL_CHNG_UPDATE' IN UPDATE TASK
     EXPORTING
          n_zemptabl                 = gs_emptabl  "new values
          o_zemptabl                 = ls_emptabl  "old values
          upd_zemptabl               = 'U'.
* Insert Change Document(s)
CALL FUNCTION 'ZTEST_TABL_CHNG_WRITE_DOCUMENT' IN UPDATE TASK
     EXPORTING
          objectid                   = 'ZTEST_TABL_CHNG'
          tcode                      = sy-tcode
          utime                      = sy-uzeit
          udate                      = sy-datum
          username                   = sy-uname
          planned_change_number      = ' '
          object_change_indicator    = 'U'
          planned_or_real_changes    = 'U'
          no_change_pointers         = 'U'
          upd_icdtxt_ztest_tabl_chng = 'U'
          n_zemptabl                 = gs_emptabl  "new values
          o_zemptabl                 = ls_emptabl  "old values
          upd_zemptabl               = 'U'
          lv_opt                     = ' '
     TABLES
          icdtxt_ztest_tabl_chng     = t_cdtxt.

COMMIT WORK.

Regards

Raymond

Former Member
0 Kudos

Hye,

Doubt does calling the FM update only CDHDR & CDPOS only and not the ZTABLE????

Do i need to update ZTABLE separately with new values???

Wht does the FM do then only update CDHDR & CDPOS????

Please guide.

0 Kudos

Hi,

Yes, the function module created from the change object only creates change documents. You still need to update the table yourself, the change object will not take care of this. After all, there may be more fields in the table that do not have change documents, so why would the change object take care of all of these fields that it knows nothing about?

Regards,

Nick