Search from 700 + Posts

Apr 8, 2010

How to customize OM to Recognize the COGS in Past Date

In this post I will provide brief information about how to customized COGS to recognize revenue in Past Period. This Post is more Technical and less Functional. For More Info on COGS please refer my previous posts on COGS
(Oracle Apps)

In R12, COGS got generated when Order line close.
Process - During Close Line Oracle Order Management Call API cst_revenuecogsmatch_grp.receive_closelineevent for COGS

One of parameter for this API is p_event_date and by default Oracle provides SYSDATE for this Parameter (as revenue recognition should be occur when order line close). Further this API insert the Data into cst_revenue_recognition_lines table and value in Parameter (p_event_date) got populated into LAST_EVENT_DATE column of this table.

Metalink description for this column is "The GL date corresponding to this revenue recognition percentage ". And to fulfill requirement to "recognition of cost of goods sold " on a date other than the date when line actually close, we need to populate date other than SYSDATE in this column.

Please Note that workflow background process (WBP) has nothing to with the COGS (cost of goods sold). WBP is just to progress any of line that is in Deferred status, many a time I notice that user are under impression that WBP is the process that close the line and execute COGS. , But actually it is not.

Below is little explanation about workflow in Order Management and workflow background process

Once we Book Sales Order line, workflow for line progress to SHIP_LINE Notified if SHIP activity involve in workflow, other wise it progress to "Deferred - Fulfill" activity.

Once we do ship Confirm and ITS (if applicable), workflow complete SHIP_LINE activity and progress to "Deferred - Fulfill". To Progress any workflow activity (I said any activity) from the Deferred status, we need to RUN WBP .Job of WBP is just to progress the line from Deferred status and nothing else.

Once WBP push the line from Deferred Status it go to FULFILL_LINE, INVOICE and then CLOSE_LINE with out any STOP (Unless you have some custom activity that Stop the workflow), Once workflow execute the Close line activity it calls COGS APIs, but since all that happened after WBP, user feel that WBP actually call COGS (cost of goods sold).


Let’s back to our Original Topic  -
Now to recognize cost of goods sold (COGS) in Past date, we need to update the value in cst_revenue_recognition_lines table, and I feel one of option is Write a Trigger and overwrite the value of column p_event_date.

Please Note that One of the basic generally accepted accounting practices is that both revenue and Cost Of Goods Sold should be recorded in corresponding accounting periods as dictated by the Revenue/Cost matching principle and COGS functionality in R12i has taken care of all this.

Solution suggested in this post is based on one of the requirement of my reader and it should not be implemented without analyzing the complete impact on the business and also by keeping in mind any customization of the standard functionality not supported by Oracle.

Below is flow of APIs.


  1. Hi eoracleapps,

    thanks for sharing infos... I believe this scenario (requirement) refers to the SHIP ONLY order line.

    More power.

  2. Hi,

    Thanks for the infos and more power.


  3. Hi Rommel

    Yes you are very much correct , above scenario is only for SHIP Only line.
    For Bill Only Lines , Invoicing activity plays an Inportant Role too.

    And thanks a lot for your comments

  4. Hi eoracleapps,


    This is in continuation for my requirement which was resolved through your generous guidance. Hope you could comment / assist me on this.

    Updating the LAST_EVENT_DATE to achieve a matched revenue and cogs for order lines using SHIP ONLY line flow to back dated orders/ship confirmation is generally working however I feel that this will not be a long term solution.

    Let me illustrate how the entire scenario/requirement.


    Inventory Item Transactable Stockable Shipped Costed Remarks

    ITEM A Yes No No No - resembles like a kit, we refer this as the principal item

    ITEM A1 YES Yes Yes Yes - component 1 of ITEM A

    ITEM A2 YES Yes Yes Yes - component 2 of ITEM A


    Inventory Item Shipping Invoice Lineflow

    ITEM A No Yes Bill Only

    ITEM A1* YES No Ship Only

    ITEM A2* YES No Ship Only

    *As a workaround these items are setup as Promotional Items in the modifiers. Item A1 and A2 are created and added in the Order Lines when Item A is requested.

    The order is picked and ship confirm. Eventually, will be processed for autoinvoice. In the invoice, it is only Item A appears. Component will not appear. (this is the desired behavior however, if only Item A1 is ordered, it will use an Order Lineflow which will pass through Shipping and to interface to AR which will appear in the invoice)

    Since in R12, the order lines using Ship Only line flow uses a GL date based on the last event date which is when was the order line status became CLOSED. Backdated and month-end transaction leads to a mismatch between the COGS and Revenue which are recognized in different period.

    P1 – Revenue Entries (Followed the Actual Ship Date used which is in P1)

    P2 – COGS Entries, (Order Line Closed at P2)

    Based on my reading from Oracle Cost Management Users Guide 7-26 concerning Sales Order: Configured Items PTO/ATO, that oracle supports the allocation of item cost between the earned and deferred COGS for ATO and PTO Items. Revenue/COGS su=ync for configured items is achieved by matching a shipped, costed lien to the invoiceable line that it mostly closely related to. If the shipped lien is invoiced, then the revenue recognition schedule for that line will be driven by the revenue recognition for the nearest invoiced line that it rolls up to.

    Does setup for ATO / PTO be my long term solution to avoid the use of the workaround setup wherein I got problem in COGS for some orders which are back dated under a line flow SHIP ONLY.

    I hope I have clearly illustrated the picture of the scenario and the requirement.

    Looking for forward to your response.

    Thank you and more power.



  5. Hi Rommel

    Sorry for Late Reply , I answered your email few days back but my email bounced back.
    Your Understanding for ATO /PTO is correct.Below are my Inputs
    COGS applies to Shippable lines from Inventory and, REVENUE occurs on lines that are invoiced by AR. In the case of ATO and PTO, the lines that are shipped are not necessarily the same lines that are invoiced. Upon Revenue recognition of an invoicable line, AR will notify Costing. Costing follows the below strategy in revenue/COGS matching for configured items (* items)

    Revenue / COGS matching for configured items is achieved most logically by matching a shipped line (line with cost) to the Invoicable line that it most closely relates to. If the shipped line is itself invoiced, then the revenue recognition schedule for that line should drive COGS recognition. If the shipped line is not invoiced, COGS for that line should be driven by the revenue recognition for the nearest invoiced line that it rolls up to.

    Hope that Helps