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: 

bom of production order

Former Member
0 Kudos

hi sap experts, i am new in abap and have a question,can help me? i want to find the bom of a production order ,just bom of that operations that are confirmde, i use resb table but i have timed out errors.

22 REPLIES 22

former_member187748
Active Contributor
0 Kudos

Hi Izadi,

as paer as i know, you can have 2 alternate BOM for each material you have created, if you have created both of your BOM for the materials, you can use the following steps.

If you have not created any bom, then also you can go through SPRO menu as given below to create BOM for your materials.

Create Production Versions 01 and 02 and assign the alt BOM 1 for the PV 01 and 02 alt bom for PV 02.

Goto SPRO : Production -> Shop Floor Control -> Define Order type dependent paramters  ( Tcode : OPL8)  : Define the Production Version Slection either 1 for manual and 2 for automatic. (if you use automatic system will select the version based on the material master selection method )

Please see this link, which might help you

http://scn.sap.com/thread/3208124

former_member184569
Active Contributor
0 Kudos

Try tables STKO & STPO.

former_member187748
Active Contributor
0 Kudos

Hi,

these tables are useful for you in finding BOM

MAST, STKO, STPO, STAS, STZU


or you can also use this function module "CSAP_MAT_BOM_READ' for the same purpose.

Former Member
0 Kudos

hi and thanx for your reply.

but in non of these tables i dont have aufnr(production order from afko) and vornr(operation from afvc table) field .

actualy i want a report from components that you can see in component view in co03 transaction when you enter the production order, but just that operation that are confimed.

0 Kudos

Hello Mahdieh Izadi.

     It is incorrect to say BOM for a production order or operations.

     BOM will be only for a material.

     Operations will flow from routing attached to that material.

     For your understanding,

     Open the production order -> Master data -> Group (for operations)

                                                                       -> BOM    (for components).

    

              

Regards.

0 Kudos

Mahdieh Izadi,

     To fetch operations details:
     * Fetch AUFPL for the production order(AUFNR) from AFKO table.

     * Pass AUFPL to table AFVC table.

  

     To fetch components details:

     * Pass production order(AUFNR) and BWART = '261' to RESB table.

Regards.

0 Kudos

hi K.Arun Prabhu and

thanx a lot for your reply .

i do this  but i have a problem. i have timed out erro . you can see my code :

   SELECT RESB~BAUGR RESB~MATNR SUM( RESB~BDMNG ) AS BDMNG
        FROM RESB
        INTO CORRESPONDING FIELDS OF TABLE BO
        WHERE aufnr in ( SELECT afko~aufnr
                        FROM AFKO
                        JOIN AFVC ON AFKO~AUFPL EQ AFVC~AUFPL
                        JOIN JCDS ON JCDS~OBJNR EQ AFVC~OBJNR
                        WHERE UDATE IN DATE
                            and afko~aufnr in order
                            AND STAT  EQ 'I0009'
                            AND STEUS NE 'ZP04'
                            AND jcds~inact  EQ space )

              and  VORNR IN (
                        SELECT afvc~vornr
                        FROM AFVC
                        JOIN JCDS ON JCDS~OBJNR EQ AFVC~OBJNR
                        WHERE UDATE IN DATE
                            AND STAT  EQ 'I0009'
                            AND STEUS NE 'ZP04'
                            AND jcds~inact  EQ space  )
            GROUP BY BAUGR MATNR
            ORDER BY BAUGR MATNR
            %_HINTS ORACLE 'INDEX("MATNR AUFNR" "RESB~MAT")'.

0 Kudos

Hi Mahdieh,

Seems your query has lot of joins, aggregations etc. Can you please put the same in ST04 and analyse the performance to see if all the indexes are hit.

BR.

Former Member
0 Kudos

Try AFVV

Sijin_Chandran
Active Contributor
0 Kudos

Hello mahdieh ,

As mentioned by you and suggested here ,

RESB is the table for Finding the BOM components involved while Creating a Production Order ( CO01 ).

You just need to fine tune your SELECT statement accordingly.

And For the Confirmations made for these Orders ( CO11N) data is present in AUFM table ( same BWART eq 261 logic here also , 261 is the movement type for components involved while producing a good )

0 Kudos

thank sijin siji.

i get the confirmation date from jcds table and dont have problem about that.

