cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the CR number to a material change document

matthias_fischer
Explorer
0 Kudos

Is it possible to get the CR number to a material change document which was created from SAP MDG.

If we look at the change documents of an existing material in the active area (transaction MM04) we can see a couple of change documents from the classical MM-transactions (MM01, MM02) and couple from MDG (transaction MM01MDG, MM02MDG).

Is it possible to get at least the CR number to those change documents from MDG programmatically ?

For example via a function module which provides all CR numbers relating to a material number.

Kind regards, Matthias

Accepted Solutions (0)

Answers (3)

Answers (3)

0 Kudos

Change your logic accordingly, below logic is for BP model.

DATA : LR_MODEL TYPE REF TO IF_USMD_MODEL,
LT_ENT TYPE USMD_T_VALUE,
LS_ENT TYPE USMD_S_VALUE,
LO_USMD_CHG_DOC TYPE REF TO CL_USMD_MDF_CHANGE_DOCUMENT.

CALL METHOD CL_USMD_MODEL=>GET_INSTANCE
EXPORTING
I_USMD_MODEL = 'BP'
IMPORTING
EO_INSTANCE = LR_MODEL
ET_MESSAGE = DATA(LT_MSG).

CALL METHOD CL_USMD_MDF_CHANGE_DOCUMENT=>GET_INSTANCE
RECEIVING
EO_INSTANCE = LO_USMD_CHG_DOC.

LS_ENT-FIELDNAME = 'BP_HEADER'.
LS_ENT-VALUE = '23'.
APPEND LS_ENT TO LT_ENT.

CALL METHOD LO_USMD_CHG_DOC->READ_DOCUMENT_HEADER
EXPORTING
* IT_CREQUEST =
I_ENTITY = 'BP_HEADER'
IT_ENTITY_VALUE = LT_ENT
IO_MODEL = LR_MODEL
IMPORTING
ET_DOCUMENT_HEADER = DATA(LT_HEADER).

raghu3
Contributor
0 Kudos

Hi

To get CR numbers relating to a material number , you could check table usmd1213 table.

You could look at this class CL_USMD_MDF_CHANGE_DOCUMENT as well for your requirements

Regards,

Raghu

matthias_fischer
Explorer
0 Kudos

Hi Raghuram,

the usmd1213 contains only the technical key. How to get the corresponding material number?

The generated staging tables seems to contain only the materials which are still part of a pending CR.

But we are especially interested in those changes which are already activated.

Kind regards, Matthias

Former Member
0 Kudos

Hi Matthias,

I guess not straight forward.

Get the Technical Key (USMDKMMMATERIAL) from your Generated table (Staging Table) for Material by passing your Material number(/1MD/MMMATERIAL).

Then pass this Technical Key to Change Document Header table CDHDR as shown below:

Object value holds CR number as marked below:

matthias_fischer
Explorer
0 Kudos

Hi MDG User,

the staging table seems to contain only the materials which are still part of a pending CR.

But we are especially interested in those changes which are already activated.

Kind regards, Matthias

Former Member
0 Kudos

Hi Matthias,

Run report USMD_DATA_MODEL and for MM Data Model and Material Entity Type you could find a Mapping generated table. This holds mapping between Technical key and corresponding material number.

This should help you.