Documente Academic
Documente Profesional
Documente Cultură
CDPOS tables)
By Rahul Mehta, Tata Consultancy Services
The table consists of three fields EMPID (Employee id), ENAME (Employee name) and ELOC (Employee
Location).
2. Create the Z data elements and in the further characteristics tab of the data element tick the check box
change document.
Click on the continue button and stored the object in a package or as a local object.
Put the cursor on the change document object ‘ZCHOBJ’ and click on ‘Generate Update Pgm’ button.
Now we will use this function module to maintain the logs in CDPOS & CDHDR tables.
Where N stands for new data & O stands for old data. The naming conventions of these generated
parameters are as follows-
Imp Points:
1. To maintain a log for the insert entries: Pass the data to the new parameter. (N_ZEMP_TABLE).
2. To maintain a log for the update entries: Pass the new data to the new parameter
(N_ZEMP_TABLE) and old data to the old parameter. (O_ZEMP_TABLE)
3. To maintain a log for the Delete entries: Pass the data to the old parameter (O_ZEMP_TABLE).
Now we will maintain log for insert, update and delete entries.
12. Insert Log: We will insert one entry in table ZEMP_TABLE and maintain the insertion log in CDHDR
and CDPOS table.
REPORT zinsert.
lv_objectid = ls_emp-empid.
ls_emp_new = ls_emp.
Note: In case of insertion pass the value of the parameter UPD_ZEMP_TABLE = ‘I’.
After executing the program the table ZEMP_TABLE consists of following data.
Go to table CDHDR and Pass the object class ‘ZCHOBJ’ (Which we have created using SCDO) and
creation date (UDATE). (We can also give additional filter criteria).
xecute it and we will get the record in table CDHDR.
Copy the object class (OBJECTCLAS), object id (OBJECTID) and Document change number
(CHANGENR) and go to table CDPOS.
13. Update log: In this we will change the Employee name (ENAME) to ‘EMPLOYEE’ and Employee
Location (ELOC) to ‘KURUKSHETRA’ in table ‘ZEMP_TABLE’ and maintain the Updation log.
REPORT ZCHANGE.
ls_emp_new-empid = '1'.
ls_emp_new-ename = 'EMPLOYEE'.
ls_emp_new-eloc = 'KURUKSHETRA'.
ls_emp_old-empid = '1'.
ls_emp_old-ename = 'STUDENT'.
ls_emp_old-eloc = 'GANDHINAGAR'.
lv_objectid = ls_emp_new-empid.
Note: In case of Updation pass the value of the parameter UPD_ZEMP_TABLE = ‘U’.
After executing the program the table ZEMP_TABLE consists of following data.
CDHDR Entries:
CDPOS Entries:
In the field VALUE_NEW we will get the new values and in the field VALUE_OLD we will get the old
values.
14. Delete Log: In this we will delete this entry from table ‘ZEMP_TABLE’ and maintain the deletion log.
REPORT zdelete.
ls_emp_old-empid = '1'.
DELETE zemp_table FROM ls_emp_old.
lv_objectid = ls_emp-empid.
Note: In case of deletion pass the value of the parameter UPD_ZEMP_TABLE = ‘D’.
Execute the program. After executing the program the entry will be deleted from the table
ZEMP_TABLE.
CDHDR Entries:
CDPOS Entries: