Skip to Content
avatar image
Former Member

how to get BOM Components using ABAP Code?

Hi anybody,

I want download Bom components with level and quantity of particular material using ABAP Code. how do i Download?

Is there any Function module or BAPI?

anybody please tell me.

Thanks

Regards,

S.Muthu,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 24, 2008 at 08:50 AM

    Hi,

    Use the FM and then use GUI_DOWNLOAD.

    Data  P_CAPID LIKE TC04-CAPID VALUE 'PP01'.
    
        CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'
              EXPORTING
    *         FTREL                 = ' '
    *         ALTVO                 = ' '
    *         AUFSW                 = ' '
    *         AUMGB                 = ' '
    *         AUMNG                 = 0
    *         AUSKZ                 = ' '
    *         AMIND                 = ' '
    *         BAGRP                 = ' '
    *         BEIKZ                 = ' '
    *         BESSL                 = ' '
    *         BGIXO                 = ' '
    *         BREMS                 = ' '
    * modified by Ajay
                 BREMS                 = ' '
                   CAPID                 = P_CAPID   "Production Order.
    *         COSPR                 = ' '
    *         CUOBJ                 = 000000000000000
    *         CUOLS                 = ' '
                   DATUV                 = SY-DATUM
    *         DELNL                 = ' '
    *         EHNDL                 = ' '
    *         EMENG                 = 0
    *         ERSKZ                 = ' '
    *         ERSSL                 = ' '
    *         FBSTP                 = ' '
    *         MBWLS                 = ' '
                   MKTLS                 = ' '
    *         MDMPS                 = ' '
                   MEHRS                 = 'X'
    *         MKMAT                 = ' '
    *         MMAPS                 = ' '
                   MMORY                 = '1'
    *           mtnrv                 = mmatnr                                  MTNRV                 = MATNR  
    *         POSTP                 = ' '
    *         RNDKZ                 = ' '
    *         RVREL                 = ' '
    *         SANFR                 = ' '
    *         SANIN                 = ' '
    *         SANKA                 = ' '
    *         SANKO                 = ' '
    *         SANVS                 = ' '
    *         SCHGT                 = ' '
    *         STKKZ                 = ' '
    *         STLAL                 = ' '
    *         STLAN                 = ' '
                   WERKS                 = WERKS    " Plant
    *         MDNOT                 = ' '
    *         PANOT                 = ' '
    *         VERID                 = ' '
    *    IMPORTING
    *         TOPMAT                =
    *         DSTST                 =
              TABLES
                   STB                   = IT_STB2
                  MATCAT                 = IT_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
                   OTHERS                = 8.

    Regards,

    Balakumar .G.

    Reward points if helpful.

    Edited by: BALAKUMAR GANESAN on Mar 24, 2008 9:51 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 24, 2008 at 08:56 AM

    HI .

    Try this FM,

    'CS_BOM_EXPL_MAT_V2'

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 26, 2008 at 12:22 PM

    Hi

    U can get the BOM components using the below function module.

    Here the main tables for the BOM is

    MAST

    STKO

    STPO

    From the MAST table u can get the plant & material list

    from the STKO u can get the quantity of the product & uom

    By passing the MAST data to the function module , u can get the components for each product.

    CALL FUNCTION 'CSAP_MAT_BOM_READ'

    EXPORTING

    material = wa_mast-matnr

    plant = wa_mast-werks

    bom_usage = '1'

    alternative = wa_mast-stlal

    valid_from = v_datum

    valid_to = v_datum

    TABLES

    t_stpo = it_stpo

    EXCEPTIONS

    error = 1

    OTHERS = 2.

    Regards

    Lakshmi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Mar 26, 2008 at 12:29 PM

    Hi,

    Use the following function module,

    CALL FUNCTION 'CS_BOM_EXPL_MAT_V2'

    EXPORTING

    CAPID = 'PP01'

    DATUV = SY-DATUM

    MKTLS = 'X'

    MEHRS = 'X'

    MMORY = '1'

    MTNRV = MTNRV "'PartNumber

    STLAL = STLALTAB-STLAL

    WERKS = WERKS

    TABLES

    STB = STPOX[]

    MATCAT = CSCMAT[]

    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

    OTHERS = 8.

    Regards,

    Sankar.

    Add comment
    10|10000 characters needed characters exceeded