07-11-2008 11:34 AM
Hi Experts,
Is there any field which stores Vendor creation and change time.
There is a field in LFA1 and LFB1 i.e.UPTIM but that is Time of last change confirmation and its value is usually 00:00:00 So it will not be fulfuilling purpose
Actually my requirement is to download the vendor master data from SAP Tables to Application server.
and this downloading has to be delta downloading, for which i need to have timestamp of last run which i m maintaining in a z table, but to which field should i compare it to ??
Any idea over the field issue or logic would be really helpful
Regards
Shreya
07-11-2008 11:49 AM
This is something similar that we have used to check when vendor names have changes. It may be useful to experiment with for your needs.
* get vendor change records for dates
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
date_of_change = l_from
objectclass = 'KRED'
username = ' '
date_until = l_to
TABLES
i_cdhdr = it_hdr
EXCEPTIONS
no_position_found = 1
wrong_access_to_archive = 2
time_zone_conversion_error = 3
OTHERS = 4.
IF it_hdr IS INITIAL.
MESSAGE i099(zf) WITH 'No Master changes -'
'CHANGEDOCUMENT_READ_HEADERS result' sy-subrc.
RETURN.
ENDIF.
SORT it_hdr.
* look for vendor name changes
SELECT * INTO TABLE it_pos
FROM cdpos
FOR ALL ENTRIES IN it_hdr
WHERE objectclas = it_hdr-objectclas
AND objectid = it_hdr-objectid
AND changenr = it_hdr-changenr
AND fname = 'NAME1'.
IF sy-subrc NE 0.
MESSAGE i099(zf) WITH 'No vendor master names have changed.'.
RETURN.
ELSE.
MESSAGE i099(zf) WITH 'Vendor master names have changed.'.
ENDIF.
07-11-2008 11:49 AM
This is something similar that we have used to check when vendor names have changes. It may be useful to experiment with for your needs.
* get vendor change records for dates
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
date_of_change = l_from
objectclass = 'KRED'
username = ' '
date_until = l_to
TABLES
i_cdhdr = it_hdr
EXCEPTIONS
no_position_found = 1
wrong_access_to_archive = 2
time_zone_conversion_error = 3
OTHERS = 4.
IF it_hdr IS INITIAL.
MESSAGE i099(zf) WITH 'No Master changes -'
'CHANGEDOCUMENT_READ_HEADERS result' sy-subrc.
RETURN.
ENDIF.
SORT it_hdr.
* look for vendor name changes
SELECT * INTO TABLE it_pos
FROM cdpos
FOR ALL ENTRIES IN it_hdr
WHERE objectclas = it_hdr-objectclas
AND objectid = it_hdr-objectid
AND changenr = it_hdr-changenr
AND fname = 'NAME1'.
IF sy-subrc NE 0.
MESSAGE i099(zf) WITH 'No vendor master names have changed.'.
RETURN.
ELSE.
MESSAGE i099(zf) WITH 'Vendor master names have changed.'.
ENDIF.
07-11-2008 12:04 PM
Thanks a lot ! but my problem is not soled with this.
I explain in detail :-
I have to extract certain fields from LFA1, LFB1, ADRC, ADR6 and download them to application server in two files : one for create vendor and one for change vendor.
Since this download is not cumulative...i.e. suppose i run this report on july 12, 01:30:20. at that time i download the vendors cretaed by then and also vendors changed by then in their respective files.
Now suppose i want to run this report at july 12, 02:30:15 then i need to download onlt those created vendors that have been created after the previous time stamp and only those changed vendors that have been changed after the previuos time stamp.
For changed vendors i can use CDHDR table and also the FM Change_Document_Read_Headers
But how to find the time stamp of create vendors. ??
Hope i m clear with my requirements !