Application Development and Automation 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: 
Read only

BOM explosion

Former Member
0 Likes
1,005

Hi All,

Can you tell me how to sort the component in BOM explosion.

Is there any FM present in SAP

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
649

Hi,

Please check this FM.

CS_BOM_EXPL_MAT_V2

CS_BOM_EXPLOSION

Regards,

Ferry Lianto

2 REPLIES 2
Read only

Former Member
0 Likes
650

Hi,

Please check this FM.

CS_BOM_EXPL_MAT_V2

CS_BOM_EXPLOSION

Regards,

Ferry Lianto

Read only

0 Likes
649

Hi Mike,

I have one Z Function Module.

check the code below.




FUNCTION ZBOM_GET_HIERARCHY.
*"----------------------------------------------------------------------
*"*"Global interface:
*"       TABLES
*"              BOM_RETURN STRUCTURE  ZMBOMDATA
*"----------------------------------------------------------------------

CLEAR HIER_TAB.
REFRESH HIER_TAB.

*Put contents of table sent to function(bom_return) into hier_tab
HIER_TAB[] = BOM_RETURN[].

*Clear out table to be returned from function, it will be built in
*hierarchy order
CLEAR BOM_RETURN.
REFRESH BOM_RETURN.

LEVEL = 1.

*Start at the top_level assembly
LOOP AT HIER_TAB
    WHERE TOP_LEVEL = 'X'.

*Move fields to table to be returned
    MOVE-CORRESPONDING HIER_TAB TO BOM_RETURN.
    BOM_RETURN-BOM_LEVEL = LEVEL.
    APPEND BOM_RETURN.

*Do not check any other type of item that is not stock
   IF HIER_TAB-POSTP NE 'L'.
       CONTINUE.
   ENDIF.

*Check to see if the component is also a parent part
    PERFORM GET_NEXT USING LEVEL
                           HIER_TAB-IDNRK.
ENDLOOP.



ENDFUNCTION.
*&---------------------------------------------------------------------*
*&      Form  GET_NEXT
*&---------------------------------------------------------------------*
*Checks to see if the component part is a parent part, if it is move   *
*the fields to the table to be returned from the function
*----------------------------------------------------------------------*
FORM GET_NEXT USING VALUE(LOCAL_LEVEL) LIKE LEVEL        "BOM level
                    VALUE(LOCAL_IDNRK) LIKE HIER_TAB-IDNRK.  "Component

*Check to see if the component is a parent
    READ TABLE HIER_TAB
          WITH KEY MATNR = LOCAL_IDNRK.

*If it is, increment the bom level and move the fields to the table to
*be returned from the function
    IF SY-SUBRC = 0.
        LOCAL_LEVEL = LOCAL_LEVEL + 1.

        LOOP AT HIER_TAB
              WHERE MATNR = LOCAL_IDNRK.

        MOVE-CORRESPONDING HIER_TAB TO BOM_RETURN.
        BOM_RETURN-BOM_LEVEL = LOCAL_LEVEL.
        APPEND BOM_RETURN.

*Do not check any other type of item than stock
        IF HIER_TAB-POSTP NE 'L'.
           CONTINUE.
        ENDIF.

*Check to see if the component part is a also a parent part
        PERFORM GET_NEXT USING LOCAL_LEVEL
                               BOM_RETURN-IDNRK.

        ENDLOOP.
    ENDIF.


ENDFORM.                    " GET_NEXT

<b>ZMBOMDATA Structure parameter is</b>

MATNR MATNR CHAR 18 0 Material Number

WERKS WERKS_D CHAR 4 0 Plant

STLAN STLAN CHAR 1 0 BOM Usage

STLNR STNUM CHAR 8 0 Bill of material

STLAL STLAL CHAR 2 0 Alternative BOM

STLTY STLTY CHAR 1 0 BOM category

IDNRK IDNRK CHAR 18 0 BOM component

BOM_LEVEL DOKAR CHAR 3 0 Document type

REVLV REVLV CHAR 2 0 Revision level

DOKNR DOKNR CHAR 25 0 Document number

DOKAR DOKAR CHAR 3 0 Document type

DOKVR DOKVR CHAR 2 0 Document version

POSTP POSTP CHAR 1 0 Item category (bill of material)

POSNR POSNR NUMC 6 0 Item number of the SD document

STLKN STLKN NUMC 8 0 BOM item node number

MENGE KMPMG QUAN 13 3 Component quantity

MEINS MEINS UNIT 3 0 Base Unit of Measure

DATUV DATUV DATS 8 0 Valid-From Date

DATUB DATUB DATS 8 0 Valid-to date

STVKN STVKN NUMC 8 0 Inherited node number of BOM item

LGORT LGORT_D CHAR 4 0 Storage location

TOP_LEVEL STLTY CHAR 1 0 BOM category

LKENZ LKENZ CHAR 1 0 Deletion Indicator

LTXSP LTXSP LANG 1 0 Language: The long text was stored in this language

POTX1 POTX1 CHAR 40 0 BOM item text (line 1)

POTX2 POTX2 CHAR 40 0 BOM item text (line 2)

STPOZ CIM_COUNT NUMC 8 0 Internal counter

ARBPL ARBPL CHAR 8 0 Work center

STLST STLST NUMC 2 0 BOM status

SORTF SORTP CHAR 10 0 Sort string

SORTF SORTP CHAR 10 0 Sort string<b></b>