Skip to Content
author's profile photo
Former Member

Change documents

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • author's profile photo
    Former Member
    Oct 06, 2005 at 02:15 PM

    hi,

    use FM Chancedocument_read

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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.

  • author's profile photo
    Former Member
    Oct 06, 2005 at 02:30 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 06, 2005 at 04:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Oct 06, 2005 at 05:49 PM

    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

    Add comment
    10|10000 characters needed characters exceeded