Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding change document objects

Former Member
0 Likes
1,015

hi to all ,

I created change document object for one transaction say MM02. now i changed the material description . the new and old data is stored in CDPOS and CDHDR tables. my aim is to create one z* program for displaying material number , old makt ,new makt. suppose we enter material number on selection-screen above data should be display . I did;t find material number in CDPOS AND CDHDR tables. how can i link these tables. thank you in advance. waiting for reply

6 REPLIES 6
Read only

Former Member
0 Likes
951

Hi,

We can use standard FM's also



CHANGEDOCUMENT_READ_HEADERS
CHANGEDOCUMENT_READ_POSITIONS

(They will fetch necessary data from CDHDR,CDPOS)

1. The First FM gives list of all

records ( with change no) which have changed.

2. Loop at the above and the second FM will

provide the details (old-val, new-val) for

each record.

3. Use the appropriate docclass since there are change documents related to other modules / transactions also.

Hope this helps.

Regards,

Amit Mittal.

Read only

0 Likes
951

thank you Amit Mittal,

CDPOS AND CDHDR table capture only new and old data. but how can we find these changed data belongs to perticular material . user enter material number in selection-screen it should display matnr , old and new makt. i hope u have understood my probs.

regards

mohan

Read only

0 Likes
951

Hi again,

In CDHDR table, there are two important fields.

1. OBJECTCLAS

2. OBJECTID

For material changes, the standard objectclas value is 'MATERIAL'.

The ObjectID will contain the value of that object. In our case the Material Number.

Hence, give the value of material number in that field.

(Note : we have to make sure that the proper zeroes are prefixed).

Regards,

Amit Mittal.

Read only

0 Likes
951

The field connecting both tables is changenr.

For example i created these statements.

itb_objidn_ra is a range table with the objectid used on creating the change docs. Use se16 to see the content of the tables.

Maybe this is helpful for you.


data:
 ls_hdr type cdhdr,
  ltb_hdr type standard table of cdhdr,
 ltb_opm type standard table of CDSHW,

* Read the headers of all change documents
  select *
    from cdhdr
    into corresponding fields of table ltb_hdr
    where objectclas = ic_class
      and objectid   in itb_objidn_ra.


* Read the changedocument content
  call function 'CHANGEDOCUMENT_READ_POSITIONS'
    exporting
      changenumber      = ls_hdr-changenr
    tables
      editpos           = ltb_opm
    exceptions
      no_position_found = 1.
  case sy-subrc.
    when 1.
      raise not_found.
  endcase.

Read only

Former Member
0 Likes
951

Hello

For material:

OBJECTCLAS = 'MATERIAL'

OBJECTID = material number with leading zeros (like OBJECTID = '000000000000000001')

Read only

0 Likes
951

hi Dzed Maroz .

do not say MM02. i took example.I created change document object for one transaction say zstudent, which has student number , student class. now i changed the student class . the new and old data is stored in CDPOS and CDHDR tables. my aim is to create one z* program for displaying SNAME , old makt ,new SCLASS. suppose we enter SNAME on selection-screen above data should be display . I did;t find SNAME in CDPOS AND CDHDR tables. how can i link these tables.