Archived discussions are read-only. Learn more about SAP Q&A

How to use CS_BOM_EXPL_MAT_V2 to get correct quantity of component?

Hi,

I am getting an issue with my program. I am using CS_BOM_EXPL_MAT_V2 to get the BOMs of a material. For example I have a material MAT1 that has the ff. BOM explosion.

MAT1

- COMP1 with Qty 2

- COMP2 with Qty 1

- COMP3 with Qty 1

And then, for component COMP1, it also has sub-components:

COMP1

- SUBCOMP1 with Qty 1

- SUBCOMP2 with Qty 1

So what I am expecting in my program, using CS_BOM_EXPL_MAT_V2, is to have the report to have a quantity of SUBCOMP1 = 2 and SUBCOMP2 = 2 (because MAT1 uses 2 quantity of COMP1). But what I am getting is SUBCOMP1 = 1 qty and SUBCOMP2 = 1 qty because I think that it is only considering the BOM of COMP1 and the quantity of COMP1 is not taken into account.

When running transaction CS12, the output is correct (SUBCOMP1 = 2, SUBCOMP2 = 2) for material MAT1.

So, how do I make CS_BOM_EXPL_MAT_V2 work so that it will respect the count of the component, in this case COMP1 with Qty 2, and cascade the value to the sub-components, in this case SUBCOMP1 and SUBCOMP2, and multiply it so it will return the correct quantity, in this case both sub-components should have Qty 2 as in transaction CS12?

If this is not possible with FM CS_BOM_EXPL_MAT_V2, please suggest other ways to achieve this.

Tags:
replied

Hello,

I think that you must set multilevel indicator. Take a look at the following code and see if this can help you.

FORM EXPLODE_BOM  USINGU_DATE
                       U_MATNR
                       U_MENGE
                       U_WERKS
                       U_MULTI
            CHANGING   C_SUCCESS.

  CLEAR : C_SUCCESS.

  CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING
*FTREL                   = ' '
*ALEKZ                   = ' '
*ALTVO                   = ' '
*AUFSW                   = ' '
  AUMGB                   = 'X'
*AUMNG                   = 0
  AUSKZ                   = ' '
*AMIND                   = ' '
*BAGRP                   = ' '
*BEIKZ                   = ' '
*BESSL                   = ' '
*BGIXO                   = ' '
*BREMS                   = ' '
  CAPID                   = 'PP01'
*CHLST                   = ' '
*COSPR                   = ' '
*CUOBJ                   = 000000000000000
*CUOVS                   = 0
*CUOLS                   = ' '
  DATUV                   = U_DATE
*DELNL                   = ' '
*DRLDT                   = ' '
*EHNDL                   = ' '
*EMENG                   = 0
*ERSKZ                   = ' '
*ERSSL                   = ' '
*FBSTP                   = ' '
*KNFBA                   = ' '
*KSBVO                   = ' '
*MBWLS                   = ' '
*MKTLS                   = 'X'
*MDMPS                   = ' '
  MEHRS                   = U_MULTI
*MKMAT                   = ' '
*MMAPS                   = ' '
*SALWW                   = ' '
*SPLWW                   = ' '
*MMORY                   = ' '
  MTNRV                   = U_MATNR
*NLINK                   = ' '
*POSTP                   = ' '
*RNDKZ                   = ' '
*RVREL                   = ' '
*SANFR                   = ' '
*SANIN                   = ' '
*SANKA                   = ' '
*SANKO                   = ' '
*SANVS                   = ' '
*SCHGT                   = ' '
*STKKZ                   = ' '
*STLAL                   = '1'
*STLAN                   = '1'
  STPST                   = 0
*SVWVO                   = 'X'
  WERKS                   = U_WERKS
*NORVL                   = ' '
*MDNOT                   = ' '
*PANOT                   = ' '
*QVERW                   = ' '
*VERID                   = ' '
*VRSVO                   = 'X'

*  IMPORTING

*TOPMAT                  =
*DSTST                   =
TABLES
  STB                     = BOM_EXPL
*MATCAT                  =

   EXCEPTIONS

ALT_NOT_FOUND           = 1
CALL_INVALID            = 2
MATERIAL_NOT_FOUND      = 3
MISSING_AUTHORIZATION   = 4
NO_BOM_FOUND            = 5
NO_PLANT_DATA           = 6
NO_SUITABLE_BOM_FOUND   = 7
CONVERSION_ERROR        = 8
OTHERS                  = 9

Regards.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question