24.1.11

SAP Note 19006 - Deleting a variant BOM with history requirement

Symptom:

You cannot create a BOM for a material either with or without a change number.
If you attempt to create the BOM, the error message 29006 'Variant BOM already exists for this material/plant/usage' or the error message 29005 'BOM already exists for this material/plant/usage' appears.
If you attempt to display the (logically) deleted BOM (with the change number), the error message 29060 'BOM for material & & not valid on &' appears.

Cause and prerequisites

The BOM or the alternative/variant was created with a change number and then deleted with the same change number, that is, the BOM was only logically deleted, not physically, and is no longer valid.

Solution

To physically delete the logically deleted BOM or variant/alternative, run one of the two reports described below.
The reports should only be used if the BOM can no longer be displayed, that is, the error message 'BOM ... not valid ...' appears (see above), even though the Valid from date was reset (= entire period).
Otherwise, a BOM requiring a history can also be deleted physically (that is, without change number) via the normal transactions if the user has the relevant authorization (C_STUE_NOH).

    1. Report 1
    This report deletes
  • a simple BOM
  • all variants of a variant BOM
  • all alternatives of a multiple BOM
    2. Report 2
    This report can only be used if
  • ONE alternative is to be deleted from a multiple BOM with SEVERAL alternatives.
    If only one alternative exists, this must be deleted with Report 1.
  • ONE variant is to be deleted from a variant BOM with SEVERAL variants.
    If only one variant exists, this must be deleted with Report 1.
For both reports, the value to use for the parameter CON_STLTY (BOM category) and the relevant table are shown below:

BOM category Value Table
---------------------------------------------------
Document D DOST
Equipment E EQST
Sales order BOM K KDST
Material M MAST
Standard S STST
Functional location T TPST

The values of the parameter CONSTLNR (BOM number) and CONSTLAL (alternative BOM) can be determined using transaction SE16 from the table belonging to the BOM category. The variables in both reports should be given the determined values.

************************** Report 1 *********************************
* Caution: This report deletes ALL variants or ALL alternatives of a
* BOM

Report ZZBOMDL1


parameters: CONSTLNR like stko-stlnr default '00000000',
CONSTLTY like stko-stlty default ' '.

tables :
dost, "as of 3.0
eqst,
kdst, "as of 3.0
mast,
stko,
stas,
stpo,
stpu,
stst, "as of 3.0
tpst, "as of 3.0
stzu.

check CONSTLTY ne ' ' and
CONSTLNR ne '00000000'.

delete from stzu
where stlty eq CONSTLTY
and stlnr eq CONSTLNR.

case CONSTLTY.
when 'D'. "as of 3.0
delete from dost "as of 3.0
where stlnr eq CONSTLNR. "as of 3.0
when 'E'.
delete from eqst
where stlnr eq CONSTLNR.
when 'K'. "as of 3.0
delete from kdst "as of 3.0
where stlnr eq CONSTLNR. "as of 3.0
when 'M'.
delete from mast
where stlnr eq CONSTLNR.
when 'S'. "as of 3.0
delete from stst "as of 3.0
where stlnr eq CONSTLNR. "as of 3.0
when 'T'. "as of 3.0
delete from tpst "as of 3.0
where stlnr eq CONSTLNR. "as of 3.0
endcase.
delete from stko
where stlty eq CONSTLTY
and stlnr eq CONSTLNR.

delete from stas
where stlty eq CONSTLTY
and stlnr eq CONSTLNR.

delete from stpo
where stlty eq CONSTLTY
and stlnr eq CONSTLNR.

delete from stpu
where stlty eq CONSTLTY
and stlnr eq CONSTLNR.

*********************** End of Report 1 *******************************

************************** Report 2 **********************************

* If only one specific variant or alternative is to be deleted, the
* report should be set up as follows




Report ZZBOMDL2

parameters : CONSTLNR like stko-stlnr default '00000000',
CONSTLTY like stko-stlty default ' ',
CONSTLAL like stko-stlal default '00'.

tables : dost, "as of 3.0
eqst,
kdst, "as of 3.0
mast,
stas,
stst, "as of 3.0
tpst, "as of 3.0
stko.

case CONSTLTY.
when 'D'. "as of 3.0
delete from dost "as of 3.0
where stlnr = CONSTLNR "as of 3.0
and stlal = CONSTLAL. "as of 3.0
when 'E'.
delete from eqst
where stlnr = CONSTLNR
and stlal = CONSTLAL.
when 'K'. "as of 3.0
delete from kdst "as of 3.0
where stlnr = CONSTLNR "as of 3.0
and stlal = CONSTLAL. "as of 3.0
when 'M'.
delete from mast
where stlnr = CONSTLNR
and stlal = CONSTLAL.
when 'S'. "as of 3.0
delete from stst "as of 3.0
where stlnr = CONSTLNR "as of 3.0
and stlal = CONSTLAL. "as of 3.0
when 'T'. "as of 3.0
delete from tpst "as of 3.0
where stlnr = CONSTLNR "as of 3.0
and stlal = CONSTLAL. "as of 3.0
endcase.

delete from stko
where stlty eq CONSTLTY
and stlnr eq CONSTLNR
and stlal eq CONSTLAL.

delete from stas
where stlty eq CONSTLTY
and stlnr eq CONSTLNR
and stlal eq CONSTLAL.
************************* End of Report 2******************************

Additional key words

CS01, CS02, CS03
29005, 29006 29060, 29002
batch input, delete

1 comment: