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

Material Cost Calculation

anuradha_wijesinghe
Participant
0 Likes
1,969

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

7 REPLIES 7
Read only

former_member201275
Active Contributor
0 Likes
1,418

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.

Read only

0 Likes
1,418

Hello Dear Glen,

     is this a function module or Program ?? how to go this ?

Thanks .

Read only

0 Likes
1,418

Apologies, FM = Function Module. Use SE37.

Read only

0 Likes
1,418

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 .

Read only

0 Likes
1,418

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.

Read only

Former Member
0 Likes
1,418

I have the same problem! was solved? How?

Read only

0 Likes
1,418

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. \