2013 Aug 26 12:42 PM
Hi all...
I have created a ABAP report for cost calculation for a material . It should be divided by sub-material and calculate a finish-good material cost. But this cost has small deferent with comparing CK13N .
Logic Structure is Here ..
{ SubMaterial(2) = SubMaterial(3) + SubMaterial(4) + OverHead(2) }
FinishGood Material Cost = SubMaterial(1) + SubMaterial(2) + OverHead(1) ,
= SubMaterial(1) + SubMaterial(3) + SubMaterial(4) + [ OverHead(2) + OverHead(1) ] .
So can anyone explain how do I get this details from tables.
So bellow is the source code I i have created. So can anyone tell this difference come ?
FORM CALCULATE .
SELECT * into CORRESPONDING FIELDS OF TABLE imbew FROM MBEW
WHERE MATNR in MAT.
LOOP at imbew.
itab-matnr = imbew-matnr.
SELECT * FROM ckis INTO CORRESPONDING FIELDS OF TABLE ickis WHERE KALNR = imbew-kaln1.
SORT ickis by KALNR POSNR.
DELETE ADJACENT DUPLICATES FROM ickis COMPARING KALNR POSNR.
loop at ickis.
if ickis-matnr+11(2) = '20'.
select SINGLE * from mbew into corresponding fields of imbew2 where matnr = ickis-matnr.
select * from ckis into corresponding fields of table ickis2 where kalnr = imbew2-kaln1.
SORT ickis2 by KALNR POSNR.
delete adjacent duplicates from ickis2 comparing kalnr posnr.
loop at ickis2.
if ickis2-matnr+11(2) = '10'.
itab-ycost = itab-ycost + ickis2-wertn.
ELSE.
itab-Overhead = itab-Overhead + ickis2-wertn.
ENDIF.
endloop.
clear imbew2.
ELSE.
if ickis-matnr+11(2) = '60'.
itab-dcost = itab-dcost + ickis-wertn.
ELSE.
itab-overhead = itab-overhead + ickis-wertn.
ENDIF.
endif.
ENDLOOP.
itab-total = itab-ycost + itab-dcost + itab-overhead.
APPEND itab.
CLEAR itab-matnr.
CLEAR itab-ycost.
CLEAR itab-dcost.
CLEAR itab-overhead.
CLEAR itab-total.
ENDLOOP.
ENDFORM. " CALCULATE
2013 Aug 26 2:38 PM
I think the standard FM CK_F_MATERIAL_CALC contains the code for this, if you drill down into it. Maybe run a test and debug the result if it is favourable.
2013 Aug 26 4:17 PM
Hello Dear Glen,
is this a function module or Program ?? how to go this ?
Thanks .
2013 Aug 27 7:47 AM
2013 Aug 27 8:00 AM
Thanks. Im sorry Mr. Glen for asking this again and again.. Can I know how to use it for a finish good material with breakdown. Need to know how to handle the import and exports ?
Thanks you very much .
2013 Aug 27 12:17 PM
Apologies, I actually don't know any more than this myself, just that the calculation you are looking lies in this FM as far as i am aware.
Sorry I could not be of more help.
2014 Jul 18 2:23 PM
2014 Jul 23 4:36 AM
Yes. It is done. In CKIS there are more values for deferent dates. So i get the latest date which cost calculated and pick that value. \