cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-level BOM explosion using CS_BOM_EXPL_MAT_V2

Former Member
0 Kudos
5,670

Hi All,

I would like to know, if anyone has used the function module 'CS_BOM_EXPL_MAT_V2' to prepare a report to read multi-level BOM just like CS12. If anyone has, can you please let me know how we can read the individual materials in the BOM from this FM.

Hope my question is clear, await inputs.

Vivek

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vivek,

We use CS_BOM_EXPL_KND_V1 this function module.

Do u want code for that function ??

Regards,

Vishal

Former Member
0 Kudos

Mr. Vishal,

It would be nice if you can share it. I will test the same & keep you updated if it resolves my problem.

Vivek

Former Member
0 Kudos

Hi vivek,

We use this code to restrict the BOM line item for particular movements. C if that can help u out.

CALL FUNCTION 'CS_BOM_EXPL_KND_V1'

EXPORTING

capid = ''

datuv = sy-datum

emeng = 1

  • mehrs = 'X'

mtnrv = i_mseg-matnr

stlal = '1'

stlan = '1'

stpst = 0

svwvo = 'X'

werks = i_mseg-werks

vbeln = aufk-kdauf

vbpos = aufk-kdpos

  • VERID = ' '

vrsvo = 'X'

  • IMPORTING

  • TOPMAT =

  • DSTST =

TABLES

stb = ZStb

  • 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

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

SORT zstb BY mtart.

LOOP AT zstb.

IF zstb-mtart = 'Material type ' OR zstb-mtart = 'Material type ' .

ELSE.

DELETE zstb .

ENDIF.

ENDLOOP.

CLEAR: v_menge, v_matnr, v_bwart, vv_menge, vvv_menge, zstb.

LOOP AT zstb.

SELECT menge matnr bwart

INTO (v_menge,v_matnr,v_bwart)

FROM aufm

WHERE aufnr = i_mseg-aufnr

AND werks = i_mseg-werks

AND matnr = zstb-idnrk

AND ( bwart = '261' OR bwart = '262' ).

  • and meins = 'FT2'.

  • LOOP AT zstb.

SELECT SINGLE matnr INTO vv_matnr FROM mara WHERE matnr = v_matnr

AND mtart = zstb-mtart.

IF sy-subrc = 0.

CASE v_bwart.

WHEN '261' .

vv_menge = vv_menge + v_menge.

WHEN '262' .

vvv_menge = vvv_menge + v_menge.

ENDCASE.

ENDIF.

  • ENDLOOP.

ENDSELECT.

CLEAR vf_menge.

vf_menge = vv_menge - vvv_menge.

CLEAR vv_menge.

CLEAR vvv_menge.

Regards,

Vishal

Former Member
0 Kudos

Mr. Vishal,

Thanks for your inputs, will check & revert back if this solves my problem.

Vivek

Former Member
0 Kudos

Mr. Vishal,

I tested the Function module mentioned by you in SE37, to see what output i get. But the system prompts 'CALL INVALID'.

I tested the function with below parameters:

CAPID = PP01

DATUV = 24.12.2007

MEHRS = X

MTNRV = (The assembly number)

STLAL = 01

WERKS = 3000

May i know what could be the reason?

Vivek

Former Member
0 Kudos

Hi vivek,

M sorry the function module i told u requires Sales order number.Thats y its giving error.

I just tested CS_BOM_EXPL_MAT_V2 with same input n its working.

try above n revert me if u face any problem.

Regards,

Vishal

Former Member
0 Kudos

Hi Vishal,

Thanks for the clarification. I am able to read the BOM in my program, but facing a bug in the program, as the program execution does not stop after reading the BOM once, it is going into an infinite loop, where it is re-reading the BOM. I am trying to figure out how i can ensure that the program reads the BOM once & displays it & not go into a infinite loop.

Any inputs from your end for this?

Vivek

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Vivek ,

capid = 'PI01'

datuv = sy-datum

emeng = 1

  • mehrs = 'X'

mktls = 'X'

mtnrv = Materials number

stlal = '1'

stlan = '1'

stpst = 0

svwvo = 'X'

werks = Plant

Through this input i m able to get output.

Tell me what inputs r u giving.

Vishal

Former Member
0 Kudos

Hi Vishal,

The input parameters are same, except for

MEHRS = X (as i want to read multi-level)

CAPID = PP01

The input parameters are ok, but the problem i am facing is, the program is re-reading the BOM. I want it to read once, display & stop. Not quite sure how i can achieve it.

Vivek

Former Member
0 Kudos

Hi vivek,

Maybe your Bom is recursive.That couldbe a one of the reason for nonstop running

Please check

Regards

Pradeep

Former Member
0 Kudos

Mr. Pradeep,

Thanks for the inputs, but the BOM i am checking for is not recurssive. Actually just for test purpose, i am using a BOM with 2 materials. My infoset, reads the BOM correctly, but after reading both the material, it loops back to this section & the program continues to loop.

Note: Was able to trace the reason for this error & managed to execute the program, will post my problem in ABAP forum as the program instead of showing all the materials is only showing one material, i.e. the material field is over written each time with the new material in the multi-level BOM.

Thanks to Mr. Vishal & Mr. Pradeep for your inputs.

Regards,

Vivek

Edited by: Vivek on Dec 25, 2007 4:29 PM

Former Member
0 Kudos

Hi Vivek,

That may be coz of multi level explosion.U can define explosion level .May be that can help u .

Regards,

Vishal