‎2011 Oct 26 11:50 AM
Dear experts,
When using change document object for documenting database INSERT operation, do I have to specify the old values?
I have a change document object Z_121_17 for table ZSCARR_CUSTOM. After generating the change document object, I receive a function module and several include programs with table work areas for old values (*ZSCARR_CUSTOM) and new values (ZSCARR_CUSTOM). Below is my code:
INCLUDE fz_121_17_includecdt.
INCLUDE fz_121_17_includecdc.
DATA:
carrid TYPE zscarr_custom-carrid VALUE 'ZZ'.
START-OF-SELECTION.
"INSERT
"Define new values
zscarr_custom-carrid = 'ZZ'.
zscarr_custom-carrname = sy-uzeit.
"Define general document data
CONCATENATE carrid sy-datum sy-uzeit INTO objectid.
"Define document header
tcode = 'Z_121_17'.
utime = sy-uzeit.
udate = sy-datum.
username = sy-uname.
upd_zscarr_custom = 'I'.
"Perform database operation
INSERT into zscarr_custom values zscarr_custom.
"Create change document
PERFORM cd_call_z_121_17.
COMMIT WORK.
Is my program above correct for documenting INSERT operation? I mean, is there any variable that I didn't specify or I specified incorrectly?
Thanks in advance.
Regards,
Haris
‎2011 Oct 26 12:53 PM
Hi
If you do an insert operation, your previous values, I think that you have in table Y* is empty. You only have values in table X*. If you want know what these values are, see the table (tcode SE16). I remeber that the log tells you who, when and so on the record was created. I think that you have a XZSCARR_CUSTOM and a YZSCARR_CUSTOM for post and previous data. These structures have a field called UPD.
I'm not sure if it could help you
Regards
Eduardo
‎2011 Oct 26 3:11 PM
Hi Eduardo,
Thanks for replying. I'm using the default table work areas generated by the system. They are *ZSCARR_CUSTOM for old values (previous data) and ZSCARR_CUSTOM for new values (post data). Below is the data definitions generated by the system in the F........CDV include program.
* declaration for the long text
DATA: BEGIN OF ICDTXT_Z_121_17 OCCURS 20.
INCLUDE STRUCTURE CDTXT.
DATA: END OF ICDTXT_Z_121_17.
DATA: UPD_ICDTXT_Z_121_17 TYPE C.
* workaera_old of ZSCARR_CUSTOM
TABLES: *ZSCARR_CUSTOM
* workaera_new of ZSCARR_CUSTOM
, ZSCARR_CUSTOM.
DATA: UPD_ZSCARR_CUSTOM TYPE C.
So, since I didn't put any value to the *ZSCARR_CUSTOM, did it mean that my program in my first post is correct for creating change document of INSERT operation?
Regards,
Haris