2005 Nov 28 3:11 PM
Hi,
I've created several user tables in order to store new data about customers. But I also need to store the changes into the tables.
I've read about change documents, but I'm not very sure of how can I use these, for example what are the functions that I have to use or where to put this code in my program.
Any example of how to use this would be very appreciated
thanks in advance
Hi,
I've created several user tables in order to store new data about customers. But I also need to store the changes into the tables.
I've read about change documents, but I'm not very sure of how can I use these, for example what are the functions that I have to use or where to put this code in my program.
Any example of how to use this would be very appreciated
thanks in advance
2005 Nov 28 3:17 PM
Hi,
Your user tables are Z tables and you want to insert or modify lines of the tables?
2005 Nov 28 3:18 PM
2005 Nov 28 3:18 PM
HI <b>CDHDR and CDPOS</b> will have all the changes or updates.
write a code in your program read the tables and update your tables based on the transaction.
regards
vijay
2005 Nov 28 3:48 PM
Hi,
Use the tables CDHDR and CDPOS to fetch the old and new values..
A sample code
**fetch header records from cdhdr table
SELECT OBJECTID
CHANGENR
USERNAME
UDATE
UTIME
FROM CDHDR
INTO TABLE I_CDHDR
WHERE UDATE IN S_DATE AND
OBJECTCLAS EQ 'ADRESSE' AND "address change
TCODE EQ 'VA02' AND "tcode
CHANGE_IND EQ 'U'. "change type update(U)
**fetch the position records based on the cdhdr entries
IF NOT I_CDHDR IS INITIAL.
SELECT CHANGENR
TABNAME
FNAME
VALUE_NEW "new value
VALUE_OLD " old value
FROM CDPOS
INTO TABLE I_CDPOS
FOR ALL ENTRIES IN I_CDHDR
WHERE CHANGENR EQ I_CDHDR-CHANGENR AND
TABNAME IN R_TFIELDS AND
FNAME IN R_FIELDS.
ENDIF.
Note: R_TFIELDS is the table name stored in ranges table.
I mean changes to these table entries only..
R_FIELDS is the field name of the corresponding tables in R_TFIELDS.
You define as below in the data declaration.
*ranges r_fields for cdpos-fname.
RANGES: R_FIELDS FOR CDPOS-FNAME,
R_TFIELDS FOR CDPOS-TABNAME.
In the INIITIALIZATION event fill these ranges with the corresponding value...
Regards,
Abdul