Application Development 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: 

GET BOM FOR MATERIAL

Former Member
0 Kudos

Hello everybody.

i want a program to get all bom for raw and processed materials.

input:

a range of material, example material from 100005 to 100008

output.

all bom of material 100005 to 100008.

in se37 i found function

CP_BD_GET_BOM_FOR_MATERIAL

but i don't know how to use it.and whether can get requirement output.

help me.

thanks.

3 REPLIES 3

Former Member
0 Kudos

Hi

Use

call function 'CS_BOM_EXPL_MAT_V2'

exporting capid = application

datuv = date_of_explosion

mehrs = 'X'

mtnrv = material_number

stlal = alternative

stlan = usage

werks = plant

importing topmat = bom_header

tables matcat = assembly_tab

stb = item_tab

exceptions alt_not_found = 04

call_invalid = 08

material_not_found = 12

missing_authorization = 16

no_bom_found = 20

no_plant_data = 24

no_suitable_bom_found = 28.

You pass in the material number and get the assembly table of the exploded BOM.

Regards

Gareth

Former Member
0 Kudos

use this FM

CALL FUNCTION 'CS_BOM_EXPLOSION'

EXPORTING

capid = c_pp01

datuv = sy-datum

emeng = lw_bmeng

mtnrv = i_matnr

werks = i_werks

stlal = lw_stlal

mehrs = 'X'

TABLES

stbd = it_stbd

stbe = it_stbe

stbk = it_stbk

stbm = it_stbm

stbp = it_csxgen

stbt = it_stbt

EXCEPTIONS

alt_not_found = 1

call_invalid = 2

missing_authorization = 3

no_bom_found = 4

no_plant_data = 5

no_suitable_bom_found = 6

object_not_found = 7

conversion_error = 8

OTHERS = 9.

rewards if helpful

Former Member
0 Kudos

tables : mara,stpox.

data : ibom1 like stpox occurs 0 with header line,

ibom2 like stpox occurs 0 with header line,

imatnr like mara occurs 0 with header line.

select-options : s_matnr for mara-matnr.

select matnr into corresponding fields of table imatnr from mara where matnr in s_matnr.

loop at imatnr.

CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

EXPORTING

  • FTREL = ' '

  • ALEKZ = ' '

  • ALTVO = ' '

  • AUFSW = ' '

  • AUMGB = ' '

  • AUMNG = 0

  • AUSKZ = ' '

  • AMIND = ' '

  • BAGRP = ' '

  • BEIKZ = ' '

  • BESSL = ' '

  • BGIXO = ' '

  • BREMS = ' '

CAPID = 'PP01'

  • CHLST = ' '

  • COSPR = ' '

  • CUOBJ = 000000000000000

  • CUOVS = 0

  • CUOLS = ' '

DATUV = SY-DATUM

  • DELNL = ' '

  • DRLDT = ' '

  • EHNDL = ' '

  • EMENG = 0

  • ERSKZ = ' '

  • ERSSL = ' '

  • FBSTP = ' '

  • KNFBA = ' '

  • KSBVO = ' '

  • MBWLS = ' '

  • MKTLS = 'X'

  • MDMPS = ' '

MEHRS = 'X'

  • MKMAT = ' '

  • MMAPS = ' '

  • SALWW = ' '

  • SPLWW = ' '

  • MMORY = ' '

MTNRV = IMATNR-MATNR

  • NLINK = ' '

  • POSTP = ' '

  • RNDKZ = ' '

  • RVREL = ' '

  • SANFR = ' '

  • SANIN = ' '

  • SANKA = ' '

  • SANKO = ' '

  • SANVS = ' '

  • SCHGT = ' '

  • STKKZ = ' '

  • STLAL = ' '

  • STLAN = ' '

  • STPST = 0

  • SVWVO = 'X'

WERKS = '1000' " PLANT NO

  • NORVL = ' '

  • MDNOT = ' '

  • PANOT = ' '

  • QVERW = ' '

  • VERID = ' '

  • VRSVO = 'X'

  • IMPORTING

  • TOPMAT =

  • DSTST =

TABLES

STB = IBOM1

  • 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.

APPEND LINES OF IBOM1 TO IBOM2.

endloop.

LOOP AT IBOM2.

WRITE : / IBOM2-IDNRK.

ENDLOOP.

REGARDS

SHIBA DUTTA