Expected material cost

I am creating a report to show the expected material cost, the ebs forms BOM / Bills / Indented Bills, but the help \ record history don't show record history.
how to find the tables for this screen?

Hi Ken, I created the PR by running MRP for the project. I then set the price of $900 in the PR that the system generated and saved it.
EDIT: I want to mention that the requisition MRP generated has an account assignment category Q and is linked to the WBS element of my activity.

Similar Messages

  • Error reading material cost estimate for sales order (KE292)

    Dear All,
    I have an issue with billing. we are posting july month transactions, the material cost is maintained through MR21. When releasing billing document for accounting we are getting error message like"Error reading the material cost estimate for sales order "11"
    Message no. KE292
    Diagnosis
    In Profitability Analysis (CO-PA), the system tried to valuate item 000010 of sales order 11 by reading the corresponding product cost estimate.
    However, no product cost estimate could be found for this sales order item.
    The system accessed product costing for product AMLFP011011XX00P using costing key YB3 as defined in the
    CO-PA Customizing settings.
    System Response
    The system cannot process the document any further.
    Procedure
    Check your Customizing settings."
    We cross checked with other client as a current date and we ran cost estimate through CK40N with same material. and we posted entries. Here it is working fine. but in above process it is not working. Can you pls guide me where i missed.
    Regards,
    Nagaraju,

    Hi,
    When the Costing Key is assigned to the material types in the COPA customizing, then system expects Cost estimation when billing is released to Accounts.
    If you dont run cost estimation but update the material master through MR21, system will not accept as in the Costing key configuration you must have selected the Current Standard price field for the valuation.
    Hence, try to run cost estimation and then do releasing.
    Thanks & Regards
    Ravi Kumar

  • How to include Material Cost in the SD report

    Hi,
    I am working on Cube 0SD_C03 for the Sales and Distribution Report "Sales Contribution - Product Wise u2013 KPI" where I have to show the following information which are given below.
    1. Total Sales Qty.
    2. Total Sales Value
    3. Total Material Cost
    For third one I do not know how to include this in this SD report.
    so please tell me about this if anybody has idea about this?

    Hi Francisco,
    Note:
    your xml should only have
    <URL>http://dbxserver.dbxprts.com:7778/pls/apex/f?p=134:1:::NO::P1_ID_CONSTANCIA:1183</URL>
    Show me your sample XML , i can help you.
    What is your expected output ? PDF or HTML ?
    here it is.
    option1:
    If the XML data includes an element that contains a hyperlink , then you can use that element to create dynamic hyperlinks at runtime.
    a. insert hyperlink from word menu
    b. In the Type the file or Web page name field of the Insert Hyperlink dialog box, enter the following syntax:
    c. {ELEMENT_NAME_WHICH_HAS_URL_LINK}
    where ELEMENT_NAME_WHICH_HAS_URL_LINK is the xml data element name
    option2:
    create a form field, you can add it
    <fo:basic-link external-destination="http://www.google..com">
    <fo:inline text-decoration="underline">google Link</fo:inline>
    </fo:basic-link>
    or
    <fo:basic-link external-destination="{ELEMENT_NAME}">
    <fo:inline text-decoration="underline">google Link</fo:inline>
    </fo:basic-link>
    or
    <fo:basic-link>
    <xsl:attribute name="external-destination"><xsl:value-of select="ELEMENT_URL"/>
    </xsl:attribute>
           <xsl:value-of select="LINK_NAME"/>
    </fo:basic-link>

  • Price list change according to raw material cost

    Dear Experts,
    We are currently working in a client where for those products for which the raw material is the main component as the cost of the raw materials varies with a high frequency (daily or weekly) the list price (the price we want to invoice to customers) should be updated accordingly and automatically with a specific mark up.
    Have you found a similar requirement in any client? If yes, could you explain us from a functional perspective how (SAP standard functionality or custom development with a detailed explanation of the solution) you solved this requirement?
    Is there any procedure to do regular massive updates of Finished Good price lists based on the actual variation (and/or expected variation) of raw materials cost?
    Thanks in advance for your help.
    M.Baig

    Hi Baig,
    It is possible to determine the price based on the raw material cost. I dont know whether you are using Moving average price or standard price for the raw material cost.
    Whatever be the  method, when you create the sales order, it is possible to take the raw material cost on the date of order creation using one of teh cost condition types like VPRS. You can use this condition type as statistical.
    You can also have another condition type which is the mark up on this cost.
    Now you can calculate your grossprice using another condition type which total up the cost in VPRS condition type adn the mark up %, either through just configuration or by means of a calculation type routine created in VOFM adn then assigning the same for the gross price condition type.
    I you have any concerns, pls lemme know.

  • Material Costs transfer to PCA Planning

    Dear SAPguru,
    How to transfer the variable cost like material costs to PCA (Profit Center accounting) planning. we have all the materials assigned to Profit center. We also run MRP.
    Thanks in Advance.
    Regards.,
    RK

    Dear Santosh,
    When we upload the plan for quantity, we are expecting the material costs to be derived automatically from material master price or from MRP requirment.
    Thanks
    RK

  • Post freight cost in diff. G/L of the material cost Accnt Cat. E

    Hi MM experts,
    I created a PO in reference to Sales Order (account assignment E-Trading materials)
    In condition I added a custom condizion for freight (SPRO Cond.category B, flag on accruals).
    When I received material the freight cost was added in total stock valuation.
    Account    Account short text             Amount Trs
    174020     STOCK M  VENT DIR                 576,03     BSX
    319500     FACT/REC                                 476,03-    WRX
    171090     Cte pass.stock march               476,03     EIN
    171090     Cte pass.stock march               576,03-    EKG
    422000     TRANSPORT                             100,00-    Z03
    319500     FACT/REC                          100,00     ZMA
    I want to see only stock value without freight cost in G/L account. I want freight cost in other G/L different of the material cost.
    I expect that the result is as follows:
    174020     STOCK M VENT DIR                  476,03     BSX
    319500     FACT/REC                                 476,03-    WRX
    422000     TRANSPORT                             100,00-    Z03
    319500     FACT/REC                                 100,00     ZMA
    Is there any other way to avoid this problem?
    Thank you very much.
    Regards,
    Michela

    Hi Michela,
    This is possible by adding one more condition type with blank condition category and negative value in plus/minus field.
    please refer the following wiki which gives step by step configuration.
    Appreciate if it is useful
    http://wiki.sdn.sap.com/wiki/display/ERPLO/PostingplanneddeliverycosttoNon-inventoryaccount
    Edited by: Raja Ramasamy on Apr 14, 2010 7:20 PM

  • Difference in material cost?

    Description      :  Hello,doing an analysis on std cost for turbo 751578-5002 plant 8492, we have found an issue on Material Cost.
    As you can see from the attached file, the CK13N tcode shows as Material Cost 6998,54 Eur (6152.54+846.00).
    The sum of all components is 7376.83 Eur. We have attached with screen shot, BOM & Break up of costcomponentsheet.
    Please can you explain why there is this difference
    Product            :  SAP - Finance
    Severity            :  4
    Order     Material     Material Description     RefDocNo     GBP     EUR     Postg Date     GBP Unit     EUR Unit     New Euro Price     New PN     Euro Price                                                                               
    101542053     400749-0006     PISTON RING     4913138496     48.34     64.10     16/01/2008     19.34     25.64                                                                               
    101542053     400788-0610     BOLT     4913138496     67.49     89.50     16/01/2008     27.00     35.80                                                                               
    101542053     433351-0001     BOLT     4913138496     11.69     15.50     16/01/2008     4.68     6.20                                                                               
    101542053     435034-0002     SEAL     4913138496     20.44     27.10     16/01/2008     8.18     10.84                                                                               
    101542053     435772-0001     BOLT     4913138496     14.10     18.70     16/01/2008     5.64     7.48                                                                               
    101542053     435782-0001     Clamp     4913138496     46.98     62.30     16/01/2008     18.79     24.92                                                                               
    101542053     435794-0001     Pin     4913138496     14.43     19.13     16/01/2008     5.77     7.65                                                                               
    101542053     700590-0001     PISTON RING     4913138496     51.52     68.32     16/01/2008     20.61     27.33     26.90                                                                               
    101542053     713782-0002     HSG,CENTER     4913138496     1,238.61     1,642.50     16/01/2008     495.44     657.00                                                                               
    101542053     400702-0018     RETAINING RING     4913138496     1.58     2.10     16/01/2008     0.63     0.84                                                                               
    101542053     434676-0001     BEARING,THRUST     4913138496     118.67     157.37     16/01/2008     47.47     62.95                                                                               
    101542053     434677-0001     COLLAR,THRUST     4913138496     114.22     151.47     16/01/2008     45.69     60.59                                                                               
    101542053     700591-0001     SPACER,THRUST     4913138496     105.57     140.00     16/01/2008     42.23     56.00                                                                               
    101542053     403069-0177     O-RING     4913138496     34.86     46.23     16/01/2008     13.94     18.49                                                                               
    101542053     400696-0009     CLAMP     4913138496     12.86     17.05     16/01/2008     5.14     6.82                                                                               
    101542053     434684-0001     Shroud     4913138496     99.69     132.20     16/01/2008     39.88     52.88                                                                               
    101542053     435795-0002     BEARING,JOURNAL     4913138496     158.36     210.00     16/01/2008     63.34     84.00                                                                               
    101542053     434820-0003     Backplate     4913138496     380.82     505.00     16/01/2008     152.33     202.00                                                                               
    101542053     436563-0009     "WHEEL,COMP"     4913138496     1,100.99     1,460.00     16/01/2008     440.40     584.00                                                                               
    101542053     435197-0005     WASHER     4913138496     8.05     10.68     16/01/2008     3.22     4.27                                                                               
    101542053     722531-0001     Adapter     4913138496     39.59     52.50     16/01/2008     15.84     21.00     30.00                                                                               
    101542053     432996-0008     HOSE     4913138496     160.25     212.50     16/01/2008     64.10     85.00                                                                               
    101542053     751578-5002     TURBOCHARGER SERVICE     4913139505     -17,349.93     -23,007.36     16/01/2008     -6,939.97     -9,202.94                                                                               
    101542053     712291-0019     HSG,COMPRESSOR & ACTUATOR ASSY     4913138496     3,359.53     4,455.00     16/01/2008     1,343.81     1,782.00                                                                               
    101542053     435788-0061     THWA     4913138496     4,009.94     5,317.50     16/01/2008     1,603.98     2,127.00                                                                               
    101542053     435419-0006     NUT     4913138496     33.93     45.00     16/01/2008     13.57     18.00          435419-0003     21.00                                                                               
    101542053     434715-0055     Wheel-Turbine-Assy     4913138496     2,522.48     3,345.00     16/01/2008     1,008.99     1,338.00                                                                               
    432546-0002     58.56                                                                               
    101542053     14086998     76.63     141.75     76.63     16/01/2008                                                                               
    101542053     14086998     1,060.43     1,961.68     1,060.43     16/01/2008                                                                               
    -3,574.94     -4,740.61                                                                               
    -14.3     -18.96                                                                               
    CK13 GBP                                                                               
    10     Material     4,023.08     40.23               4,023.08                    13,774.99     Material                                                                               
    15     Subcontracting     553.19     5.53               553.19                    55.10                                                                               
    25     Material O/H     1.96     0.02               1.96                                                                               
    35     Direct Labor     571.31     5.71               571.31                                                                               
    45     Direct Overhead     30.65     0.31               30.65                                                                               
    55     Manufg Indirect     767.65     7.68          562.47     205.18                                                                               
    65     Plant Overhead     598.66     5.99          592.01     6.65                                                                               
    70     Production Overhead          0.00                                                                               
    75     Base Costs LT     393.47     3.93          393.47                                                                               
    150     Tooling          0.00                                                                               
    Total     6,939.97     69.40          1,547.95     5,392.02                                                                               
    Tot GBP std cost for 250 pc          17,349.93                                                                               
    Material Cost     4,576.27     45.76                                                                               
    OH     2,363.70     23.64                                                                               
    x 250pc                                                                               
    5,909.25                                                                               
    Tot mfg GBP expected on turbo 751578-5002                                                                               
    CK13EUR                                                                               
    10     Material     6,152.54     61.53               6,152.54                    18,266.75     Material                                                                               
    15     Subcontracting     846.00     8.46               846                    73.07                                                                               
    25     Material O/H     3.00     0.03               3                                                                               
    35     Direct Labor     873.71     8.74               873.71                                                                               
    45     Direct Overhead     46.87     0.47               46.87                                                                               
    55     Manufg Indirect     1,173.97     11.74          860.19     313.78                                                                               
    65     Plant Overhead     915.54     9.16          905.37     10.17                                                                               
    70     Production Overhead          0.00                                                                               
    75     Base Costs LT     601.74     6.02          601.74                                                                               
    150     Tooling          0.00                                                                               
    Total     10,613.37     106.13          2,367.30     8,246.07                                                                               
    Tot EUR std cost for 250 pc          26,533.43                                                                               
    Material Cost     6,998.54     69.99                                                                               
    OH     3,614.83     36.15                                                                               
    x 250pc                                                                               
    9,037.08                                                                               
    Tot mfg EUR expected on turbo 751578-5002                                                                               
    Display Material Cost Estimate with Quantity Structure                                                                      1
         02.04.2008                                                                      
    Costing structure                                                    Total value     Currency       Quantity     Unit of Measure     Resource     
              TURBOCHARGER SERVICE                                        10,613.37     EUR     100     PC     8492 751578-5002     
                   TURBOCHARGER SERVICE                                   6,939.97     GBP     100     PC     8410 751578-5002     
                        THWA                    EUR     GBP     2,127.00     EUR     100     PC     8492 435788-0061     
                                            2127     0.55                              
                             THWA               2127     4.04     2,127.00     EUR     100     PC     8498 435788-0061     
                                            1069     12.09                              
                                  HSG,TURBINE-CST          68     2.79     1,069.00     EUR     100     PC     8498 434905-0001     
                                  BUSHING          106     19.62     68     EUR     100     PC     8498 432635-0032     
                                  ARM & VALVE ASSY          38     23.4     106     EUR     100     PC     8498 435571-0026     
                                  CRANK ASSY          0.84     16.3     38     EUR     100     PC     8498 410945-0001     
                                            0.62     55.58                              
                        RETAINING RING                    18.49     4.46     0.55     GBP     100     PC     8410 400702-0018     
                                            4.27     38.3                              
                             RETAINING RING               30     1165     0.84     EUR     100     PC     8492 400702-0018     
                                            35.8     54.93                              
                        BOLT                    24.92     5     4.04     GBP     400     PC     8410 433351-0001     
                                            85     34.58                              
                             BOLT               6.82     16.77     6.2     EUR     400     PC     8492 433351-0001     
                                            58.56     41.16                              
                        O-RING                    1782     4.88     12.09     GBP     100     PC     8410 403069-0177     
                                            84     430                              
                             O-RING               7.65     132     18.49     EUR     100     PC     8492 403069-0177     
                                            52.88     36.62                              
                        WASHER                    25.64     17.59     2.79     GBP     100     PC     8410 435197-0005     
                                            62.95                                   
                             WASHER               7.48          4.27     EUR     100     PC     8492 435197-0005     
                                            10.84                                   
                        Adapter                    584          19.62     GBP     100     PC     8410 722531-0001     
                                            60.59                                   
                             Adapter               21          30     EUR     100     PC     8492 722531-0001     
                                            657                                   
                        BOLT                    1338          23.4     GBP     400     PC     8410 400788-0610     
                                            1338                                   
                             BOLT               186          35.8     EUR     400     PC     8492 400788-0610     
                                            186                                   
                        Clamp                    773          16.3     GBP     200     PC     8410 435782-0001     
                                            773                                   
                             Clamp               202          24.92     EUR     200     PC     8492 435782-0001     
                                            56                                   
                        HOSE                    26.9          55.58     GBP     100     PC     8410 432996-0008     
                                            14035.25     2115.66                              
                             HOSE                         85     EUR     100     PC     8492 432996-0008     
                        CLAMP                              4.46     GBP     200     PC     8410 400696-0009     
                             CLAMP                         6.82     EUR     200     PC     8492 400696-0009     
                        STUD                              38.3     GBP     200     PC     8410 432546-0002     
                             STUD                         58.56     EUR     200     PC     8492 432546-0002     
                        HSG,COMPRESSOR & ACTUATOR ASSY                              1,165.00     GBP     100     PC     8410 712291-0019     
                             HSG,COMPRESSOR & ACTUATOR ASSY                         1,782.00     EUR     100     PC     8492 712291-0019     
                        BEARING,JOURNAL                              54.93     GBP     100     PC     8410 435795-0002     
                             BEARING,JOURNAL                         84     EUR     100     PC     8492 435795-0002     
                        Pin                              5     GBP     100     PC     8410 435794-0001     
                             Pin                         7.65     EUR     100     PC     8492 435794-0001     
                        Shroud                              34.58     GBP     100     PC     8410 434684-0001     
                             Shroud                         52.88     EUR     100     PC     8492 434684-0001     
                        PISTON RING                              16.77     GBP     100     PC     8410 400749-0006     
                             PISTON RING                         25.64     EUR     100     PC     8492 400749-0006     
                        BEARING,THRUST                              41.16     GBP     100     PC     8410 434676-0001     
                             BEARING,THRUST                         62.95     EUR     100     PC     8492 434676-0001     
                        BOLT                              4.88     GBP     400     PC     8410 435772-0001     
                             BOLT                         7.48     EUR     400     PC     8492 435772-0001     
                        SEAL                              7.09     GBP     100     PC     8410 435034-0002     
                             SEAL                         10.84     EUR     100     PC     8492 435034-0002     
                        WHEEL,COMP                              382     GBP     100     PC     8410 436563-0009     
                             WHEEL,COMP                         584     EUR     100     PC     8492 436563-0009     
                        COLLAR,THRUST                              39.62     GBP     100     PC     8410 434677-0001     
                             COLLAR,THRUST                         60.59     EUR     100     PC     8492 434677-0001     
                        NUT,LOCK                              14     GBP     100     PC     8410 435419-0003     
                             NUT,LOCK                         21     EUR     100     PC     8492 435419-0003     
                        HSG,CENTER                              430     GBP     100     PC     8410 713782-0002     
                             HSG,CENTER                         657     EUR     100     PC     8492 713782-0002     
                        Wheel-Turbine-Assy                              1,338.00     EUR     100     PC     8492 434715-0055     
                             Wheel-Turbine-Assy                         1,338.00     EUR     100     PC     8498 434715-0055     
                                  Wheel-Turbine-Assy                    1,338.00     EUR     100     PC     8408 434715-0055     
                                       Shaft               186     EUR     100     PC     8408 711414-0001     
                                            Shaft          186     EUR     100     PC     8498 711414-0001     
                                       WHEEL,TURBINE               773     EUR     100     PC     8408 436143-0006     
                                            WHEEL,TURBINE          773     EUR     100     PC     8498 436143-0006     
                        Backplate                              132     GBP     100     PC     8410 434820-0003     
                             Backplate                         202     EUR     100     PC     8492 434820-0003     
                        SPACER,THRUST                              36.62     GBP     100     PC     8410 700591-0001     
                             SPACER,THRUST                         56     EUR     100     PC     8492 700591-0001     
                        PISTON RING                              17.59     GBP     100     PC     8410 700590-0001     
                             PISTON RING                         26.9     EUR     100     PC     8492 700590-0001     
                                                      17937.2

    Hi ,
    That is too confusing in one line you are seeing less cost estimate ,of 6**.* dollars instead of 7***.* is that right ?
    If Yes, first see report S_ALR_87099931 for that cost estimate along with CK87_99 for multi level BOM , it all depends on the BOM and Routing CA01. in BOM there might be some less Qty or in Routing tehre might be some some less hours,
    one more best thing do a cost estimate in CK11N for month May (don't save it) , and see if it is showing same cost estimate or not. if it is showing same number as now then surely it is coming from BOM ad Routing ,and Look for info records if you have sub contracts.
    Parthu

  • In import Pricing Proceedure,  Some Condition types added to Material Cost

    HI,
    In Import Pricing procedure, Some condition types (Like Basic Customs Duty,Edu Cess & Hier Edu Cess) are added to material cost. The remaining are not added. What is the configuration to add condition types to Material cost?
    Note -  we have added FR3 account key for all condition types. Then why few condition types are added to material cost and why others are not added to material cost?
    Can any one please help me on this..
    Thanks
    KB

    Assign key "NVV" to those condition types which are to be loaded to material cost.
    Hope this resolves ur problem

  • Material Cost is not coming in Credit Memo

    Dear SAP gurus,
    My Client is from Brazil & they created a cycle of Sales Order (Export Order) to Billing (with Nota Fiscal)
    & with Reference to Invoice, they created the Return Order, Return Delivery (PGR) & finally generated Credit Memo.
    The Problem is Material Cost (VPRS) is getting captured in Billing, but in case of Credit memo,
    Material cost is not getting posted in G/L accounts.
    What we analyzed till now:
    * Pricing Procedure & found that there is no requirement/routine maintained for Cond Type VPRS.
    * Copy Control related Settings (from Delivery to Billing).
    * Item Category Related settings.
    but we could not find anything specific.
    For more clarity, I am providing the below details of Accouting Entries:
    G/L account details after Billing:
      1 99999S2L10 Industrias John Deer USD     122.102,07
      2 50 1100200000 Venda Prod.Int-OUsC  USD      38.131,66-
      3 50 3651100000 Custo Frete Unid Dee USD       2.397,41-
      4 50 3652100000 CustoManusFaturDeere USD         171,59-
      5 50 6450000000 Inv. Prod.Acabado-Tr USD      35.534,11-
      6 40 3400200000 CPV-Prod-Int-OUsC    USD      35.534,11
    G/L account details after Credit memo:
    1 11 99999S2L10 Industrias John Deer USD     122.189,84-
    2 40 1100200000 Venda Prod.Int-OUsC  USD      38.159,09
    3 40 3651100000 Custo Frete Unid Dee USD       2.399,12
    4 40 3652100000 CustoManusFaturDeere USD         171,71
    5 40 6450000000 Inv. Prod.Acabado-Tr USD           0,02
    6 50 3400200000 CPV-Prod-Int-OUsC    USD           0,02-
    Please pay attention to 5th & 6th Lines.
    Can anyone suggest where things have gone wrong. Do let me know if you need any other information.
    Thank you in anticipation,
    MAYANK

    Hello Mayank,
    If your VPRS is being captured in your billing document, but IS NOT being posted to a G/L account, then your problem is on account determination.
    I suggest the following:
    Step 1. Go to your billing document overview.
    Step 2. Go to Environment>Account Determination Analysis>Revenue Accounts.
    Step 3. Go to the VPRS condition of your material and based on the access sequence, check the problem.  For example: "No G/L found in Account Determination Type KOFI" (if your account determination condition type is KOFI in your case)
    Step 4. In Step 3, you will see the values for each field based on the fields in your access.  Then go to VKOA and compare if you have a valid entry there corresponding to the revenue account determination analysis.  Otherwise, if there is no matching entry then I suspect this is why your G/L is not being determined for your VPRS.
    Step 5.  If the VKOA entry is missing and it is REALLY NEEDED, then add the VKOA entry tied to the G/L account.  Otherwise, review your master data and your VKOA.
    Let me know if this solves your problem.
    Hope this helps,
    Eva

  • Material costed, production order with no target cost

    I've a case of production order and I don't where to find information to solve it.
    I've a product A costed from March. Standard cost is correct.
    I'm creating a production order now. The cost estimate is calculated during the delivery.
    I've confirmed order by CO15. I've created a variance by deleting 2 items in bom of order. And confirm less than wanted on other component. But I don't think these variances are linked to my problem.
    In CO02 and cost analysis : target cost of my product equals 0.
    I've checked my prod cost variant and choices are : std price, L price from PIR, moving average price.
    Thanks for your helps
    Christophe

    How can I see that ? I've checked that material cost has taken the bom during the cost explosion. Components are also costed.
    I've noticed that target cost appears after variance calculation for product.

  • How to get report for cost estimates material cost only

    Hi Gurus,
    We have requirement in sales order costing that we need to develope report which shows only Material cost for all BOM levels.
    Normally at lower levels cost of Material and activity cost will be treated as Material cost for next level. Here I want to consider only material cost not activity cost at lower levels
    Pls suggest the logic and tables for exploding BOM and fetching material cost only.
    Thanks
    Sneha

    Sneha
    If you tick the "Roll up" indicatorfor each cost component  in Cost Comp Str OKTZ, then overheads do  not get added to the material cost... This is my understanding about it.. Is it behaving some thing different in your case??
    br, Ajay M

  • Raw material cost report for production of finished produt.?(urgent..REWARD

    Hi,
    any one can help in this issue.
    i am not getting the raw materila cost & manfacture conversion cost for  for the bom of FG - SFG - SFG - SFG- RAW
    FG - finished goods,
    SFG - semi finished goods
    RAW - raw material.
    plz provide the solution.
    raw material  and manfacture conversion cost is calculated in PERFORM z_process_data. subroutine.
    REPORT z_co_production_cost_nsk.
    TABLES: afko, bkpf, t001w , caufv.
    TYPE-POOLS: kkblo,
                slis.
    DATA: d_datefrom LIKE sy-datum,
          d_dateto LIKE sy-datum,
          d_repid LIKE sy-repid,
          d_uname LIKE sy-uname,
          d_returncode TYPE i,
          d_tabix TYPE i,
          d_kokrs LIKE tka01-kokrs,
          d_waers LIKE tka01-waers,
          wa_fieldcatalog TYPE slis_fieldcat_main,
          wa_listevents TYPE slis_alv_event,
          wa_listlayout TYPE slis_layout_alv,
          wa_print_info TYPE slis_print_alv,
          wa_listheader TYPE slis_listheader,
          d_headerlines TYPE i.
    DATA: BEGIN OF t_caufv OCCURS 0,
            aufnr TYPE caufv-aufnr,
            werks TYPE caufv-werks,
            objnr TYPE covp-objnr,
            gamng TYPE caufv-gamng,
            plnbez TYPE caufv-plnbez,
            rsnum TYPE caufv-rsnum,
          END OF t_caufv.
    *Added by Anand Bothra on 24/11/2003
    DATA: t_ab_caufv LIKE t_caufv OCCURS 0 WITH HEADER LINE.
    DATA: t_temp_caufv LIKE t_caufv OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_afpo OCCURS 0,
            aufnr TYPE afpo-aufnr,
            posnr TYPE afpo-posnr,
            wemng TYPE afpo-wemng,
            amein TYPE afpo-amein,
            charg TYPE afpo-charg,
          END OF t_afpo.
    DATA: BEGIN OF t_afpo1 OCCURS 0,
            aufnr TYPE afpo-aufnr,
            refaufnr TYPE afpo-aufnr,
            objnr TYPE caufv-objnr,
            rsnum TYPE afko-rsnum,
            wemng TYPE afpo-wemng,
            werks TYPE afpo-dwerk,
            charg TYPE afpo-charg,
          END OF t_afpo1.
    DATA: BEGIN OF t_makt OCCURS 0,
            matnr TYPE makt-matnr,
            maktx TYPE makt-maktx,
          END OF t_makt.
    DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv,
          t_listevents TYPE slis_t_event,
          t_sortsequence TYPE slis_t_sortinfo_alv,
          t_listheader TYPE slis_t_listheader.
    DATA: BEGIN OF t_production_costs OCCURS 0,
            objnr TYPE covp-objnr,       " Object Number
            kstar TYPE covp-kstar,       " Cost Element
            wkgbtr TYPE covp-wkgbtr,     " Cost of Line Item in CO area curr
            mbgbtr TYPE covp-mbgbtr,     " Quantity of Line Item
            matnr TYPE covp-matnr,       " Material Number
            kokrs TYPE covp-kokrs,       " Controlling Area
            belnr TYPE covp-belnr,       " Cost Accounting Document
            buzei TYPE covp-buzei,       " Item Number in Document
          END OF t_production_costs.
    DATA: BEGIN OF t_production_costs1 OCCURS 0,
            objnr TYPE covp-objnr,       " Object Number
            kstar TYPE covp-kstar,       " Cost Element
            wkgbtr TYPE covp-wkgbtr,     " Cost of Line Item in CO area curr
            mbgbtr TYPE covp-mbgbtr,     " Quantity of Line Item
            kokrs TYPE covp-kokrs,       " Controlling Area
            belnr TYPE covp-belnr,       " Cost Accounting Document
            buzei TYPE covp-buzei,       " Item Number in Document
          END OF t_production_costs1.
    DATA t_production_costs2 LIKE t_production_costs1
         OCCURS 0 WITH HEADER LINE.
    DATA: BEGIN OF t_suborders OCCURS 0,
            aufnr TYPE caufv-aufnr,
            prevaufnr TYPE caufv-aufnr,
            objnr TYPE covp-objnr,
            rsnum TYPE caufv-rsnum,
          END OF t_suborders.
    DATA: BEGIN OF t_outputtab OCCURS 0,
            plnbez LIKE afko-plnbez,             " Material Number
            objnr LIKE caufv-objnr,              " Object Number
            maktx LIKE makt-maktx,               " Material Description
            charg LIKE afpo-charg,               " Batch Number
            aufnr LIKE afko-aufnr,               " Production Order Number
            gamng LIKE caufv-gamng,              " Total Order Quantity
            wemng LIKE afpo-wemng,               " Goods Receipt Quantity
            amein LIKE afpo-amein,               " Unit of Measure
            yield TYPE p DECIMALS 2,             " Percentage Yield
            totalrmcost TYPE p DECIMALS 2,       " Total Raw Material Cost
            totalpmcost TYPE p DECIMALS 2,       " Total Packing Mat. Cost
            mfgconvcost TYPE p DECIMALS 2,       " Manu. Conversion Cost
            pkgconvcost TYPE p DECIMALS 2,       " Packing Conv. Cost
            rmperunit TYPE p DECIMALS 2,         " Raw Cost per unit
            pmperunit TYPE p DECIMALS 2,         " Pack Mat cost per unit
            ccperunit TYPE p DECIMALS 2,         " Conv Cost per unit
            totperunit TYPE p DECIMALS 2,        " Total Cost per unit
            waers LIKE tka01-waers,              " Currency Key for CO Area
          END OF t_outputtab.
    *Added by Anand Bothra on 24/11/2003.
    DATA: t_ab_outputtab LIKE t_outputtab OCCURS 0 WITH HEADER LINE,
          t_temp_outputtab LIKE t_outputtab OCCURS 0 WITH HEADER LINE.
    BEGIN OF INSERTION VIP110703
    DATA:wa_prev_outputtab LIKE LINE OF t_outputtab,
         wa_production_costs LIKE LINE OF t_production_costs.
    DATA:prev_totmatqty TYPE p DECIMALS 2,
         prev_tot_mfgconv_cst TYPE p DECIMALS 2,
         grand_mat_qty TYPE p DECIMALS 2 ,
         tmp_aufnr TYPE caufv-aufnr.
    DATA: BEGIN OF t_suborders_propcost OCCURS 0,
            aufnr TYPE caufv-aufnr,
            prevaufnr TYPE caufv-aufnr,
            objnr TYPE covp-objnr,
            rsnum TYPE caufv-rsnum,
            proprmcost TYPE p DECIMALS 2,
            prop_mfg_convcost TYPE p DECIMALS 2,
          END OF t_suborders_propcost.
    DATA: wa_suborders LIKE LINE OF t_suborders.
    END   OF INSERTION VIP110703
    BEGIN OF INSERTION VIP111003
    DATA: prev_aufnr TYPE caufv-aufnr,
          prev_matnr TYPE mara-matnr,
          curr_matnr TYPE mara-matnr.
    DATA: bln_suborder ,
          ratio TYPE p DECIMALS 5.
    BEGIN OF INSERTION VIP111003
    *Added by Anand Bothra on 28/11/2003
    DATA: d_flag TYPE c.
    SELECTION-SCREEN BEGIN OF BLOCK zblock1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_plnbez FOR afko-plnbez,
                    s_aufnr FOR afko-aufnr,
    "Added By Vivek on 29.11.2005
                    s_auart FOR caufv-auart obligatory.
    PARAMETERS p_werks LIKE t001w-werks OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK zblock1.
    SELECTION-SCREEN BEGIN OF BLOCK zblock2 WITH FRAME TITLE text-002.
    SELECT-OPTIONS: s_monat FOR bkpf-monat NO-EXTENSION OBLIGATORY.
    PARAMETERS p_gjahr LIKE bkpf-gjahr OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK zblock2.
    SELECTION-SCREEN BEGIN OF BLOCK zblock3 WITH FRAME TITLE text-022.
    PARAMETERS: p_detsum RADIOBUTTON GROUP rad,
                p_sum RADIOBUTTON GROUP rad.
    SELECTION-SCREEN END OF BLOCK zblock3.
    INITIALIZATION.
      d_repid = sy-repid.
      d_uname = sy-uname.
    p_werks = 'G001'.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
       IF screen-name EQ 'P_WERKS'.
         screen-input = 0.
         MODIFY SCREEN.
       ENDIF.
    ENDLOOP.
    AT SELECTION-SCREEN ON s_monat.
      IF s_monat-high IS INITIAL.
        IF NOT ( s_monat-low BETWEEN 1 AND 12 ).
          MESSAGE e398(00) WITH text-023 text-024 space space.
        ENDIF.
      ELSE.
        IF ( ( s_monat-low LT 1 ) OR ( s_monat-high GT 12 ) ).
          MESSAGE e398(00) WITH text-023 text-024 text-025 space.
        ENDIF.
      ENDIF.
    START-OF-SELECTION.
      PERFORM z_get_period_dates.
      PERFORM z_select_prod_orders.
      PERFORM z_select_prod_costs.
      PERFORM z_select_addl_prod_costs.
      PERFORM z_select_mat_desc.
    END-OF-SELECTION.
      IF d_returncode EQ 0.
        PERFORM z_process_data.
    *Added by Anand Bothra on 24/11/2004.
        PERFORM z_select_to_print.
        PERFORM z_prepare_fieldcat.
        PERFORM z_get_alv_events.
        PERFORM z_define_sortsequence.
        PERFORM z_define_layout.
        PERFORM z_display_list.
    *Added by Anand Botra on 25/11/2003.
        PERFORM z_export_to_excel.
        PERFORM z_send_mail_and_download.
      ELSE.
        MESSAGE i017(p5).
      ENDIF.
    *&      Form  Z_GET_PERIOD_DATES
          text
    -->  p1        text
    <--  p2        text
    FORM z_get_period_dates.
    Determine the date range from the fiscal period range and
    fiscal year entered on the selection screen
      DATA: d_firstdate LIKE sy-datum,
            d_lastdate LIKE sy-datum,
            t_dates LIKE scscp_period_str OCCURS 0 WITH HEADER LINE.
      CALL FUNCTION 'FIRST_AND_LAST_DAY_IN_YEAR_GET'
        EXPORTING
          i_gjahr        = p_gjahr
          i_periv        = 'V3'
        IMPORTING
          e_first_day    = d_firstdate
          e_last_day     = d_lastdate
        EXCEPTIONS
          input_false    = 1
          t009_notfound  = 2
          t009b_notfound = 3
          OTHERS         = 4.
      CALL FUNCTION 'CSCP_PARA1_GET_PERIODS'
        EXPORTING
          i_datuv    = d_firstdate
          i_datub    = d_lastdate
          i_timeunit = 'M'
        TABLES
          et_dates   = t_dates.
      SORT t_dates BY sindex.
      DELETE t_dates INDEX 1.
      LOOP AT t_dates.
        SUBTRACT: 1 FROM t_dates-sindex,
                  1 FROM t_dates-datub.
        MODIFY t_dates TRANSPORTING sindex datub.
      ENDLOOP.
      CLEAR: d_datefrom,
             t_dates.
      READ TABLE t_dates WITH KEY sindex = s_monat-low.
      d_datefrom = t_dates-datuv.
      CLEAR d_dateto.
      IF s_monat-high IS INITIAL.
        d_dateto = t_dates-datub.
      ELSE.
        CLEAR t_dates.
        READ TABLE t_dates WITH KEY sindex = s_monat-high.
        d_dateto = t_dates-datub.
      ENDIF.
    ENDFORM.                    " Z_GET_PERIOD_DATES
    *&      Form  Z_SELECT_PROD_ORDERS
          text
    -->  p1        text
    <--  p2        text
    FORM z_select_prod_orders.
    Select all production orders as per the selection criteria provided
      DATA: d_dlv_code LIKE jstat-stat,
            d_teco_code LIKE jstat-stat,
            t_status LIKE jstat OCCURS 0 WITH HEADER LINE.
      SELECT SINGLE name1 INTO t001w-name1 FROM t001w WHERE werks = p_werks.
    if s_plnbez-low eq space and s_plnbez-high eq space.
    endif.
      SELECT aufnr werks objnr gamng rsnum plnbez
      INTO CORRESPONDING FIELDS OF
      TABLE t_caufv FROM caufv
      WHERE aufnr IN s_aufnr
    AND   auart IN ('PP01', 'LL02') : BY VIVEK
      AND   auart in s_auart " Added By Vivek on 29.11.2005
      AND   werks = p_werks
      AND   plnbez IN s_plnbez
      AND   getri BETWEEN d_datefrom AND d_dateto
      ORDER BY aufnr.
      d_returncode = sy-subrc.
      IF d_returncode NE 0.
        STOP.
      ENDIF.
    Filter out only those production orders that have a status
    DLV (Delivered) or TECO (Technically Confirmed).
      CLEAR: d_dlv_code,
             d_teco_code.
      PERFORM z_get_status_code USING 'DLV' CHANGING d_dlv_code.
      PERFORM z_get_status_code USING 'TECO' CHANGING d_teco_code.
      LOOP AT t_caufv.
        REFRESH t_status.
        CALL FUNCTION 'STATUS_READ'
             EXPORTING
              CLIENT           = SY-MANDT
                  objnr            = t_caufv-objnr
                 only_active      = 'X'
         IMPORTING
              OBTYP            =
              STSMA            =
              STONR            =
            TABLES
                 status           = t_status
            EXCEPTIONS
                 object_not_found = 1
                 OTHERS           = 2
        IF sy-subrc EQ 0.
          CLEAR t_status.
          READ TABLE t_status WITH KEY stat = d_dlv_code.
          IF sy-subrc NE 0.
            CLEAR t_status.
            READ TABLE t_status WITH KEY stat = d_teco_code.
            IF sy-subrc NE 0.
              DELETE t_caufv.
            ENDIF.
          ENDIF.
        ELSE.
          DELETE t_caufv.
        ENDIF.
      ENDLOOP.
      IF t_caufv[] IS INITIAL.
        d_returncode = 4.
        STOP.
      ENDIF.
    Added by Anand Bothra on 24/11/2003**********
      t_ab_caufv[] = t_caufv[].
    Added by Anand Bothra on 28/11/2003.
      IF ( s_plnbez-low EQ space AND s_plnbez-high EQ space ).
        IF ( s_aufnr-low EQ space AND s_aufnr-high EQ space ).
          d_flag = 'N'.
        ELSE.
          d_flag = 'Y'.
        ENDIF.
      ELSE.
        d_flag = 'Y'.
      ENDIF.
      IF d_flag = 'Y'.
    Added by Anand Bothra on 21/11/2003.**********
    *Get the batch number of the entered order
        DATA: itab_afpo LIKE afpo OCCURS 100 WITH HEADER LINE.
        DATA: BEGIN OF t_ab_charg OCCURS 0,
    *Added by Anand on 27/11/2003
                aufnr LIKE afpo-aufnr,
                charg LIKE afpo-charg,
                END OF t_ab_charg.
        LOOP AT t_caufv.
          SELECT aufnr charg FROM afpo INTO t_ab_charg WHERE aufnr =
      t_caufv-aufnr.
            APPEND t_ab_charg.
            CLEAR t_ab_charg.
          ENDSELECT.
        ENDLOOP.
    IF sy-subrc = 0.
       SELECT * FROM afpo INTO TABLE itab_afpo WHERE charg = d_ab_charg.
    ENDIF.
        LOOP AT t_ab_charg.
          SELECT * FROM afpo INTO itab_afpo WHERE charg = t_ab_charg-charg.
            APPEND itab_afpo.
            CLEAR itab_afpo.
          ENDSELECT.
        ENDLOOP.
        CLEAR t_caufv.
        REFRESH t_caufv.
    *Get all the orders with the same batch number.
        LOOP AT itab_afpo.
          SELECT aufnr werks objnr gamng rsnum plnbez
          INTO CORRESPONDING FIELDS OF
          t_caufv FROM caufv WHERE aufnr = itab_afpo-aufnr.
            APPEND t_caufv.
          ENDSELECT.
        ENDLOOP.
        CLEAR t_caufv.
        SORT t_caufv BY aufnr.
    delete adjacent duplicates from t_caufv comparing all fields.
      ENDIF.
      SELECT aufnr posnr wemng amein charg INTO TABLE t_afpo
      FROM afpo FOR ALL ENTRIES IN t_caufv
      WHERE aufnr = t_caufv-aufnr.
      d_returncode = sy-subrc.
      IF d_returncode NE 0.
        STOP.
      ENDIF.
      SORT t_afpo BY aufnr.
    ENDFORM.                    " Z_SELECT_PROD_ORDERS
    *&      Form  Z_SELECT_MAT_DESC
          text
    -->  p1        text
    <--  p2        text
    FORM z_select_mat_desc.
    Get the Description of all materials
      SELECT matnr maktx INTO TABLE t_makt FROM makt
      FOR ALL ENTRIES IN t_caufv
      WHERE matnr = t_caufv-plnbez
      AND   spras = sy-langu.
    ENDFORM.                    " Z_SELECT_MAT_DESC
    *&      Form  Z_PROCESS_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM z_process_data.
    Process the data from all production orders and prepare the output
    table for display appropriately
      DATA: d_mbgbtr TYPE p DECIMALS 3,
            loop_cnt TYPE i.
      REFRESH t_outputtab.
      LOOP AT t_caufv.
        CLEAR t_outputtab.
        MOVE-CORRESPONDING t_caufv TO t_outputtab.
        CLEAR t_makt.
        READ TABLE t_makt WITH KEY matnr = t_caufv-plnbez.
        IF sy-subrc EQ 0.
          MOVE t_makt-maktx TO t_outputtab-maktx.
        ENDIF.
        CLEAR t_afpo.
        READ TABLE t_afpo WITH KEY aufnr = t_caufv-aufnr.
        IF sy-subrc EQ 0.
          MOVE: t_afpo-wemng TO t_outputtab-wemng,
                t_afpo-amein TO t_outputtab-amein,
                t_afpo-charg TO t_outputtab-charg.
        ENDIF.
        IF t_outputtab-gamng NE 0.
          COMPUTE t_outputtab-yield =
          ( t_outputtab-wemng / t_outputtab-gamng ) * 100.
        ENDIF.
        APPEND t_outputtab.
      ENDLOOP.
      SORT t_production_costs BY objnr kstar.
      LOOP AT t_production_costs.
        AT NEW objnr.
          CLEAR: d_mbgbtr, d_tabix, t_outputtab.
          READ TABLE t_outputtab WITH KEY objnr = t_production_costs-objnr.
          MOVE sy-tabix TO d_tabix.
          " Add up the Raw Material and Manufacturing Conversion
          " Costs from the previous stage production order
          CLEAR loop_cnt .
          LOOP AT t_suborders WHERE aufnr = t_outputtab-aufnr.
         commented by anand bothra on 20/11/2003
            ADD 1 TO loop_cnt.
            IF loop_cnt > 1.
              EXIT.
            ENDIF.
            LOOP AT t_production_costs1 WHERE objnr = t_suborders-objnr.
              CASE t_production_costs1-kstar.
                WHEN '0005000000' OR '0005010000'.     " Raw Material Cost
    BEGIN OF deletion VIP110703
              ADD t_production_costs1-wkgbtr TO t_outputtab-totalrmcost.
    END   OF deletion VIP110703
                  ADD t_production_costs1-wkgbtr TO prev_totmatqty.
                WHEN '0000500100'.      " Manufacturing Conversion Cost
                  ADD t_production_costs1-wkgbtr TO prev_tot_mfgconv_cst.
    BEGIN OF deletion VIP110703
                ADD t_production_costs1-wkgbtr TO t_outputtab-mfgconvcost.
    END   OF deletion VIP110703
              ENDCASE.
            ENDLOOP.
    BEGIN OF INSERTION VIP110703
           READ TABLE t_production_costs INTO wa_production_costs
           WITH KEY objnr = t_production_costs-objnr
                      matnr = wa_prev_outputtab-plnbez.
           IF sy-subrc = 0.
             IF  ( wa_production_costs-mbgbtr NE
                                   wa_prev_outputtab-wemng )  .
               prev_totmatqty = ( prev_totmatqty /
                                  wa_prev_outputtab-wemng ) *
                                 wa_production_costs-mbgbtr.
               prev_tot_mfgconv_cst = ( prev_tot_mfgconv_cst /
                                  wa_prev_outputtab-wemng ) *
                                  wa_production_costs-mbgbtr.
             ENDIF.
           ENDIF.
           LOOP AT t_suborders_propcost
                   WHERE prevaufnr = wa_prev_outputtab-aufnr.
             t_suborders_propcost-proprmcost = prev_totmatqty.
             t_suborders_propcost-prop_mfg_convcost = prev_tot_mfgconv_cst
             MODIFY t_suborders_propcost.
           ENDLOOP.
           clear: prev_totmatqty,
                   prev_tot_mfgconv_cst.
    END   OF INSERTION VIP110703
    BEGIN OF INSERTION VIP111003
            CLEAR: wa_prev_outputtab,
                   wa_production_costs.
            READ TABLE t_outputtab INTO wa_prev_outputtab
            WITH KEY aufnr = t_suborders-prevaufnr.
            ratio = 1.
            IF sy-subrc = 0.
              READ TABLE t_production_costs INTO wa_production_costs
              WITH KEY objnr = t_outputtab-objnr
                         matnr = wa_prev_outputtab-plnbez.
              IF sy-subrc = 0.
                IF  ( wa_production_costs-mbgbtr NE
                                      wa_prev_outputtab-wemng ) .
                  ratio = wa_production_costs-mbgbtr /
                          wa_prev_outputtab-wemng.
                  prev_totmatqty = ( prev_totmatqty /
                                     wa_prev_outputtab-wemng ) *
                                    wa_production_costs-mbgbtr.
                  prev_tot_mfgconv_cst = ( prev_tot_mfgconv_cst /
                                     wa_prev_outputtab-wemng ) *
                                     wa_production_costs-mbgbtr.
                ENDIF.
              ENDIF.
            ENDIF.
            LOOP AT t_suborders_propcost
                    WHERE prevaufnr = wa_prev_outputtab-aufnr
                    AND aufnr = t_outputtab-aufnr.
              t_suborders_propcost-proprmcost = prev_totmatqty.
              t_suborders_propcost-prop_mfg_convcost = prev_tot_mfgconv_cst.
              MODIFY t_suborders_propcost.
            ENDLOOP.
    *Commented by Anand Bothra on 20/11/2003.
            CLEAR: prev_totmatqty,
                    prev_tot_mfgconv_cst.
    BEGIN OF INSERTION VIP111003
          ENDLOOP.
        ENDAT.
        AT END OF kstar.
          SUM.
          CASE t_production_costs-kstar.
            WHEN '0000500200'.    " Packing Conversion Costs
              t_outputtab-pkgconvcost = t_production_costs-wkgbtr.
            WHEN '0005000500'.   " Semi-Finished Cost/Quantity
              MOVE t_production_costs-mbgbtr TO d_mbgbtr.
            WHEN '0005050000' OR '0005050001' OR '0005050002'.
              " Packing Mat Costs
              ADD t_production_costs-wkgbtr TO t_outputtab-totalpmcost.
            WHEN '0005000000' OR '0005010000'.
              ADD t_production_costs-wkgbtr TO t_outputtab-totalrmcost.
            WHEN '0000500100'.      " Manufacturing Conversion Cost
              ADD t_production_costs-wkgbtr TO t_outputtab-mfgconvcost.
          ENDCASE.
        ENDAT.
        AT END OF objnr.
          MOVE d_waers TO t_outputtab-waers.
    Calculations for the Production Order
          " Determine the RM Cost/Unit and Mfg Conv Cost/Unit
          CLEAR t_afpo1.
          READ TABLE t_afpo1 WITH KEY aufnr = t_outputtab-aufnr.
          IF ( ( sy-subrc EQ 0 ) AND ( t_afpo1-wemng NE 0 ) ).
    BEGIN OF insertion VIP110703
           tmp_aufnr = t_production_costs-objnr+2(12).
           LOOP AT t_suborders_propcost
           WHERE aufnr = tmp_aufnr  .
            ADD t_suborders_propcost-proprmcost TO t_outputtab-totalrmcost
             ADD t_suborders_propcost-prop_mfg_convcost  TO
                  t_outputtab-mfgconvcost.
           ENDLOOP.
    END   OF insertion VIP110703
    BEGIN OF insertion VIP111003
            CLEAR: t_suborders_propcost , tmp_aufnr.
            READ TABLE t_suborders_propcost
            WITH KEY aufnr = t_outputtab-aufnr.
            IF sy-subrc = 0.
             t_suborders_propcost-proprmcost =
                 t_suborders_propcost-proprmcost * ratio.
              ADD t_suborders_propcost-proprmcost
                    TO t_outputtab-totalrmcost.
             t_suborders_propcost-prop_mfg_convcost =
                 t_suborders_propcost-prop_mfg_convcost * ratio.
              ADD t_suborders_propcost-prop_mfg_convcost
                   TO t_outputtab-mfgconvcost.
              tmp_aufnr = t_suborders_propcost-prevaufnr.
              bln_suborder = 'T'.
              WHILE bln_suborder = 'T'.
                CLEAR: t_suborders_propcost .
                READ TABLE t_suborders_propcost
                WITH KEY aufnr = tmp_aufnr.
                IF sy-subrc = 0.
                  t_suborders_propcost-proprmcost =
                    t_suborders_propcost-proprmcost * ratio.
                  ADD t_suborders_propcost-proprmcost
                        TO t_outputtab-totalrmcost.
                  t_suborders_propcost-prop_mfg_convcost =
                      t_suborders_propcost-prop_mfg_convcost * ratio.
                  ADD t_suborders_propcost-prop_mfg_convcost
                       TO t_outputtab-mfgconvcost.
                  tmp_aufnr = t_suborders_propcost-prevaufnr.
                ELSE.
                  bln_suborder = 'F'.
                  CLEAR tmp_aufnr.
                ENDIF.
              ENDWHILE.
            ENDIF.
    END   OF insertion VIP111003
    END   OF deletion VIP110703
           t_outputtab-mfgconvcost = ( t_outputtab-mfgconvcost /
                                       t_afpo1-wemng ) * d_mbgbtr.
           t_outputtab-totalrmcost = ( t_outputtab-totalrmcost /
                                       t_afpo1-wemng ) * d_mbgbtr.
    END   OF deletion VIP110703
          ENDIF.
          IF t_outputtab-wemng NE 0.
            t_outputtab-rmperunit = t_outputtab-totalrmcost /
                                    t_outputtab-wemng.
            " PM Cost Per Unit = Total PM Cost / Quantity Delivered
            t_outputtab-pmperunit = t_outputtab-totalpmcost
                                    / t_outputtab-wemng.
            " Conv Cost Cost Per Unit = (Manu Conv Cost + Pack Conv Cost)
            "                           / Qty Delv
            t_outputtab-ccperunit = ( t_outputtab-mfgconvcost
                                    + t_outputtab-pkgconvcost )
                                    / t_outputtab-wemng.
          ENDIF.
          " Total Cost Per Unit = (RM Cost per unit + PM Cost per Unit
          "                       + Conv Cost per unit)
          t_outputtab-totperunit = t_outputtab-rmperunit
                                   + t_outputtab-pmperunit
                                   + t_outputtab-ccperunit.
    Update the calculated values in the internal table
          CHECK d_tabix GT 0.
          MODIFY t_outputtab INDEX d_tabix
                             TRANSPORTING totalrmcost totalpmcost
                                          mfgconvcost pkgconvcost
                                          rmperunit pmperunit
                                          ccperunit totperunit waers.
    BEGIN OF DELETION VIP110703
         MOVE t_outputtab TO wa_prev_outputtab.
    END   OF DELETION VIP110703
        ENDAT.
      ENDLOOP.
    ENDFORM.                    " Z_PROCESS_DATA
    *&      Form  Z_DISPLAY_LIST
          text
    -->  p1        text
    <--  p2        text
    FORM z_display_list.
    Display the Report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            I_INTERFACE_CHECK        = ' '
             i_callback_program       = d_repid
            I_CALLBACK_PF_STATUS_SET = ' '
            I_CALLBACK_USER_COMMAND  = ' '
            I_STRUCTURE_NAME         =
             is_layout                = wa_listlayout
               it_fieldcat              = t_fieldcatalog
            IT_EXCLUDING             =
            IT_SPECIAL_GROUPS        =
               it_sort                  = t_sortsequence
            IT_FILTER                =
            IS_SEL_HIDE              =
            I_DEFAULT                = 'X'
            I_SAVE                   = ' '
            IS_VARIANT               = ' '
             it_events                = t_listevents
            IT_EVENT_EXIT            =
             is_print                 = wa_print_info
            IS_REPREP_ID             =
            I_SCREEN_START_COLUMN    = 0
            I_SCREEN_START_LINE      = 0
            I_SCREEN_END_COLUMN      = 0
            I_SCREEN_END_LINE        = 0
            I_BYPASSING_BUFFER       =
            I_BUFFER_ACTIVE          =
       IMPORTING
            E_EXIT_CAUSED_BY_CALLER  =
            ES_EXIT_CAUSED_BY_USER   =
           TABLES
                t_outtab                 = t_outputtab
          EXCEPTIONS
               program_error            = 1
               OTHERS                   = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      SET PF-STATUS 'Z_AB_STANDARD'.
    ENDFORM.                    " Z_DISPLAY_LIST
    *&      Form  Z_FILL_FIELDCATALOG
          text
    -->  p1        text
    <--  p2        text
    FORM z_fill_fieldcatalog USING      p_rownum LIKE sy-curow
                                        p_colnum LIKE sy-cucol
                                        p_fieldname TYPE slis_fieldname
                                        p_tabname TYPE slis_tabname
                                        p_reffield TYPE dd03p-fieldname
                                        p_reftable TYPE dd03p-tabname
                                        p_qfield TYPE slis_fieldname
                                        p_qtab TYPE slis_tabname
                                        p_sum
                                        p_stext
                                        p_mtext
                                        p_ltext
                                        p_datatype
                                        p_outputlen.
    Prepare the fields for ALV list output
      CLEAR wa_fieldcatalog.
      wa_fieldcatalog-row_pos = p_rownum.
      wa_fieldcatalog-col_pos = p_colnum.
      wa_fieldcatalog-fieldname = p_fieldname.
      wa_fieldcatalog-tabname = p_tabname.
      wa_fieldcatalog-ref_fieldname = p_reffield.
      wa_fieldcatalog-ref_tabname = p_reftable.
      wa_fieldcatalog-qfieldname = p_qfield.
      wa_fieldcatalog-qtabname = p_qtab.
      wa_fieldcatalog-do_sum = p_sum.
      wa_fieldcatalog-seltext_s = p_stext.
      wa_fieldcatalog-seltext_m = p_mtext.
      wa_fieldcatalog-seltext_l = p_ltext.
      wa_fieldcatalog-datatype = p_datatype.
      wa_fieldcatalog-outputlen = p_outputlen.
      APPEND wa_fieldcatalog TO t_fieldcatalog.
    ENDFORM.                    " Z_FILL_FIELDCATALOG
    *&      Form  Z_PREPARE_FIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM z_prepare_fieldcat.
    Append all the display fields into the field catalog internal table
    First Row
      PERFORM z_fill_fieldcatalog USING 1 1 'PLNBEZ' 'T_OUTPUTTAB'
                                        space 'AFKO' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 1 2 'MAKTX' 'T_OUTPUTTAB'
                                        space 'MAKT' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 1 3 'CHARG' 'T_OUTPUTTAB'
                                        space 'AFPO' space space
                                        space space space space space
                                        0.
    Second Row
      PERFORM z_fill_fieldcatalog USING 2 1 'AUFNR' 'T_OUTPUTTAB'
                                        space 'AFKO' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 2 'GAMNG' 'T_OUTPUTTAB'
                                        space 'CAUFV' 'AMEIN' space
                                        'X' space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 3 'WEMNG' 'T_OUTPUTTAB'
                                        space 'AFPO' 'AMEIN' space
                                        'X' space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 4 'AMEIN' 'T_OUTPUTTAB'
                                        space 'AFPO' space space
                                        space space space space space
                                        0.
      PERFORM z_fill_fieldcatalog USING 2 5 'YIELD' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-010 text-010 text-010
                                        'QUAN' 17.
    Third Row
      PERFORM z_fill_fieldcatalog USING 3 1 'TOTALRMCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-011 text-011 text-011
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 3 2 'TOTALPMCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-012 text-012 text-012
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 3 3 'MFGCONVCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-013 text-013 text-013
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 3 4 'PKGCONVCOST' 'T_OUTPUTTAB'
                                        space space space space
                                        'X' text-014 text-014 text-014
                                        'CURR' 21.
    Fourth Row
      PERFORM z_fill_fieldcatalog USING 4 1 'RMPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-015 text-015 text-015
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 4 2 'PMPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-016 text-016 text-016
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 4 3 'CCPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-017 text-017 text-017
                                        'CURR' 21.
      PERFORM z_fill_fieldcatalog USING 4 4 'TOTPERUNIT' 'T_OUTPUTTAB'
                                        space space space space
                                        space text-018 text-018 text-018
                                       'CURR' 21.
    ENDFORM.                    " Z_PREPARE_FIELDCAT
    *&      Form  Z_GET_ALV_EVENTS
          text
    -->  p1        text
    <--  p2        text
    FORM z_get_alv_events.
    Returns table of possible events for a list type
      REFRESH t_listevents.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
            I_LIST_TYPE     = 0
          IMPORTING
               et_events       = t_listevents
          EXCEPTIONS
               list_type_wrong = 1
               OTHERS          = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        CLEAR: wa_listevents, d_tabix.
        READ TABLE t_listevents WITH KEY name = slis_ev_top_of_page
        INTO wa_listevents.
        d_tabix = sy-tabix.

    Hi Sai,
          You can try using MB51, use filter movement type 261. Add a filter for the posting date coverage.
    Then proceed. Click on the icon DETAIL LIST.
    Then click on the SUBTOTAL, add MATERIAL as a Criteria. The click the column AMOUNT IN LC.
    You should see the total issuances to per material.
    I hope this helps.
    Heinrick Palad

  • Report for Material Cost Estimate

    Hi Everyone,
    Is there any way that I could download a report from the SAP showing all the material cost estimates? Hope someone could help me. When I try using CK11n, there is no tab there for report downloads and it only shows one material.
    Thank you in advance
    Jahziel

    Dear Jahziel,
    In standard SAP the following reports are available:
    T Code : CK84_99 : COST_ELEMENT - Cost Elements
                 CK80_99 - Cost Components
                 CK84_99 - Itemization
    These reports will provide you the information at individual material level.
    Regards,
    Pavan Kumar Arvapally

  • Material cost / Price on sales order ?

    Do we get the material Cost / Price (Vendor Material price ) on sales Order ?
    I means can we see the material Cost and Material Sales price in Sales order ?
    Hope my question clear .

    Hi -
          Please follow above answer and ignore my reply. 
    Thanks!
    Anesh B
    Edited by: Anesh B on Oct 7, 2009 4:28 PM

  • Error while creating material cost estimate

    Hello All
    I am creating material cost estimate of FG whose components are SF & ROH-2. While creating cost estimate system gives an error message which states: :
    *No cost element segment exists for 40103110 on 01.09.2009
    Message no. CK048
    Diagnosis
    The consumption account found by automatic account determination for material STD-PRICE-SF does not exist for the date 01.09.2009 specified.
    Procedure
    Check the cost element segment's validity period
    Check cost element
    Or, if you have authorization, create a cost element which did not exist previously.
    Create primary cost element*
    Please provide your valuable inputs regarding this error message. Looking forward to your inputs & feedback.
    Regards,
    J K Tharwani

    Dear Jitendra,
    Its Seem primary cost element you mentioned is not defined for 09 period.For this go to KA06,gIve that cost element number and the Valid from  date as 01.09.2009 and valid to date as 30.09.2009, press enter it will take u inside the T.C,feed the relevant data and save.
    Now again take the costing run.This time system should not throw the error.
    Check and Revert back.
    Thanks and Regards,
    Jitendra DIlip Chauhan.

Maybe you are looking for

  • GL Data Transfer

    HI, I want  to ask will it be possible that entire one GL data Transfer  to another GL with out passing JV by any T-code or any other way?

  • Can I keep the data from multiple users on a Time Capsule separate?

    I have a Time Capsule which I use as a wireless router, etc. Everything is working fine. I have another user I'd like to allow to back up data to the same Time Capsule (using Time Machine as well). However, I'd like to keep the backed up data separat

  • How can I backup my IPod Classic to a CD/DVD or MP3 or external hard drive or PC?

    I have lots on my IPod from various places, including songs I converted from vynal records and from cassettes.  I don't have anywhere else but my Ipod.  If my Ipod goes, I lose these memories and important items forever.  Can someone help.  Is a back

  • How to embed image in email msg using MAC version of PSE

    I can embed an image as Photo Mail in email msg using WIN version of PSE8 but can only send the image as an attachment in MAC version. Is there a way to embed images in MAC version email msgs?

  • Record mode

    hi friends can any one pls send me notes on bw record mode and with clear steps ...how does it works ...and things like that ....sorry my mail id is   [email protected] thanking you all in advance, kavita