Application Development 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: 

Check if a specific field of a material hast changed

Former Member
0 Kudos

Hi!

Is it possible to check if a specific field of a material has changed since a given date. My issue is to collect all materials which have changed since a given date. This is no problem. I can use a select within table mara and ask for change date. But lately the result is to big so I need to ask more detailed if one of the following fields has changed since the given date.

Deletion flag

Manufacturer Part Number

Description

Status

Manufacture Code

Basic Unit of Measure

Stock Unit of Measure

Purchase Unit of Measure

Bulk definition

Special Procurement

Material Group

Does SAP has a log mechanism where I can ask which field has changed?

Thanks,

Konrad

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Konarad,

"CHANGE DOCUMENTS" in SAP Terminology

1 The same thing which u are asking

we had developed here. Any change

in the material master will be detected

and a mail will be sent to the concerned

employee.

THIS WILL ALSO DETECT WHICH FILEDS HAVE CHANGED.

IT CAN ALSO GIVE, The Old Value, And The New Value.

2. This Mechanism is called CHANGE DOCUMENTS in

SAP Terminology

3. 2 Fuction Modules are Required.

(They will fetch necessary data from CDHDR,CDPOS)

CHANGEDOCUMENT_READ_HEADERS

CHANGEDOCUMENT_READ_POSITIONS

4. The First FM gives list of all

records ( with change no) which have changed.

5. Loop at the above and the second FM will

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

each record.

6. While using 1st Fm, give docclass as 'MATERIAL'.

BCOS

the concept of change documents is applicable

to other type of documents also (depends upon

customization)

HOPE THE ABOVE HELPS.

Regards,

Amit M.

5 REPLIES 5

christian_wohlfahrt
Active Contributor

Hi Konrad!

Yes there is a log: change documents (CD). In tables CDHDR / CDPOS changes are followed (if customizing is correct and transaction calls change document creation).

Just select object = MATERAIL and objectid = matnr (in internal format) to get an idea. Data elements have to be activated for CD.

When there are CD, than you can customize to get change pointers (CP). This are entries in tables BDCP/BDCPS. Advantage: created only for specified fields, can be marked as 'read' -> you select all changes only once.

Have a look at WE81, BD50, BD52 BD22 and FM CHANGE_POINTERS_READ, CHANGE_POINTERS_STATUS_WRITE.

Regards,

Christian

Former Member
0 Kudos

You need to lookup table CDHDR (change header table) and then CDPOS (change item table)

From CDHDR select objectclas, objectid and changenr based on the criteria:

OBJECTCLAS = 'MATERIAL'

UDATE >= <GIVEN DATE>

This will give you all the materials that have been changed on or after the given date. Here the objectid is nothing but material number!

Now for all the selected entries, from table CDPOS select

records based on the criteria:

object clas = 'MATERIAL'

objectid = <VALUE FROM PREVIOUS SELECTION>

changenr = <VALUE FROM PREVIOUS SELECTION>

fname in {maktx,uom,...}

(HERE POPULATE FIELDNAME OF ALL THE REQUIRED FIELDS)

This will give the change records only for the fields of interest! You can also retrieve the old value and new value (if required)!

Former Member
0 Kudos

use tables CDHDR/CDPOS

Former Member
0 Kudos

Use CHANGEDOCUMENT_READ with the parameters others mentioned here. That will give you all the changes to a material and what field has changed and from which value to which value.

Srinivas

Former Member
0 Kudos

Hi Konarad,

"CHANGE DOCUMENTS" in SAP Terminology

1 The same thing which u are asking

we had developed here. Any change

in the material master will be detected

and a mail will be sent to the concerned

employee.

THIS WILL ALSO DETECT WHICH FILEDS HAVE CHANGED.

IT CAN ALSO GIVE, The Old Value, And The New Value.

2. This Mechanism is called CHANGE DOCUMENTS in

SAP Terminology

3. 2 Fuction Modules are Required.

(They will fetch necessary data from CDHDR,CDPOS)

CHANGEDOCUMENT_READ_HEADERS

CHANGEDOCUMENT_READ_POSITIONS

4. The First FM gives list of all

records ( with change no) which have changed.

5. Loop at the above and the second FM will

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

each record.

6. While using 1st Fm, give docclass as 'MATERIAL'.

BCOS

the concept of change documents is applicable

to other type of documents also (depends upon

customization)

HOPE THE ABOVE HELPS.

Regards,

Amit M.