Skip to Content

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

Bom Explosion

Hi all ,

i am trying to get the sub components of a single finished material using FM CS_BOM_EXPLOSION.

But i am getting error , pls let know where the error is ....

Here is the code .......

&----


*& Report ZBOM_EXPLOSION

*&

&----


*&

*&

&----


REPORT ZBOM_EXPLOSION.

*************STRUCTURE OF CSTMAT(IMPORTING PARAMETER)**********

TYPES : S_CSTMAT TYPE STANDARD TABLE OF CSTMAT.

*DATA : L_CSTMAT TYPE S_CSTMAT.

DATA : L_CSTMAT TYPE S_CSTMAT.

***************STRUCTURE OF TABLES pARAMETER )****

TYPES : S_CSXDOC TYPE STANDARD TABLE OF CSXDOC, " STBD

S_CSXEQUI TYPE STANDARD TABLE OF CSXEQUI, " STBE

S_CSXKLA TYPE STANDARD TABLE OF CSXKLA, "STBK

S_CSXMAT TYPE STANDARD TABLE OF CSXMAT , " STBM

S_CSXGEN TYPE STANDARD TABLE OF CSXGEN, "STBP

S_CSXTPL TYPE STANDARD TABLE OF CSXTPL."STBT

DATA : L_CSXDOC TYPE S_CSXDOC, " Addition to the item collective table (document data)

L_CSXEQUI TYPE S_CSXEQUI, "Addition to the item collective table (equi data)

L_CSXKLA TYPE S_CSXKLA, " Supplement to collective item table (class data)

L_CSXMAT TYPE S_CSXMAT, " Addition to the item collective table (material data)

L_CSXGEN TYPE S_CSXGEN, "Item collective table

L_CSXTPL TYPE S_CSXTPL. " Supplement to collective item table (functional location data)

DATA : WA_CLASS TYPE S_CSXKLA,

WA_MAT TYPE CSTMAT .

********EXPORTING PARAMETERS ************************

PARAMETERS : P_CAPID TYPE TC04-CAPID , " APLLICATION

  • P_MEHRS TYPE CSDATA-XFELD , " MATERIAL EXPLOSION

P_MTNRV TYPE MARA-MATNR, " MATERIAL

  • STLAL TYPE STKO-STLAL, " ALTERNATIVE BOM

P_WERKS TYPE MARC-WERKS. " PLANT

  • P_VERID TYPE MKAL-VERID. " Production version (global)_

*SELECT-OPTIONS : L_CAPID FOR CAPID,

  • L_MEHRS FOR MEHRS,

  • L_MTNRV FOR

*******FUNCTION MODULE EXPORTING PARAMETERS**********

DATA : L_MATNR TYPE MATNR , " MATERIAL NUMBER

L_VERID TYPE VERID , " PRODUCTION VERSION

L_WERKS TYPE WERKS_D, "PALNT

L_STLNR TYPE STNUM . "BILL OF MATERIAL

INITIALIZATION .

AT SELECTION-SCREEN .

*******

START-OF-SELECTION .

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = P_MTNRV

IMPORTING

OUTPUT = P_MTNRV.

.

CALL FUNCTION 'CS_BOM_EXPLOSION'

EXPORTING

CAPID = 'PP01'

MEHRS = 'X'

MTNRV = P_MTNRV

  • STLAL = ' '

WERKS = P_WERKS

  • MDNOT = ' '

  • PANOT = ' '

  • QVERW = ' '

  • VBELN = ' '

  • VBPOS = 0

  • VERID = ' '

  • VRSVO = 'X'

IMPORTING

  • TOPEQUI =

TOPMAT = L_CSTMAT

  • TOPTPL =

  • DSTST =

TABLES

stbd = L_CSXDOC

stbe = L_CSXEQUI

stbk = L_CSXKLA

stbm = L_CSXMAT

stbp = L_CSXGEN

stbt = L_CSXTPL.

  • 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

.

IF sy-subrc <> 0.

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

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

ENDIF.

LOOP AT L_CSTMAT INTO WA_MAT.

WRITE WA_MAT-MATNR.

ENDLOOP.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question