‎2006 Dec 14 5:19 PM
I am writing a program to extract vendors. I plan to initially extract all of the vendors and going forward, I would like to extract only the vendors that been added after a certain date and any vendors that have been changed. I plan on using the field ERDAT in LFA1 to select newly created vendors but I not sure how to select the vendors that have been changed. I am looking at the t-code xk04 (display change vendors) and will look at xk02 which changes a vendor. Is this the correct way to do this? If someone knows the table and field name that contains the changed data that I can used to perform the select, could you please share it with me.
thanks in advance for the help.
‎2006 Dec 14 5:48 PM
Hi Timothy,
You can extract the vendor details which have been changed from CDHDR and CDPOS where all changes are logged.
First go into CDHDR table for all the vendor objects taht have been changed based on date criteria.
Following code will give you an idea:
data: begin of icdhdr occurs 100. "Header
include structure cdhdr.
data: end of icdhdr.
data: begin of icdpos occurs 100. "Detail
include structure cdpos.
data: end of icdpos.
select * from cdhdr into table icdhdr
where objectclas = 'KRED'
and objectid in lifnr "from selection screen
and udate >= datum. "all objects changed since the date.
then go into CDPOS table to find the changed data.
select * from cdpos into table icdpos where objectclas = 'KRED'
and objectid = icdhdr-objectid
and changenr = icdhdr-changenr
and ( tabname = 'LFA1'
or tabname = 'LFBK'
or tabname = 'LFB1'
or tabname = 'LFB5'
or tabname = 'LFBW' )
You can use any of the table based on the what changed data you want to find.
Probaly based on your requirement, you only need to check CDHDR table only of you want to know what all vendors were changed.
You can find whether a vendor was changed or not thru XK03 -> Environment -> Account changes - > All fields.
Cheers,
Vikram
Pls reward for helpful replies!!
‎2006 Dec 14 5:48 PM
Hi Timothy,
You can extract the vendor details which have been changed from CDHDR and CDPOS where all changes are logged.
First go into CDHDR table for all the vendor objects taht have been changed based on date criteria.
Following code will give you an idea:
data: begin of icdhdr occurs 100. "Header
include structure cdhdr.
data: end of icdhdr.
data: begin of icdpos occurs 100. "Detail
include structure cdpos.
data: end of icdpos.
select * from cdhdr into table icdhdr
where objectclas = 'KRED'
and objectid in lifnr "from selection screen
and udate >= datum. "all objects changed since the date.
then go into CDPOS table to find the changed data.
select * from cdpos into table icdpos where objectclas = 'KRED'
and objectid = icdhdr-objectid
and changenr = icdhdr-changenr
and ( tabname = 'LFA1'
or tabname = 'LFBK'
or tabname = 'LFB1'
or tabname = 'LFB5'
or tabname = 'LFBW' )
You can use any of the table based on the what changed data you want to find.
Probaly based on your requirement, you only need to check CDHDR table only of you want to know what all vendors were changed.
You can find whether a vendor was changed or not thru XK03 -> Environment -> Account changes - > All fields.
Cheers,
Vikram
Pls reward for helpful replies!!
‎2006 Dec 14 6:00 PM
vikram,
thanks for the info. I have a vendor that the business gave me to check. it looks like there is record in this table that corrosponds to the date the vendor was added. Does this table contain both vendors that have been changed as well as newly created vendors? if so, I can use this table to find all of the vendors that been created and/or changed after a certain date.
‎2006 Dec 14 6:08 PM
Hi,
CDHDR will work for your purpose. In CDHDR there is a field named 'CHANGE_IND'. THis field will let you know if the record is inserted, changed or deleted.
If you want to fetch the vendors whose details are changed, the in the where clause of the select use CHANGE_IND = 'U'.(Update).
Regards,
Vara