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 tables

Former Member
0 Likes
1,573

hi from sales i taken material number, and i put that material number in trcode : cs12 i will get the purchase order material data , in wish table this was stored.

can u help me.

search before further posting

hi from sales i taken material number, and i put that material number in trcode : cs12 i will get the purchase order material data , in wish table this was stored.

can u help me.

search before further posting

8 REPLIES 8
Read only

Former Member
0 Likes
1,418

Hi,

Check tables : STKO and STPO.

Check FM: CSAP_MAT_BOM_READ

Thanks & Regards,

Navneeth K.

Read only

former_member125931
Active Participant
0 Likes
1,418

Hi,

Check these tables .

KONV, OIC_KONV, JKONV, COMPHDR, AFKO, VSAFKO_CN

Read only

Former Member
0 Likes
1,418

STPO BOM Item Details

STPU BOM Sub Items (designators)

STKO BOM Header Details

MAST BOM Group to Material

Read only

Former Member
0 Likes
1,418

Hi ,

For Fetching the BOM Details you can go like this which would fetch you the BOM DETAILS ...

Your First Selection is From AFKO which is the Production order header table ... From Afko you will get the following fields

AFKO-PLNBEZ

AFKO-STLNR

Then go to MAST from the details of AFKO .

In MAST you have to pass the MATNR AND WERKS AND STLAN AND STLNR

STLAN will give you the Bom is of which kind whether is a Production Bom or Sales Bom or its a Universal Bom . 1 is for Production Bom and 5 is for Sales Bom....

Then Goto STPO from these details from MAST ..

You will get the BOM Components ....

Hope this will help you

TABLES OF BOM :

STPO BOM Item Details

STPU BOM Sub Items (designators)

STKO BOM Header Details

MAST BOM Group to Material

Regards

Shankar

Read only

Former Member
0 Likes
1,418

Hi,

Finding table name and field name is not a big problem just press f1 on the field and select technical settings there you will get the table name and fieldname where that particular field is stored..

Thanks,

'ThiruKumaran. R

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,418


This is Fm code...Make necessary modifications and use it.
This will give you the multilevel bom....without Qty...Add the qty logic in the routine get_below_comp 


TYPES:BEGIN OF ty_push,
      matnr TYPE mara-matnr,
      END OF ty_push.
TYPES:BEGIN OF ty_store,
      pmatnr TYPE mara-matnr,
      cmatnr TYPE mara-matnr,
      END OF ty_store.
TYPES:BEGIN OF ty_push2,
      pmatnr TYPE mara-matnr,
      cmatnr TYPE mara-matnr,
      pmaktx TYPE makt-maktx,
      cmaktx TYPE makt-maktx,
      END OF ty_push2.

DATA:t_push        TYPE STANDARD TABLE OF ty_push    INITIAL SIZE 0.
DATA:t_push_temp   TYPE STANDARD TABLE OF ty_push    INITIAL SIZE 0.
DATA:t_sb_push     TYPE STANDARD TABLE OF ty_push2   INITIAL SIZE 0.
DATA:t_makt        TYPE STANDARD TABLE OF makt       INITIAL SIZE 0.
DATA:t_stpo        TYPE STANDARD TABLE OF stpo_api02 INITIAL SIZE 0.
DATA:T_STPU	   TYPE STANDARD TABLE OF STPU_API01 INITIAL SIZE 0.

DATA:wa_matnr   TYPE ty_push.
DATA:wa_push    TYPE ty_push.
DATA:wa_tmp     TYPE ty_push.
DATA:wa_sb_push TYPE ty_push2.
DATA:wa_makt    TYPE makt.
DATA:wa_stpo    TYPE stpo_api02.
DATA:wa_return  TYPE bapireturn1.
data:wa_stpu    type STPU_API01.


DATA:g_plant TYPE marc-werks.
DATA:g_usage TYPE stlan.
data:g_lines type sy-tfill.



*Initializle Global itabs and work areas.
  PERFORM   init_globals.

  MOVE   plant       TO g_plant.
  MOVE   bom_usage   TO g_usage.

*Select Parts from Masters
  SELECT mara~matnr   INTO wa_matnr
         FROM mara INNER JOIN marc
         ON mara~matnr EQ marc~matnr
         WHERE  matnr = 'Enter your material no here'
	 AND mara~mtart   EQ 'FERT'  "Finished Goods
         AND mara~lvorm     EQ space     "Deletion Indicator
         AND marc~werks     EQ g_plant   "Plant Data
         AND marc~lvorm     EQ space.    "Deletion Indicator

    CHECK sy-subrc   EQ 0.

    MOVE   wa_matnr-matnr   TO wa_push-matnr.
    APPEND   wa_push   TO t_push.
