04-22-2009 3:07 AM
Hi,
I am looking for a Functional Module that reads the change document from Tables CDHDR & CDPOS. If the same document is changed more than once, I want to process the latest change on the document. Can you please suggest me a suitable FM for this requirement.
Appreciate your help in Advance!
Thanks,
Kannan
04-22-2009 6:29 AM
hi ,
use this link .
http://help.sap.com/saphelp_nw04/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/content.htm.
~linganna
04-22-2009 4:18 AM
Hi
Use this function modules,
CHANGEDOCUMENT_READ_HEADERS
CHANGEDOCUMENT_READ_POSITIONS
Check this sample code.
cdhdr-objectclas = 'MATERIAL'.
cdhdr-objectid = t_mara-matnr.
CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'
EXPORTING
date_of_change = cdhdr-udate
objectclass = cdhdr-objectclas
objectid = cdhdr-objectid
time_of_change = cdhdr-utime
username = cdhdr-username
TABLES
i_cdhdr = icdhdr
EXCEPTIONS
no_position_found = 1
OTHERS = 2.
CHECK sy-subrc EQ 0.
DELETE icdhdr WHERE change_ind EQ 'I'.
CHECK NOT icdhdr[] IS INITIAL.
LOOP AT icdhdr.
CHECK icdhdr-udate IN period.
CHECK icdhdr-username IN name.
CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'
EXPORTING
changenumber = icdhdr-changenr
IMPORTING
header = cdhdr
TABLES
editpos = icdshw
EXCEPTIONS
no_position_found = 1
OTHERS = 2.
CHECK sy-subrc EQ 0.
LOOP AT icdshw.
CHECK icdshw-text_case EQ space.
MOVE-CORRESPONDING icdshw TO itab.
MOVE-CORRESPONDING icdhdr TO itab.
MOVE icdshw-tabkey+3 TO itab-matnr.
APPEND itab.
ENDLOOP.
ENDLOOP.
ENDFORM. "CHANGEDOCUMENT_READ
Rgds
Siva
Edited by: siva prasad on Apr 22, 2009 5:29 AM
04-22-2009 6:25 AM
Hi,
Sorry, Removed i think was not Relevant
Best Regards,
Faisal
Edited by: Faisal Altaf on Apr 22, 2009 10:32 AM
04-22-2009 6:29 AM
hi ,
use this link .
http://help.sap.com/saphelp_nw04/helpdata/EN/2a/fa01dd493111d182b70000e829fbfe/content.htm.
~linganna
04-22-2009 6:41 AM