01-09-2014 5:08 AM
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.
01-09-2014 5:16 AM
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
01-09-2014 5:31 AM
01-09-2014 5:37 AM
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.
01-09-2014 5:53 AM
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.
01-09-2014 6:15 AM
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.
01-09-2014 6:19 AM
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.
01-09-2014 6:28 AM
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")'.
01-09-2014 7:06 AM
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.
01-09-2014 6:27 AM
01-09-2014 7:03 AM
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 )
01-09-2014 7:27 AM
thank sijin siji.
i get the confirmation date from jcds table and dont have problem about that.
01-09-2014 7:37 AM
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.
01-09-2014 7:45 AM
Sijin,
AUFM table contains goods movements (261,101 etc.) data and not confirmations data. Production order confirmations will be in AFRU table.
Regards.
01-09-2014 7:50 AM
sorry , yes i got it.
but i dont want actual component consumed, i want component that is assigned and maybe not consumed.
01-09-2014 8:23 AM
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.
01-09-2014 8:38 AM
For That RESB is the table ,
You just make your SELECT statement efficient .
01-09-2014 8:39 AM
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.
01-09-2014 8:52 AM
Sijin,
Actually they are two separate processes: goods issue and confirmation (to be more precise ) , that can be linked.
Regards.
01-09-2014 9:13 AM
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.
01-10-2014 9:36 AM
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.
01-09-2014 7:51 AM
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
01-09-2014 7:53 AM
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?