*Explode Bill of Material matrix
    PERFORM   get_below_comp.
  ENDSELECT.

  IF  t_sb_push[]   IS NOT INITIAL.
*Get Parent and Child Texts
    PERFORM   get_material_texts.
    IF t_makt[]   IS NOT INITIAL.
      SORT t_makt[]   BY matnr ASCENDING.
      LOOP AT   t_sb_push[] INTO wa_sb_push WHERE pmaktx EQ space.
        READ TABLE   t_makt[] INTO wa_makt WITH KEY matnr = wa_sb_push-pmatnr
                                         BINARY SEARCH
                                         TRANSPORTING maktx.
        CHECK   sy-subrc EQ 0.
        MOVE wa_makt-maktx   TO   wa_sb_push-pmaktx.
        MODIFY   t_sb_push[] FROM   wa_sb_push
                             TRANSPORTING   pmaktx
                                WHERE   pmatnr EQ   wa_sb_push-pmatnr.
        CLEAR wa_sb_push.
      ENDLOOP.
      LOOP AT t_sb_push[]   INTO wa_sb_push   WHERE cmaktx EQ space.
        READ TABLE t_makt[] INTO wa_makt   WITH KEY matnr = wa_sb_push-cmatnr
                                                BINARY SEARCH
                                                TRANSPORTING maktx.
        CHECK sy-subrc EQ 0.
        MOVE   wa_makt-maktx   TO wa_sb_push-cmaktx.
        MODIFY   t_sb_push[]   FROM wa_sb_push
                           TRANSPORTING cmaktx
                                WHERE cmatnr EQ wa_sb_push-cmatnr.
        CLEAR wa_sb_push.
      ENDLOOP.

    ENDIF.

    SORT t_sb_push[] BY pmatnr ASCENDING.


****t_sb_push[] holds the data

***********************************************************************************

form INIT_GLOBALS .

REFRESH: T_PUSH,
         T_PUSH_TEMP,
         T_SB_PUSH,
         T_MAKT,
         T_STPO.
CLEAR:   wa_matnr,
         WA_PUSH,
         WA_TMP,
         WA_SB_PUSH,
         WA_MAKT,
         WA_STPO,
         G_PLANT,
         G_USAGE.
endform.  

FORM get_material_texts .

  SELECT * FROM makt INTO TABLE t_makt  FOR ALL ENTRIES IN
  t_sb_push[] WHERE matnr = t_sb_push-pmatnr.

  SELECT * FROM makt APPENDING TABLE t_makt  FOR ALL ENTRIES IN
  t_sb_push[] WHERE matnr = t_sb_push-cmatnr.

ENDFORM.                    " GET_MATERIAL_TEXTS


FORM get_below_comp .

  DESCRIBE TABLE t_push[] lines g_lines.
  IF g_lines EQ 0.
    EXIT.
  ENDIF.

  LOOP AT t_push[] INTO wa_push.

    CALL FUNCTION 'CSAP_MAT_BOM_READ'
      EXPORTING
        material  = wa_push-matnr
        plant     = g_plant
        bom_usage = g_usage
      TABLES
        t_stpo    = t_stpo
        t_stpu    = t_stpu
      EXCEPTIONS
        error     = 1
        OTHERS    = 2.

    IF t_stpo[] IS NOT INITIAL.

      LOOP AT t_stpo INTO wa_stpo.

        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = wa_push-matnr
          IMPORTING
            output = wa_sb_push-pmatnr.

        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
          EXPORTING
            input  = wa_stpo-component
          IMPORTING
            output = wa_sb_push-cmatnr.

        APPEND wa_sb_push TO t_sb_push.

        MOVE wa_stpo-component TO wa_tmp-matnr.

        APPEND wa_tmp TO t_push_temp[].

      ENDLOOP.

      REFRESH t_stpo[].

    ENDIF.

  ENDLOOP.

  t_push[] = t_push_temp[].

  REFRESH t_push_temp[].

  PERFORM get_below_comp.                   "Recursive Call

ENDFORM.                    " GET_BELOW_COMP


Read only

Former Member
0 Likes
1,418

Hi,

You could use the standard transaction CAVC_TEST. There you would get all the Function modules related to BOM.

Thanks

Nidhi

Read only

Former Member
0 Likes
1,418

my qustion is answered thanks to all