0 Kudos

Actually I referred Confirmation Data not Date ,


And For the Confirmations made for these Orders ( CO11N) data is present in AUFM table ( same

For each Confirmations you make for an Order , Material Documents are generated which you can get from AUFM table , which gives you the Actual Components and Their quantities consumed during Confirmations.

0 Kudos

Sijin,

     AUFM table contains goods movements (261,101 etc.) data and not confirmations data. Production order confirmations will be in AFRU table.    

Regards.

0 Kudos

sorry , yes i got it.

but i dont want actual component consumed, i want component that is assigned and maybe not consumed.

0 Kudos

Mahdieh Izadi,

     To know those components which are not yet consumed, make use of KZEAR and ENMNG(Quantity withdrawn) fields of RESB table.

     For instance,

     select matnr bdmng enmng from RESB into table itab

          where aufnr  = PRODUCTION_ORDER

          and    bwart = '261'

          and    xloek = ' '             "Not deleted

          and    xwaok = 'X'          "Movement allowed

          and    kzear <> 'X''.       "Quantity not completely issued

     loop at itab where enmng is not initial.

          itab-bdmng = itab-bdmng - itab-enmng.

          modify itab TRANSPORTING bdmng.

     endloop.


     BDMNG will give you the quantity yet to be consumed.

Regards.

0 Kudos

For That RESB is the table ,

You just make your SELECT statement efficient .

0 Kudos

Agreed Arun ,

But for Each AFRU , the Components Consumed detail ( ACTUAL consumed , I have mentioned the same already ) is got through AUFM.

Reason being it contains the Actual Material Movement carried out during each Confirmations.

0 Kudos

Sijin,

     Actually they are two separate processes: goods issue and confirmation (to be more precise ) , that can be linked.    

Regards.

0 Kudos

Fine Arun I may be missing somewhere  ,

According to my understanding about this PP cycle .

CO01 is for Production Order ( AFKO , AFPO , RESB ( for the Material Component Reservation Doc. created ) ,

Which is Partly Confirmed ( using CO11N , table AFRU) and for each Confirmations carried out Material Movement is also generated in which Movement type of the good Produced is 101 and the Raw Materials i.e the Components (BOM usually ) issued is using Mvt type 261.

0 Kudos

Sijin,

     I am just referring to the point that each confirmation need not necessarily be configured to create a material document.

     In our organisation, goods issue to production order (261 movement) takes place first separately and confirmation happens when work in progress and when the work item gets over. Finally when quality gives UD, 101 movement will happen.

Regards.

arivazhagan_sivasamy
Active Contributor
0 Kudos

Hi Mahdieh,

You can use    'BAPI_PRODORD_GET_DETAIL'.

   CALL FUNCTION 'BAPI_PRODORD_GET_DETAIL'
      EXPORTING
        NUMBER        = TEMP-AUFNR
        ORDER_OBJECTS = OROB
      TABLES
        OPERATION     = OPER
        COMPONENT     = COMP.

In comp, you will get BOM details.

Arivazhagan S

Former Member
0 Kudos

i change my code in this shape:

  

  SELECT afko~aufnr afvc~vornr
     INTO CORRESPONDING FIELDS OF TABLE inf
     FROM AFKO
     JOIN AFVC ON AFKO~AUFPL EQ AFVC~AUFPL
     JOIN JCDS ON JCDS~OBJNR EQ AFVC~OBJNR
           WHERE UDATE IN DATE
              and afko~aufnr in order
              AND STAT  EQ 'I0009'
              AND STEUS NE 'ZP04'
              AND jcds~inact  EQ space.



        loop at inf.

         SELECT RESB~BAUGR RESB~MATNR SUM( RESB~BDMNG ) AS BDMNG
                FROM RESB
                INTO TABLE BO
                WHERE aufnr eq inf-aufnr
                    and  VORNR eq inf-vornr
                    GROUP BY BAUGR MATNR
                    ORDER BY BAUGR MATNR
                    %_HINTS ORACLE 'INDEX("MATNR AUFNR" "RESB~MAT")'.
        READ TABLE  BO INDEX 1.

          IF SY-SUBRC EQ 0.
             move-corresponding bo to total-bo.
             append total-bo to BORES.
          endif.

        endloop.

now how can i group by my internal table BORES on BAUGR MATNR?