cancel
Showing results for 
Search instead for 
Did you mean: 

Change documents

Former Member
0 Kudos

Hi,

We have a requirement where we have to capture the changes to certain fields done through transactions

MM02, CS02, CA22, KP26 & KZ21.

What would be best way to acheive this?

One way which I could figure out was querying CDHDR and CDPOS? Is this the best way to do it?

If so what is best way in finding the object class and number for a particular field?

Will the table TCDOB be enough?

Please give your valuable inputs. Thank you.

Regards,

Saji.

Accepted Solutions (0)

Answers (4)

Answers (4)

glauco
Active Contributor
0 Kudos

My friend, follow these steps:

1st step:

SELECT *

FROM cdhdr

INTO table t_cdhdr

WHERE OBJECTCLAS = 'MATERIAL' and

OBJECTID = 'put the document/material number'.

2nd step:

LOOP AT t_cdhdr.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

EXPORTING

changenumber = t_cdhdr-CHANGENR

TABLES

EDITPOS = t_EDITPOS

EDITPOS_WITH_HEADER = t_EDITPOS_WITH_HEADER

EXCEPTIONS

NO_POSITION_FOUND = 1

WRONG_ACCESS_TO_ARCHIVE = 2

OTHERS = 3.

IF sy-subrc <> 0.

Sort t_cdhdr by CHANGENR. "changes order

****error message

else.

  • HOU HAVE TO PREPARE YOUR READ STATEMENT WITH THE POSITION'S POSITIONS YOU WANT TO READ.

Read table t_EDITPOS_WITH_HEADER

with key tabkey+X(X) = IT_TABLE-DOCUMENT

tabkey+X(X) = IT_TABLE-ITEM

outlen = 'SIZE' "EX.: '0017'

fname = 'FIELDNAME'.

if sy-subrc = 0.

perform CALCULATE_CHANGES.

endif.

clear: t_EDITPOS,

t_EDITPOS_WITH_HEADER.

clear: t_EDITPOS[],

t_EDITPOS_WITH_HEADER[].

Endif.

endloop.

ENDIF.

*----


Glauco

Former Member
0 Kudos

Object for

MM02 - MATERIAL

CS02 - STUE

CA22 - PLAN

Other two I am not sure.

And yes for selection from CDHDR you can specify TCODE also. For example MATERIAL change documents are written for MM01 also.

Cheers

Former Member
0 Kudos

Hi

You can use fm CHANGEDOCUMENT_READ_HEADERS and CHANGEDOCUMENT_READ_ITEM but you should know the type object for each transaction: you can see transaction SCDO to get out it.

Max

Former Member
0 Kudos

Hi Max,

I went into SCDO but how is that I would find the object for a particular field from this?

Regards,

Sajith.

Former Member
0 Kudos

hi,

use FM Chancedocument_read

Former Member
0 Kudos

hi,

instead of using CDHDR and CDPOS you can use function module CHANGEDOCUMENT_READ

and find out the module i thing yours is the correct way

cheers,

sasi

Former Member
0 Kudos

Hi Sasi,

In this FM is there any way by which I can mention the Tcode. Because just giving the table and field could give me unwanted data, or am I missing something?

Regards,

Saji.