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

BOM change dates

Former Member
0 Likes
1,031

Hello!

I'm writing a function that is searching for parts of a model in the BOM. I'm saving the result to buffer table, so I need to find all dates of BOM changes (at all levels). For example:

<i>01.06.2006</i> -> BOM created

<i>07.06.2006</i> -> material A added at level 4

<i>14.06.2006</i> -> material added at level 3

<i>26.07.2006</i> -> material deleted at level 1

<i>30.01.2007</i> -> material A replaced by B at level 4

We are using change numbers to keep the history...

I don't need to know what happend, I want to find out the dates of changes.

Is it possible to find out these dates quickly, without exploding the whole BOM?

ThanX!

(SAP 4.6B)

6 REPLIES 6
Read only

Clemenss
Active Contributor
0 Likes
892

Hi Donnie,

I think the changes are recorded in change documents tables CDHDR and CDPOS but I do not remember the object to look for. Try selection with table STKO; may show you change object.

Regards,

Clemens

Read only

Former Member
0 Likes
892

Thank you Clement!

Yes! That was one of my first ideas, but maybe I will get only the first level, and the last changes. I need to find out dates of <b>all changes at all levels</b>.

What do you think? Is it possible?

Read only

Former Member
0 Likes
892

Yes, CDHDR and CDPOS tables will have all the changes at all levels stored in them.... You just need to find out how to get those records.

Thanks

Read only

Former Member
0 Likes
892

Sorry! Maybe my question was wrong. I wrote 'change dates', but I mean 'validity dates'. Maybe I found a solution. Because I need all validity dates I will search for it in tables: MAST and STPO, so I can't workaround the checking of whole BOM. I will upload that function...

Anyway! Thank you guys!

Read only

Former Member
0 Likes
892

I finished that function. The main logic is this recursively called form. You should call this form by importing the highest level material:

CONSTANTS:

           c_stlan TYPE mast-stlan VALUE '1',    " BOM for production
           c_stlal TYPE mast-stlal VALUE '01',   " Default alternative
           c_stlal TYPE mast-stlal VALUE '01'.   " Default alternative



TYPES: BEGIN OF t_datuv_search,
         datuv LIKE stpo-datuv,
       END OF t_datuv_search.

TYPES: BEGIN OF t_datma_search,
         matnr LIKE mast-matnr,
         datuv LIKE stpo-datuv,
       END OF t_datma_search.


FORM get_dates USING matnr werks stlal.
  DATA: now TYPE t_datma_search OCCURS 20 WITH HEADER LINE.

  SELECT b~idnrk b~datuv
    FROM mast AS a JOIN stpo AS b
      ON b~stlnr EQ a~stlnr
    INTO TABLE now
   WHERE a~matnr EQ matnr
     AND a~werks EQ werks
     AND a~stlan EQ c_stlan
     AND a~stlal EQ stlal
     AND b~stlty EQ c_stlty.

  LOOP AT now.
    MOVE: now-datuv TO datuv_search-datuv.
    COLLECT datuv_search.
    PERFORM get_dates USING now-matnr werks c_stlal.
  ENDLOOP.

ENDFORM.

This form will fill the <b>datuv_search</b> table. This table will contain all change dates...

Read only

Former Member
0 Likes
892

Answered.