Operation wise cost in Work Order – Without LOG_EAM_OLC
Objective :
To have a report which can show us detailed information on operation level cost in a work order with details like material cost, labor cost etc.
Case 1 : Business function LOG_EAM_OLC ( If you are EHP5 & above)
In ECC 6.0 EHP 5 & above it is available as a standard functionality. You just need to activate business function LOG_EAM_OLC. Upon activating this you will be able to see operation level costing on work order screen under COST tab. Some of the useful links are give below which you can refer for this.
Operation Level Costing in Plant Maintenance | SCN
Working with Order Operations as Account Assignments – Orders (CS-SE/PM-WOC-MO) – SAP Library
Case 2 : Without Business function LOG_EAM_OLC
When we do a time confirmation or goods issuance, some FI & CO positing document entries get generated against your work order/reservation. We can use these entries to get a report on operation wise actual cost in a work order.
To achieve this, logically we need to ,
Select the operation wise confirmation entries from table AFRU by removing cancelled confirmation entries
Select material documents entries from COEP/COBK ( with reference to MSEG) which are not reversed.
As it is not possible to share full code due to various reasons, I am providing here a brief logic that can be used to generate this report. You need to work with your ABAP person for Selection screen, list of columns you want to display upon execution of report etc.
Tables :
AFRU Order Confirmations
AFVC – Order operations
CAUFV Generated Table for View
AFIH – Order header
IFLO Generated Table for View
ILOA – Location account assignment
————————————————————
MARA General Material Data
MAKT – Material description
MSEG Document Segment: Material
RESB – Reservations
————————————————————-
COEP – Co Objects
COBK – CO object document header
————————————————————-
Logic for material cost (This is only for reference. you need to show this to ABAP’er for more analysis as per your requirement.)
For material cost you can refer below logic,
SELECT SINGLE * FROM MSEG WHERE AUFNR = AUFNR AND
RSNUM = RSNUM AND
RSPOS = RSPOS AND BUKRS = BUKRS.
IF SY–SUBRC = 0.
SELECT SUM( WTGBTR ) TWAER
FROM COEP AS A INNER JOIN COBK AS B
ON A~KOKRS = B~KOKRS AND A~BELNR = B~BELNR AND A~GJAHR = B~GJAHR
INTO (WTGBTR, TWAER )
WHERE B~REFBN = MSEG–MBLNR AND B~REFBK = MSEG–WERKS
AND B~REFGJ = MSEG–GJAHR AND A~BUZEI = MSEG–ZEILE
AND B~STFLG = ‘ ‘ AND B~STOKZ = ‘ ‘ AND B~AWTYP = ‘MKPF‘
GROUP BY TWAER.
ENDSELECT.
ENDIF.
Logic for operation cost ( This is just for reference. You need to show this to ABAP’er for more analysis as per your requirement)
SELECT SINGLE * FROM AFRU WHERE AUFNR = AUFNR AND
VORNR = GT_FINAL–VORNR AND SUMNR = SUMNR AND
STOKZ = ” AND STZHL = ‘00000000’.
IF SY–SUBRC = 0.
PERNR = AFRU–PERNR.
SELECT SINGLE A~WTGBTR TWAER
FROM COEP AS A INNER JOIN COBK ASB
ON A~KOKRS = B~KOKRS AND A~BELNR = B~BELNR AND A~GJAHR = B~GJAHR
INTO (WTGBTR_OP, TWAER )
WHERE B~REFBN = AFRU–RUECK
AND B~STFLG = ‘ ‘ AND B~STOKZ = ‘ ‘ AND B~AWTYP = ‘AFRU‘.
ENDIF.
New NetWeaver Information at SAP.com
Very Helpfull