To calculate costs

Hi,
I'm using a summary column to calculate costs. I need to write a query to retrieve multiple values for costs and then add all of them up in the formula columns itself. I am a newbie. Could someone give me leads as to how to go abt with it? Thanks.

Do whatever you need to do in a formula column (PLSQL formula of a formula column):
function CF_1Formula return Number is
v_value1 number := 0;
v_value2 number := 0;
v_value3 number := 0;
begin
select sum(cost),
        a.country
   into v_value1
   from my_table a
  where a.country = :p_country; --a report parameter
v_value2 := :cs_cost; -- a summary column from a group below the one this cf_1 is in
select decode(:column1,'A',1,2)
   into value3
   from dual; -- a decode of the current value of column1
return v_value1 + v_value2 + v_value3;
end;

Similar Messages

  • Javascript - Working with Dates, Selection Boxes & Pro-Rated Amounts to Calculate Costs

    Hi, I'm looking for some help. I'm new to Javascript and working off my limited knowledge. Below are three (3) items I need help figuring out.
    ---JavaScript 1: Today---
    I have a Document Level Javascript that gets the current date and automatically enters it into a field. Below is the example:
    var f = this.getField("Today");f.value = util.printd("mm/dd/yyyy", new Date());
    Problem: Each time I open the PDF, the date gets updated.
    Need: I would like for the date to only be updated if the field is blank (empty).
    ---JavaScript 2: Registration Fee---
    On this same form (application) I would like to calculate TWO costs. The first cost is mandatory registration cost, however the amount is prorated based on the month the application is filled out. Below is the pro-rated amounts based on the remaining months in the year:
    Months Remaining     Fee
              12                       $15.00
              11                       $13.75
              10                       $12.50
              9                         $11.25
              8                         $10.00
              7                         $8.75
              6                         $7.50
              5                         $6.25
              4                         $5.00
              3                         $3.75
              2                         $2.50
              1                         $1.25
    Note: The cost per month is $1.25. You are required to pay for the current month plus any remaining months.
    So let's assume that you fill the application out in May 15th (05/18/2013). There are eight (8) months remaining in the year [May - Dec], so the pro-rated cost is $10.00 (See chart above).
    For this calculation, I need to create a Document Level Javascript that would get the date from the field we used above called "Today" and calculate the "Registration Fee" based on the pro-rated amount. Then I would enter the cost into two fields (Dollars & Cents) as "10 00". (See below).
    Form Example: $ [Text Field - Combo 2 characters] . [Text Field - Combo 2 characters] ---> "$ 10 . 00"
    ---JavaScript 3: Subscription Fee---
    The next fee is an optional fee for a magazine subscription. On the form, the user will check a box (Named: "Subscription") if they want to subscribe to this magazine. This is similar to the example above in that the costs is based on a pro-rated amount. Below is the pro-rated amounts based on the remaining months in the year:
    Months Remaining               Fee
              12                       $12.00
              11                       $11.00
              10                       $10.00
              9                         $9.00
              8                         $8.00
              7                         $7.00
              6                         $6.00
              5                         $5.00
              4                         $4.00
              3                         $3.00
              2                         $2.00
              1                         $0.00
    Note: The cost per month is $1.00. Unlike the previous example, you are ONLY required to pay for the remaining months.
    So let's assume that you fill the application out in May 15th (05/18/2013). There are eight (7) months remaining in the year [Jun - Dec], so the pro-rated cost is $7.00 (See chart above).
    For this calculation, I need to create a Document Level Javascript: If the user checks a box (Named: "Subscription") requesting the subscription, then get the date from the field we used above called "Today" and calculate the "Subscription Fee" based on the pro-rated amount. I would enter the cost into two fields (Dollars & Cents) as "10 00". (Same as above).
    Thanks,
    Stephen

    Two questions:
    1. For "function calculateRegistrationFee", how do I format the return value into 2 parts in order to populate the different fields below. Let's use this example, see screen shot below:
    2. For "function calculateSubscriptionFee", how do I format the return value into 2 parts (like question 1) & adjust for check box variable. If the user checks a box (named: "Subscription") requesting the subscription, then calculate cost. Else cost is $0.00. See screen shot:
    Thanks,
    Stephen

  • How to calculate cost(COGS) in Sales from project

    Dear all,
    I have a situation like this:
    My customer do not emplement PS(project system) and when managing sales from project, i don't know how to calculate cost of good sold for the service line.
    Each project (contruction site; building, ....), I use 1 material master as service item to manage. while project excecution, we issue material; collect labor cost; cost of external service, so on.... total up to COGS. but i don't know how to get this one in Sales order. Could you give me some suggestions?
    thanks!

    Dear,
    You need to create all these activities ( LABOUR CCOST/ COST OSFG EXTERNAL SERVICES)as Service Material and then put it into S.O. as Service Item and Bill the same.
    Regards
    AJIT K SINGH
    HAPPY TO HELP U

  • TCode where we can enter sales order number and calculate costing?

    At the sales order there is "Costing" (Ctrl + F7) button. Item by item we can calculate costing. Is there any transaction code where we can enter sales order number and calculate its items' costing?
    Thanks in advance....

    You can calculate cost in Va02 itself
    Is there any transaction code where we can enter sales order number and calculate its items' costing?
    In CK51 you can enter sale order line item and execute costing, system will update EKo2 value in sale order line item condition

  • To calculate cost from a cost factor to another

    Hi,
    Can we calculate cost from a cost factor to another?
    ex:
    A,B,X,Y,Z are cost factors
    A is a combination of 3 cost factors such as X+Y+Z=A
    B= 2.25 % of A.
    How can we achieve this through pricing?
    Regards,
    Sri
    Edited by: user12116236 on May 10, 2012 4:02 AM

    Hi,
    Did you get a solution for the cost factor calculation that you had mentioned? If so, can you please share it with me? I am having a similar issue and am not sure how to approach this.
    Thanks,
    Karthik

  • School trying to calculate cost of support per child

    Hi,
    I am hoping that someone here can help! We have been directed by our education authority to calculate the cost of the additional support each child receives. I am trying to create a table for ease!
    I have though, hit a problem! There are so many variables - I don't know where to start!
    - We have 5 support workers at the school - each on a slightly different wage.
    - The children receive different amount of support - some 30 minutes a day, 5 days a week - others 15 minutes 3 times etc.
    Basically I want the table to calculate -
    If little Johnny gets 15 minutes daily support 5 times a week from Mrs Brown (Annual salary £15,000), how much does little Johnny's support cost the school.
    or
    If Little Jenny gets 30 minutes support three times a week from Mr Evans (Annual Salary £12,000) how much does little Jenny cost the school.
    Hopefully I am making myself clear. Can anyone suggest some help?  The staff work around 28 hours a week (trying to figure what info is needed!)
    One area especially - seeing as I have only 5 support workers - can I enter their wages into a chart, and then call up their salaries - save me typing that in every time?
    Thanks in advance if anyone is willing to give me some help!

    Yes, you can calculate the percentage one child receives.  How you do it depends on whether each child is listed only once in the table or might be listed multiple times.  If only once, you can divide their cost by the total cost and do this on the same line their name appears. If they might be listed more than once, you will need to do a SUMIF to get the sum of the costs for that student using their name as the condition, then divide by the total cost.
    To handle groups, there are also two ways you might handle this.  You'll need another column. The easy way is to enter the number of students in that group and modify the cost/week formula so it divides by the number of students in the group. A better way would be to give each group a number or name or some other designation in that column, do a SUMIF to determine how many students are in that group, and divide the cost/week by that number. This second way is better in that if you make a change (add/delete someone from the group), you don't have to search out everyone else in the group and change their number too.
    I can't provide any formulas for you at the moment, I have to take off in a few minutes. The SUMIF for the number of students in the group would be of the form IF(the group column = "",1, SUMIF(...)) and you would use it directly in the cost/week formula or you could add another column for that number then use that column in the cost formula. In other words, if the student is not in a group (the column is blank), the number in the "group" is 1, else sum up how many students are in the group.

  • Unable to calculate cost in cProjects

    While working with cProjects Entrprise portal under
    Accounting costing saysy <b>"No data available"</b>when click on calculate following error message comes
    <b>"Cost/revenue rate ZPRJROLE004 is not valid in organization 00000000"</b>
    Please help in finding the solution

    Hi Prakash,
    please have a look at oss note 875275
    There is a Powerpoint attached with the description
    Regards
    Björn

  • Calculate cost in CJ13 transaction

    Hi,
    How to calculate the Total currency value for the Controlling Area in CJI3 transaction.
    Is there any table for the same.
    Thanks.

    Hi Sujata,
    Thanks for the reply...
    Actually I need to find out how to calculate Total cost in CO area currency in CJI3.
    In ALV SAP is showing the values for the samef or the line item for one WBS element and given posting document date at screen.
    Is there any table or FM for cslculating the same.
    Thanks...

  • CALCULATE COST FOR ITEM

    how do i calculate the cost of an item on a report
    in my database i have boms.  master and components. and regular items not bom
    the regular items have a reorder cost, avgcost,.  the master item does not have any of those.  how do i calculate in a report to sum the avgcost of the components for the master item.  if there is no avgcost then sum the reorder cost.
    example
    itemcode-itemtypereorder costavgcost--
    need report to show
    item A----regular item25.0024.00--
    24.00
    item AB--master0.000.00--
    220.00 
    item AB1component(regular item)-129.00--125.00--
    125.00    
    item AB2component(regular item)-100.00--95.00--
    95.00
    item AC--master0.000.00--
    250.00 
    item AC1component(regular item)-150.00-- 0.00--
    150.00
    item AC2component(regular item)-100.00--0.00--
    100.00
    PLEASE HELP.

    Thank you for the example Gordon.  Very helpful
    i created this query just changed the lastpurprc to be the pricelist 9 in opln as my reorder cost.
    SELECT     T0.ItemCode, 'Regular Item' AS 'Item Type',
    CASE T0.AvgPrice WHEN 0 THEN T3.PRICE ELSE T0.AvgPrice END AS 'Item Cost'
    FROM         OITM AS T0 LEFT OUTER JOIN
                          ITM1 AS T3 ON T0.ItemCode = T3.ItemCode
    WHERE     (T3.PriceList = 9)
    UNION ALL
    SELECT     T0.ItemCode, 'Master' AS 'Item Type',
    CASE SUM(T0.AvgPrice) WHEN 0 THEN SUM(T3.PRICE) ELSE SUM(T0.AvgPrice) END AS 'Item Cost'
    FROM         OITM AS T0 INNER JOIN
                          ITT1 AS T1 ON T0.ItemCode = T1.Father INNER JOIN
                          ITM1 AS T3 ON T1.Code = T3.ItemCode
    WHERE     (T3.PriceList = 9)
    GROUP BY T0.ItemCode, T3.Price, T3.PriceList, T1.Code
    UNION ALL
    SELECT DISTINCT
                          T0.ItemCode, 'Component' AS 'Item Type',
    CASE T0.AvgPrice WHEN 0 THEN T3.PRICE ELSE T0.AvgPrice END AS 'Item Cost'
    FROM         OITM AS T0 INNER JOIN
                          ITT1 AS T1 ON T0.ItemCode = T1.Code INNER JOIN
                          ITM1 AS T3 ON T0.ItemCode = T3.ItemCode
    WHERE     (T3.PriceList = 9)
    ORDER BY T0.ItemCode
    however my query gives me this result.
    itemcode-itemtypereorder costavgcost--
    need report to show
    item A----regular item25.0024.00--
    24.00
    item AB--master0.000.00--
    125.00
    item AB--master0.000.00--
    95.00 
    item AB1component129.00125.00--
    125.00
    item AB1regular item129.00125.00--
    125.00 
    item AB2component100.0095.00--
    95.00
    item AB2regular item100.0095.00--
    95.00
    item AC--master0.000.00--
    150.00
    item AC--master0.000.00--
    100.00
    item AC1component150.00 0.00--
    150.00
    item AC1regular item150.00 0.00--
    150.00
    item AC2component100.000.00--
    100.00
    item AC2regular item100.000.00--
    100.00
    if you notice the master is repeated but with cost of the components or regular item instead of the sum.
    also i only want to see only the component not to show as a regular item again.
    can u check my query.
    thank you in advance.
    Edited by: RUSS on Dec 30, 2009 12:41 PM

  • Function or trigger to calculate cost

    Hi,
    I have a question regarding a function or trigger. Not sure what to use.
    I have the following table:
    CREATE TABLE STAY_LOG
         LOGID NUMBER(4) NOT NULL,
         FLIGHTID NUMBER(5),
         ARRIVALDATE DATE,
         DEPARTUREDATE DATE,
         COST NUMBER(6),
         CONSTRAINT stlg_pk PRIMARY KEY(LOGID),
         CONSTRAINT fk_stlg_flightid
           FOREIGN KEY (.....)
           REFERENCES ...(...)
    );The cost attribute should be calculated automatically by the following formula: departuredate-arrivaldaten in hrs * hour_cost (hour_cost is retrieved from another table).
    I wrote the following function:
    CREATE OR REPLACE FUNCTION calc_cost2 (fid IN INTEGER)
    RETURN INTEGER
    IS
         hcharge INTEGER;
         duration INTEGER;
    BEGIN
         select ceil((departuredate-arrivaldate)*24) into duration from stay_log where flightid = fid;
         select hr_charge into hcharge from ......................;
         return(duration*hcharge);
    END;That does not seem to work when I insert a value into the stay_log table and call the function calc_cost2 in the column cost.
    Also rather than passing the fid (flightid) as an argument can you retrieve it from the column flightid from the row it is being processed for?
    Any help appreciated.

    Hi,
    I want to add a bit to what Francois has written...
    Probably the best mentioned option is to go for the third one, because of transparency. You will see how the column is populated right in your code and not hidden in a trigger.
    A trigger might be your choice if the inserts are coming from different sources (programs).
    But why not simply include your calculation directly in your insert statement?
    Something likeINSERT into stay_log (...,flightid, arrivaldate, departuredate, cost, ...) VALUES(..., 1, SYSDATE-1, SYSDATE, CEIL(SYSDATE-(SYSDATE-1))*24, ...); shall do it for you.
    Edited by: Guido on Oct 24, 2008 10:49 AM
    Corrected the syntax for the CEIL function.

  • Using Transaction Cost Extension - CSTPACHK - to calculate cost

    We want to use the transaction costing extension (CSTPACHK) to modify the cost of items. The procedure we want to modify is 'actual_cost_hook'. The documentation available, like the Costing User Guide, specify that we have to include our custom code and then return a 1 from the package to tell the Cost Manager to use the custom code instead of the standard code.
    What I don't understand, and what is not clear in any of the documentation, is what to do after we determined the custom cost. It is not a parameter in the procedure that we can send back to the standard process. Do we have to insert or update a table with the newly generated code? The documentation seems to suggest that we update the 'mtl_cst_actual_cost_details' table. But my concern is that it is a standard table and should therefore not be updated.
    What is the correct way of sending the newly generated code back to the standard process?
    Thank you,
    Elisca

    Hi Elisca,
    If you observe carefully structure of CSTPACHK, procedure actual_cost_hook is function called from Oracle standard package CSTPAVCP which use to process all material transactions.
    Now for your situation you should try to return calculated cost in fucntion actual_cost_hook thats enough.
    Remaining things system will take care.
    So dont think to update any standard tables, whatever function re turns system should update that cost.
    Let me know if you have any concern.
    Regards,
    Sarvottam.

  • Does not calculate cost

    Hi Gurus,
    I am calculating cost thru CK11 for a material, Hours exist in the Standard Values in Master recipe but in CK11 it is not picking those hours and hence giving cost(Over head) zero.
    This material is having only One production version.
    There are other material but cost is coming for them.
    Would you please explain this to me..
    Thanks in Advance
    Atul Bhardwaj

    Hi
    with respect to your query please check following steps in master receipe ( CRC2)
    CAN you check for costing tab that cost centre and activity type are assigned . prior to that  KP26 activity price planning should be complete.
    and also you check the overhead rates maitained for plant specific in the costing sheet in use
    tcode  KZZ2  For maintenace of OVERHEAD RATES and KZS2 for mainteance  of values in  costing  sheet
    i hope this will clear your issue can you check once and letme know
    thanks
    shaik

  • Calculate costs on customer-orders

    Hello,
    I'm unexperienced to IP / BPS (but I'm very experienced in BW! )but have to make proposal to a new project.
    We have to calcuale the margin of our customer orders.
    Therefore I have the following idea.
    Take orders, different attributes and quantity from Order-InfoCube (already available in BW with order - customer - quantity-revenue1-revenue2)
    Upload cost per Euro / Tonnage into IP (I have 10 different sub-cost-tables).
    My question is: how can I reach, that Tonnages from orders are multiplied by costs Euro / Tonnage ?? Can I write a formula like: (take attribute 1 and Quantity) * (cost per Euro/ Tonne) from Cost-Table 1 and write Keyfigure Cost_Attribute1 to a new Provider?
    At the end I want to build a query where I can report order - customer - orderd quantity- revenue1 - revenue2 - cost - margin.
    Thanks for your replies,
    Thomas

    Dear Harihara,
    <b>You must have all manufacturing master data associated with your manufactured material(s) set up.</b> This includes bills of material, work centres, routings, and activity prices. If you are charging overhead, you must also have maintained the costing sheet and the material master overhead key field.
    Hope this is helpful.
    Regards,
    Naveen.

  • Calculate shipment cost on day basis

    hi,
    how can i calculate the shipmentment cost on day basis.For this which condition type should be used in my shipment pricing procedure.

    hello, friend.
    to be honest, i have not tried that but i think it is possible.  you can go to IMG > Log Ex > Transportation > Shipment Cost > Pricing > Pricing control.  look into a condition type, go to 'Scales' and you will find 'scale basis' (value 'O' - time period scale in days) and 'unit of measure' (days).
    i guess you also need ABAP enhancement to calculate the number of days between planning and shipment completion to calculate costs in days.
    regards.

  • Cost of Goods Sold Calculations

    I have a planning folder where the user first enters a company code, a currency and a profit center into the respective variables.  In the subsequent template user enters material SKU along with planned Sales Quantity and planned Average Selling Price (ASP).  I load standard prices for all material from R/3.  I have two FOX formulae running in the background as soon as the user saves his/her entries.  First one calculates product revenue, which is (ASP * Quantity).  This one works perfectly fine.  The second formula needs to calculate Cost of Goods Sold (COGS), which is (Standard Price * Quantity).  This formula fails miserably.  As far as my understanding goes, in order for a FOX formula to work all the characteristics that are not in the parameter group between the standard price record and the quantity record should match exactly.  If there is an inherent mimatch between the records then you try to take care of the mismatch in the FOX formula by hard coding.  The quantity records have SKU, company code, profit center, currency (!yeah, currency!), units of measure.  Whereas the standard price records have SKU, distribution plant, currency.  I understand that I can put # sign for company code and profit center in the FOX formula for selecting a standard price record, but unfortunately the currency of the standard price record may not be the same as that of currency of the quantity record since many materials are sourced from a distribution center outside the company code!!  So the simple multiplication of Std price * quantity is not working!!!
    I think of two options here.
    1.  As it doesn't make sense to populate currency field for a quantity record, I should move the currency variable into the data field for ASP records only.  This way I can put # in currency field for quantity record selection.  But the downside of this is that instead of posting quantity and ASP in one record into the cube, two seperate records get posted when user saves the data.  As our users plan on 10000 different SKUs across the globe, this may not be a good idea unless the option two doesn't work.
    2. There must be a way to make the FOX formula work even with the mismatch of currencies between quantity and standard price.  I need your inputs in this regard.
    If someone could also explain whether or not my understanding of FOX formula is correct, that would be great.  As always, I would appreciate all the helpful inputs with points.

    Yes FOX can be difficult to achieve things that are simpler than simple
    The way you described, it will only search fo a standard price on the same currency.
    Try to set the currency as changeable characteristic and then search prices for each possible currency.
    standard price value  = {standard price, currency1} +                 {standard price, currency2} etc..
    The possible currencies could also be filled in a variable which is read at runtime.
    Don't know an easier way!
    Regards,
    Beat

Maybe you are looking for

  • SharePoint 2013---How to convert current left Navigation into tree view

    Hi All, I want to convert current left navigation into tree view in SharePoint 2013. When we click on Modify Navigation and set headers and links; I need that should be convert into tree view. All headers should be expandable to thier links. I just w

  • WorkFlow and Fin Apps

    I am trying to support the Fin Apps environment. Developers are telling me that they need to use the "APPS" account to manage and maintain the workflow components. I would like to give them another account with the proper privileges. Is this possible

  • How to copy an album in iPhoto 6 from one drive volume to another?

    I downloaded some photos into three albums in a drive volume which I later archived for various reasons. How do I import those albums to my primary drive volume with the same iPhoto 6 vers. 6.0.6? Is it as easy as: File/ Import to Library/ Archive dr

  • Installing software on new hd

    I am installing a new hd in an iMac and wonder if I can copy the entire contents of the old d to the new d or if I have to install the os from the cd first, then copy the applications and content.

  • Why won't DW CS5 launch anymore?

    I read the faq and searched past posts. The one suggestion that might have helped -- deleting the Dreamweaver CS5 cache -- didn't change anything. It's been about six weeks since I was in DW, and now every time I click the program icon, all I get is