Oracle Support Services, Centers of Expertise

OM: Cost of Goods Sold Account Generator


OM: Cost of Goods Sold Account Generator

 Oracle Corporation

Table of Contents
COGS Account Generator Chart of Accounts Set of Books COGS Account

3 4 7 8 8 9
9 9 10 11

Loading a Workflow Definition from a database Saving the Workflow Definition to a File

11 16
16 18

Item Type Attributes Processes Functions Lookup Types

19 22 23 26 27

Get CCID for a line Get CCID from Salesrep’s revenue segment ‘Get CCID from the Model for an option’ and ‘Check if the line is an option line’ Get CCID from the Order Type ID Get CCID From the Item and Selling Operating Unit Get Salesrep’s ID Get the Transaction Type for a Commitment ID

29 30 32
32 32 33 34 34 34 36


Upgrade from Flexbuilder


Copy Segment Value from Code Combination Copy Segment Value from other Structure Code Combination Assign Value to Segment

36 37 38

Debug parameters in the stored procedures Testing the Workflow Process Using the cogs_11i script Running in Synch versus Debug

42 43
43 44 47


47 48 49 51


COGS Account Generator – The New Flexbuilder
Richard Mercer Oracle Corporation: Center of Expertise

The COGS Account Generator incorporates Oracle Workflow to implement a new method of building a Cost Of Goods Sold (COGS) account and was introduced first in Release 11. In Release 11i this same concept is implemented with some variations. These variations were necessary since the data model for Order Management and Shipping Execution in 11i differs from that in Release 11. The Oracle Workflow Builder lets you create, view and modify the account building process with simple drag and drop operations. In previous releases (9.X and 10.X) the application uses the Flexbuilder functionality to generate the COGS Account. Although Flexbuilder offers acceptable results, it is difficult to “see” the flow of the account generation. Also, it is difficult to implement a custom solution using Flexbuilder due to the limitations Value Sets offer. In addition, the Flexbuilder solution lacks flexibility in many areas, such as in Multi-Org environments. The details of Flexbuilder go beyond the scope of this paper, and will only be touched on for comparisons to the COGS Account Generator where applicable. For further reference information about Flexbuilder, please see GSX Note: 66537.1 and the Oracle Flexfield Users Guide, Release 10. Thanks to the Workflow Builder graphical front end, the flow of the account generation is easy to envision. The ability to call PL/SQL procedures and functions offers an almost unlimited amount of flexibility. This is extremely valuable for PL/SQL developers who can leverage their programming knowledge without burdening themselves with the task of learning Value Set functionality. Workflow Builder is easy to use due to its graphical nature. In addition, troubleshooting a customer’s definition is much more simple, since they can save their configuration from the database to a Workflow Definition file (.wft), which you can then open on your local PC. A deeper knowledge of the Workflow Builder will make this paper more meaningful and is highly recommended, but should not be considered a strict pre-requisite. Detailed functionality of Workflow Builder also goes beyond the scope of this discussion, however the applicable objects incorporated by the COGS Account Generator will be briefly presented. Refer to the Oracle Workflow Guide Release 2.5 (A75397) for detailed information. In order to become comfortable with this product, you should stop now and load the Workflow Builder 2.5 if you do not currently have it installed. The prior release of Workflow Builder (2.0.x) will not be sufficient for Release 11i, since there have been columns added to some of the key Workflow base tables. The currently certified releases are:


there will be differences. For a specific example in customizing a process.wft file. Release 11 uses the item type called ‘Generate Cost of Goods Sold Account’. One final note regarding the differences in Release 11 and Release 11i versions of the Account Generator. I would suggest reading the rewritten Appendix E for Release 11 COGS Account Generator available through Metalink.5 The Workflow Builder can be downloaded by internal Oracle employees from http://www-apps.0. Details about Item Types are covered later in this document. Please be careful to use the applicable item type. that until that paper is rewritten for the Release 11i version of the COGS Account 4 . To view the associated cost for an item use the Item Costs Details form shown below (Costing: Item Costs. Item Costs). For each item in an inventory organization Oracle Applications has the ability to record the type and amount of costs to maintain the item. Please keep in mind This is a simple installation and instructions are provided via the web for Release 11i you will see both. Release 11i uses the item type ‘OM: Generate Cost of Goods Sold Account’.3 2. However. Why do you need a COGS Account? The Cost of Goods Sold Account is used to determine the profit realized from selling a product. The intent of this paper is to serve as a more general discussion of the OM: COGS Account Generator. This will be required to view the process definition provided by the customer in a .Oracle Applications 11. For a Release 11 version of the applications you will only see the ‘Generate Cost of Goods Sold Account’ item type. these versions do not share the same Item Type.0 11i Oracle Workflow 2.

Price Lists. The COGS Account shown is the default account of the item and not the account you will be building to interface to inventory as a sales order issue transaction.For this particular item you see that there is a total Unit Cost of $26. This is how you realize a profit. 5 . Price List Setup).70 made up of ‘Material’ and ‘Material Overhead’ costs. The idea behind running a business is to sell the product for more than it costs you to build and maintain it. If you assume no discounts have been applied to the item then you can derive the price strictly from the price list associated with the sales order (Order Management: Pricing.

00 . So Inventory knows how much it cost to maintain this item and Receivables knows how much money you made from the item. 6 . for an item it would look something like: Invoiced Amount .70 $28. The output reflects a detailed analysis of the above mathematical result. assume that the shipped quantity is interfaced to Inventory using the ‘Inventory Interface’. Operational Analysis). The question becomes how do you determine the profit realized from the sale of an item? The answer is that the costing module can reconcile these two values. In order to run this report you first must run the ‘Margin Analysis Load Run’ program to populate the temporary tables with values. and the selling price and associated data is interfaced to Receivables using the ‘Receivables Interface’.To sum up the role of Order Management you can say it acts as a method of distributing product to a customer and in turn. Mathematically.30 One such report that reconciles these two values is the ‘Margin Analysis Report’ (Cost: Report.Cost of Goods Sold Profit $55. For completeness sake. interfacing that information regarding the item to Inventory (to decrement stock) and interface data regarding money to Receivables (to invoice the customer) for recognizing revenue.$26.

This is a reporting tool you actually build via forms by populating tables for the rows and columns that will be displayed. however. etc. the COGS Account Generator derives the Account to record the Cost Of Goods Sold against. information regarding the shipped quantity is passed to the inventory module through the MTL_TRANSACTIONS_INTERFACE table. This makes perfect sense. Among the data passed to inventory includes the shipped quantity. and refund the customer using a Credit Memo in Receivables. it does not insert the dollar figure of the cost itself. which enables you to write reports for the purpose of analysis and reporting out of the GL. the same COGS Account Generator process is called when the item is received into inventory via the Receipts Form. in segregating the data in this fashion comes in the FSG report functionality. RMA number.The true benefit. Inventory Interface/RMA Interface A few more details regarding the interfaces to inventory are needed at this time. Fortunately. the data is made visible to the receiving clerks in the warehouse. which are covered in more detail later. When the RMA has been copied or references a Sales Order. as you can obviously imagine. First. information such as expected quantity to receive. an attempt is made to derive the COGS Account from the sales order information and not the RMA information. you can write these reports any way you prefer. When the RMA is entered in Order Management and booked. Item ID. this amount is calculated and recorded when the transaction is picked up out of the Interface tables and processed by the Material Transaction Manager. it only provides the COGS Account to record cost against. consider the interface for a sales order after shipments have been made to a customer. there is an often overlooked. It is cumbersome to set up but is very flexible for writing reports out of the GL tables and far easier than doing this out of Oracle Reports. When the Inventory Interface inserts a row for a transaction. What happens when the customer sends product back to the inventory organization using a Return Material Authorization (RMA)? In a typical scenario. The ability to flexibly generate the COGS makes the power of reporting out of the GL much more meaningful. but important piece of information populated into the DISTRIBUTION_ACCOUNT_ID column of this table.DISTRIBUTION_ACCOUNT_ID column. Rather. At this point you should realize that the purpose of the COGS ACCOUNT GENERATOR is to derive the value to place into the MTL_TRANSACTIONS_INTERFACE. In Release 11i. The COGS Account Generator in both cases derives this account ID. you would receive the product and restock it using the inventory module. In other words. This is the ID that identifies the Cost Of Goods Sold (COGS) Account for this transaction. When an item is shipped to the customer. However. because if you log data against an account for the outgoing sales 7 . picking information. FSG is the Financial Statement Generator. This is the previously mentioned Inventory Interface. shipped date. The account itself is made up of segments.

This causes a purchase order to be issued for the sales order line so a third party vendor may ship the product directly to the customer. When Order Management interfaces invoice information to Receivables. this is not the case. Some customers have requested that the software offer the ability to build the account and pass it to the applicable interface table(s). you must perform a ‘receipt’ into a phantom subinventory.order. Order Management does not insert rows into this distribution interface table during the interface process. Receivables has an interface table called RA_INTERFACE_DISTRIBUTIONS_ALL. What about Drop Shipments? The ability to process Drop Shipments is relatively new functionality. However. this is the table that contains the DISTRIBUTION_ACCOUNT_ID for recording Cost of Goods Sold accounting information. it does so through the RA_INTERFACE_LINES_ALL table. Receivables Interface If it is the responsibility of the Order Management process to pass the account ID to the Inventory module. which can optionally be used and is designed specifically to distribute revenue among accounts. The Receiving Transaction Manager inputs this record into the MTL_TRANSACTIONS_INTERFACE table upon recognizing the receipt as a Drop 8 . When the AutoInvoice program does not find rows in the RA_INTERFACE_DISTRIBUTIONS_ALL table related to transactions in the RA_INTERFACE_LINES_ALL table. As mentioned before. In order to recognize the fact that the items have been delivered (so you can invoice the customer). by using the MTL_TRANSACTIONS_INTERFACE table. you would want to ensure that for the return you offset the data in the same account. At the same time a transaction out of the phantom subinventory must be recorded to keep the On-hand quantity netted out to zero. A Drop Shipment involves entering a sales order as an ‘External’ source type. at this time. this is considered a customization that can be handled by a trigger on the RA_INTERFACE_LINES_ALL table. However. These transactions ‘into’ and ‘out of’ the inventory organization are processed by the Receiving Transaction Manager and Material Transaction Manager respectively. it provides a default distribution account and applies it to the transaction line. Order Management does not pass account distribution data as it does to Inventory. then it would likewise make sense that it would have the same responsibility when interfacing to Receivables. The transaction recorded going ‘out of’ the inventory organization is done in the same way as a normally shipped line. These lines are then picked up on the Receivables side by a program called AutoInvoice.

It uses the workflow processing engine to derive the Cost of Goods Sold account for a transaction interfaced to Inventory from Order Management/Shipping. COGS Account Generator Terms At this time it would be prudent to ensure you understand the key terms used throughout this paper. COGS Account Generator This is the workflow process that has replaced the Flexbuilder functionality of Release 10. Chart of Accounts The Chart of Accounts is the accounting structure definition and you will often hear this referred to as the ‘structure’ or ‘accounting structure’. The value for the DISTRIBUTION_ACCOUNT_ID column is derived by calling the COGS Account Generator Workflow process in the same fashion as the Inventory Interface would. The segment definitions can be retrieved from the Define Key Flexfield Segments form (Setup ⇒ Financials ⇒ Flexfields ⇒ Key ⇒ Segments).Shipment. For instance in the VISION Database you use the ‘Operations Accounting Flex’ as the Chart of Accounts structure for the set of books referenced. From this you define the number of segments making up an account. Next choosing the Segments button reveals the following: 9 . the name of the segments and the data limitations of the segments. By choosing the flashlight and picking the ‘Accounting Flexfield’ you will see the ‘Operations Accounting Flex’.

Many times you will see a reference to the ID_FLEX_NUM. This is important for segments derived from the Operating Unit level (i. the ID_FLEX_NUM represents the specific structure for the Chart of Accounts. In this case the ID_FLEX_NUM = 101 for the ‘Operations Accounting Flex’. and are referred to as the 3 C’s: Currency. Calendar and Chart of Accounts. The ‘Order Management. Hint: use the Examine utility to find this information while in the screen above. 10 .e. SuperUser’ responsibility is tied to the ‘Vision Operations’ operating Unit. The Set of Books for the Inventory Organization (Warehouse) into which you will be interfacing the COGS Account ID needs to be determined. When you see this for an ID_FLEX_CODE = ‘GL#’ (Accounting Flexfield). Set of Books The set of books is where the Chart of Accounts is determined for the referenced responsibility. those from Multi-Org partitioned tables) such as the Order Type COGS and Salesperson Revenue Account. which uses the ‘Vision Operations (USA)’ Set of Books. The Oracle Order Management application uses the Set of Books tied to the operating unit viewed from the Define Organizations form. The ‘Column’ name maps to the column name in the GL_CODE_COMBINATIONS table.This structure consists of 5 segments each with its own name. Three entities make the Set of Books unique.

Assume that a segment combination for the COGS Account was derived to be 01. Tab once and you will see the following screen where the Set of Books for this inventory organization is assigned. (Inv: Setup ⇒ Organization ⇒ Organizations).000. click the ‘Others’ button. Choose ‘Accounting Information’.5360. It is identified by a CODE_COMBINATION_ID (CCID). The steps for determining this are: Get the value of the Set of Books for the inventory organization for which you wish to interface the transactions.COGS Account This is the Cost Of Goods Sold Account which is the account that maps to a row in the GL_CODE_COMBINATIONS table. Query the name of the inventory organization desired.0000. CODE_COMBINATION_ID ------------------16801 Determining the Chart of Accounts You should now review how to find out the Chart of Accounts referred to by a particular shipment transaction. The CCID can be found using the following statement: SQL> select code_combination_id from gl_code_combinations where segment1 = '01' and segment2 = '540' and segment3 = '5360' and segment4 = '0000' and segment5 = '000' and chart_of_accounts_id = 101. then with the cursor on the ‘Inventory Organization’ organization classification. having a unique combination of SEGMENT values. 11 .540. Get this from the Organization Definitions form.

Accomplish this task in the same way as with the inventory organization as demonstrated above. Query this Set of Books up in the Define Set of Books form (Setup ⇒ Financials ⇒ Books). except place the cursor on the ‘Operating Unit’ line rather than the ‘Inventory Organization’ line. 12 . Record the value for the ‘Chart of Accounts’.Note: It may be necessary to determine the Set of Books for the Order Management responsibility for which the order is assigned.

Now query up the Chart of Accounts in the Define Key Flexfield Segments form (Setup ⇒ Financials ⇒ Flexfields ⇒ Key ⇒ Segments) to find the number and type of segments for this accounting structure. (See figure in the previous section). Finally. find the workflow process this chart of accounts uses when building the COGS account from the Account Generator Processes form (Setup ⇒ Financials ⇒ Flexfields ⇒ Key ⇒ Accounts) 13 .

organization_id. select ood.---------------Vision Operations 1 Seattle Manufacturing 1 Chicago Subassembly Plant 1 Boston Manufacturing 1 Miami Distribution Center 1 Singapore Distribution Center 21 Vision Services 62 Vision ADB 42 14 . org_information1 set_of_books_id From org_organization_definitions ood. organization_name warehouse.Scripts for finding the above objects follows: First get the SET_OF_BOOKS_ID for the inventory organization (warehouse) from the following scripts: Column warehouse format a30.inventory_enabled_flag = 'Y' and hoi.organization_id = hoi. SQL> / ORGANIZATION_ID --------------204 207 208 209 210 229 458 498 WAREHOUSE SET_OF_BOOKS_ID -----------------------------. column set_of_books_id format a16.org_information_context = 'Accounting Information' order by ood.organization_id.organization_id and ood. Hr_organization_information hoi Where ood.

600 602 603 604 605 606 Vision Project Mfg Atlanta Manufacturing Los Angeles Manufacturing Cleveland Manufacturing San Diego Manufacturing Dallas Manufacturing 102 102 102 102 102 1 14 rows selected. set_of_books_id.) 104 50317 9 rows selected. If you would like to see the segment information for this structure.-------------------Vision Operations (USA) 1 101 Vision Distribution (SNG) 21 50195 Vision Corporation (UK) 22 50194 Vision ADB (USA) 42 50214 Vision Services (USA) 62 50234 Vision ADB Holdings (UK) 82 50274 Vision Project Mfg (MRC) 102 50317 Vision Project Mfg (EURO Rpt) 103 50317 Vision Project Mfg (USA Rpt. Suppose you would like to get the chart of accounts for the SET_OF_BOOKS_ID=1. SET_OF_BOOKS_ID S_OF_B_ID.--------------. Select NAME SET_OF_BOOKS. select segment_num. Enter value for set_of_books_id: 1 SET_OF_BOOKS SOFB_ID CHART_OF_ACCOUNTS_ID CHART_OF_ACCOUNTS_NAME -----------------------------. chart_of_accounts_id from gl_sets_of_books SQL> / NAME SET_OF_BOOKS_ID CHART_OF_ACCOUNTS_ID -----------------------------.--------. Next. then use: SQL> select name. CHART_OF_ACCOUNTS_NAME From GL_SETS_OF_BOOKS_V WHERE SET_OF_BOOKS_ID = &SET_OF_BOOKS_ID.--------------------------Vision Operations (USA) 1 101 Operations Accounting Flex Now you see the CHART_OF_ACCOUNTS_ID and the name of ‘Operations Accounting Flex’. CHART_OF_ACCOUNTS_ID. segment_name from fnd_id_flex_segments_vl where enabled_flag='Y' and id_flex_code = 'GL#' 15 . get the segment definitions for the Chart of Accounts for the Vision Operations (USA) which is CHART_OF_ACCOUNTS_ID = 101. COLUMN S_OF_B_ID FORMAT 9999999.-------------------.

start the Workflow Builder application on your client. You simply open up this transferred . Finally find the workflow process assigned to this chart of accounts for the COGS Account Generator.and id_flex_num = &Chart_of_accounts_id order by segment_num. Choose the open folder icon from the Navigator or choose File ⇒ Open… from the menu. Loading a Workflow Definition from a database In order to load the workflow definition file from a database.-----------------------------101 DEFAULT_ACCOUNT_GENERATION A single script for retrieving this information is provided in Appendix A of this paper. There are 2 methods of loading workflow definitions into Workflow Builder: from the database. wf_process_name from fnd_flex_workflow_processes where id_flex_code = 'GL#' and wf_item_type = 'SHPFLXWF' and id_flex_num = &chart_of_accounts_id. The following window appears: 16 . Loading the Workflow Builder Definition Workflow Builder is a Client side GUI application and can be used to define process flows for use with Oracle Applications. select id_flex_num. ID_FLEX_NUM WF_PROCESS_NAME ----------.wft) into your client Workflow Builder application. and saving it to their client as a file. This is achieved by having the customer load their workflow definition in from their database. and from a file. This creates an ASCII file on the customer’s client PC which is then emailed or FTP’d to you.wft file in your client Workflow Builder application. As mentioned in the introduction. Enter value for chart_of_accounts_id: 101 SEGMENT_NUM ----------1 2 3 4 5 SEGMENT_NAME -----------------------------Company Department Account Sub-Account Product 5 rows selected. troubleshooting a customer’s database workflow definition is made easier since you can load their workflow definition file (.

contact your system or database administrator and ask them to set up your tnsnames. This moves the item to the Visible list as follows. (NOTE: If this connection is not successful.The default load source will be from a File. Password and Connect fields for the application database for which you are designing the workflow definition. Choose this definition from the Hidden list and click on the <<Show button. Instead.ora file properly to connect to the desired instance). Clicking on the OK button will display all the workflow Item Types loaded into the database. You want to see the OM: Generate Cost of Goods Sold Account definition. choose the Database radio button and enter the User. 17 .

or Browse the desired name of the file as shown. Saving the Workflow Definition to a File Now that you have the workflow definition in memory on the system. you can save it off on your client as an ASCII file with a . A similar form as the Open function is displayed. In order to do this you choose File ⇒ Save As…from the Menu.wft extension. Although this does not look very interesting at this point. This time you will choose the File option and enter. Currently you are only concerned with loading and saving the definition. When modifications are made to this definition you have the ability to save the changes back to the database. This would be done by simply choosing the save icon or choose File ⇒ Save from the menu. 18 . rest assured there is more to come.Click the OK button and the workflow definition is loaded into memory on your client.

please refer to the Oracle Workflow Guide Release 2. They are the ‘OM: Generate Cost of Goods Sold Account’ and the ‘Standard Flexfield Workflow’ as shown: 19 . Item Type By expanding the Navigator for the apps@z11i icon. Attributes represent global variables. In short. For an in depth definition of each of these objects. Workflow Builder Objects In order to better understand the entities of the workflow process definition. A full description of each of these components exceeds the scope of this paper.This is a file that can be delivered via email. you will see 2 Item Types. the Item Type would represent the main program call. and Functions represent private or public functions for the subprogram. consider an analogy between these objects and what they represent from a programming perspective. etc. Processes are the subprograms. ftp.5 (Part No: (A75397). for review by others.

From this main procedure call it will have enough information to decide which of the process flows to use for the Chart of Accounts being referenced. right click on the ‘OM: Generate Cost of Goods Sold Account’ icon in the Navigator and choose Properties. You will see the following: 20 . This is the item type that encompasses all processes designed to build the COGS account when interfacing transactions from Order Management to Inventory. mostly because you may desire to build accounts differently for each Chart of Accounts. It may contain multiple Processes. Think of this Item Type as the main procedure call to the workflow definition when making a call to build the COGS account for a transaction from OE/Shipping to the inventory application. It has an internal name of OECOGS.There is one item type for the ‘OM: Generate Cost of Goods Sold Account’. In order to see the Properties of the Item Type.

Messages and Lookup Types. Functions and Lookup Types (See the following screen shot). So. They include the Attributes. such as. Beneath the item types you will find all other entities which make Workflow Builder complete. which are available not only to the ‘OM: Generate Cost of Goods Sold Account’. Think of it as the global procedure calls. 21 . etc. copying a segment value to the destination account. Processes. Processes. this Item Type contains the public functions available for use by all other processes.The other Item Type displayed is the ‘Standard Flexfield Workflow’. Of these the OM: Generate Cost of Goods Sold Account uses the Attributes. Notifications. but to all other account generator item types. Functions. validation of the segment combinations. These will have common functions.

Through the use of function calls you may assign specific data values to these Attributes for use by other function calls within the Processes. You do this with 2 function calls. As you can see there are many more Attributes available. Of these. The first is to determine the Transaction Type. For instance. The first function must store the value for use by the second function.Attributes The best way to understand how the workflow Attributes are used is to think of them as global variables. and include: Commitment ID Customer ID 22 . followed by feeding this value to the second function (custom) to find the Account CCID. you must first derive the Transaction Type. In this particular case the Attribute used is the ‘Transaction Type’ highlighted below. In order to retrieve the account. 12 of them are assigned values when a CCID is requested to be built by the Inventory Interface. This is where the Attributes enter the picture. assume you wish to retrieve segments based on an account tied to the Receivables Transaction Type of a Commitment.

Finally. Processes Processes are used to define the Function flow employed to derive the segments of the COGS Account. it is possible to create custom Attributes. you may wish to derive the first segment of an account from the COGS Account assigned to an order type of the sales order. It would be prudent then to create an Attribute called ‘Line Type Code’ and employ it to hold the value of the line type. Suppose you wished to store the ‘Line Type Code’ for the line of the sales order for use by a custom Function.Order Category Header ID Line ID Order Type ID Organization ID (warehouse ID) Org_id (Operating Unit) Chart of Accounts ID Salesrep Id Inventory Item Id Option Flag As with any variable within a normal program. To see the properties of the Attribute right click on the applicable value and choose Properties. For instance. the old value is gone. If there is no value there then you may wish to grab the value from the first segment assigned to the COGS Account associated with the item on the line. The process would show a flow calling for the order type account first and then alternately the item COGS account. You further decide that this value may be needed by a number of Functions within your process flow. once the Attribute is assigned a new value. Expanding the Processes icon reveals the following seeded processes: 23 .

there is no flexibility for modifying the COGS Account generation in the future using this approach. That is. it retrieves all segments from the COGS Account assigned to the item in the shipping inventory organization. you can see the simple process flow. and can simplify the implementation of Release 11. This requires some upgrade steps to fulfill this functionality. The ‘Generate Default Account’ is a seeded process which builds the COGS Account in the same manner as the Default definition in Flexbuilder. do not be concerned with the meaning of each function call within this process. A process is assigned to the Chart of Accounts in the ‘Account Generator Processes’ form. This small exercise will be covered in more depth later. At this point. 24 .Customers who have upgraded from version 10 of Oracle Applications and wish to simply use the rules as they were defined in FlexBuilder may use the ‘Generate Account Using FlexBuilder Rules’ process. All Chart of Account structures call this Process by default. however. By double-clicking on the ‘Generate Default Account’ process (see below). but rather just make the point visually that this is where the flow of the account generation is defined.

This is what makes this approach so appealing. there is the ability to create additional Processes. or any other object in Workflow. Properties are available for the Processes using the right mouse button (see the screen shot below). And as with other objects. Note: The Runnable checkbox of the properties must be set in order to assign this process to a Chart of Accounts. 25 . it allows an unlimited number of configurations for the account generation.Just as with Attributes.

experienced PL/SQL programmers may leverage their vast knowledge store in generating a flexible and powerful workflow definition. In order to trace an existing icon to its PS/SQL function call. choose Properties from the right mouse button which reveals the following display: 26 . So. These functions are incorporated into the workflow Process by dragging them from the Navigator onto an open Process flow.Functions Of all the workflow attributes reviewed in this paper this is the most appropriately named for the programming analogy being made. Functions in the workflow paradigm are analogous to functions from a programming perspective. it maps to a PL/SQL procedure or function call. however. A workflow Function is represented by an icon.

but are implemented as part of the ‘Standard Flexfield Workflow’. Data Types are used to limit the values a 27 . be an important element for the purpose of customizing the Account Generator. Lookup Types Lookup Types are not implemented as part of the seeded entities in the ‘OM: Generate Cost of Goods Sold Account’ Item Type. each seeded function will later be described independently. What is the purpose. meaning that their intended purpose is only for the generation of a COGS account.This screenshot shows the underlying function for the ‘Get CCID for a line’ Function to be OE_FLEX_COGS_PUB. in having Functions for both the ‘OM: Generate Cost of Goods Sold Account’ and the ‘Standard Flexfield Workflow’? What you can observe here is an analogy to public and private functions.e. The ‘Standard Flexfield Workflow’ Functions have a much broader intent. This falls in line with the programming analogy. The functions for the ‘OM: Generate Cost of Goods Sold Account’ represent private functions. They may. therefore. They are not only implemented when defining COGS Account workflows. Expanding the Function icon on the navigator displays the following: Functions may accept input variables in the form of Attributes. then. ‘PO Account Generator’. but also any workflow process that is used to generate an account (i. however. where OE_FLEX_COGS_PUB is the package name and GET_COST_SALE_ITEM_DERIVED is the function name. etc. Just as programming functions may accept input variables. The Lookup Types may be likened from the programmer’s perspective to Data Types. so too the Workflow Functions may be fed input values.).GET_COST_SALE_ITEM_DERIVED. This is done simply by dragging Attributes from the Navigator onto the Function within the same Navigator. The purpose of each function is a key element in understanding the COGS Account Generator. and therefore they can be equated to public functions.

it may be easier to equate Lookup Types with them. instead. The details of creating this Lookup Type exceed the scope of this paper. As just alluded to. Lookup Types are used to constrain acceptable return values for a Function. assume a custom function is designed to return an order type name of ‘Domestic’. ‘International’ or ‘Default’. To create a condition that would only return one of these three values would fit the need for a Lookup Type.variable may be assigned. you will notice a field labeled ‘Result Type’ which contains a value called ‘Flexfield Result’. refer to the white paper entitled ‘Appendix E Addendum’ for details in accomplishing this task. Lookup Types are commonly associated with results returned from a Function. If you look at the properties of the Function as displayed earlier. so too. Just as Independent Value Sets are used to constrain the values for a segment. It essentially states that the 28 . The finished product of such a custom Lookup Type would look like the following screenshot: Note: For those intimately familiar with Independent Value Sets as they are used with Flexfields. For instance. This is a common Lookup Type associated with Functions.

Functions may restrict the applicable return values by associating it to a Lookup Type. 29 . just as a Data Type is used in a declaration of a Variable. See the following example: Concluding Observations about Workflow Objects In order to quickly review how all of these objects are hierarchically defined. consider the following broad observations: Item Types are at the top of the hierarchy and envelope all Processes for a workflow definition regarding a specific task (in this case. Each Process may use multiple Functions to achieve its desired task. and then a Variable would be declared.Function is expecting a value returned which is defined within the Lookup Type named ‘Flexfield Result’. Attributes may also constrain the data it may incorporate through the use of Lookup Types. Many Functions may be dragged from the Navigator to the Processes flow definition. In the world of programming a Data Type would be created. the task of building a COGS Account). which would use this Data Type. take the example of creating an Attribute which would only use values assigned to the ‘Order Type’ Lookup Type previously examined. Each Function has the ability to accept input by incorporating Attributes. in Workflow a Lookup Type is defined and then an Attribute uses this Lookup Type. Likewise. and the Workflow Lookup Type was equated to a programming Data Type. As an example of an Attribute using a Lookup Type. a Lookup Type may be used in the declaration of an Attribute. You can create an Attribute called ‘Order Type Name’ and assign it a ‘Type’ of ‘Lookup Type’ with a value of ‘Order Type’. Finally. So. or use these Attributes within the body of the PL/SQL function or procedure. Remember that the Workflow Attribute was equated to a programming Variable.

The ‘Generate Cost of Goods Sold Account’ item type is delivered with 2 predefined workflow processes. and a successful completion will conclude with ‘End generating Code Combination’. The remaining 5 are sourced from the ‘Standard Flexfield Workflow’ Item Type. This is the same default source used with previous versions of the application implementing FlexBuilder. Both of these functions do very little other than setting the provisions for debugging output. After the ‘Start generating Code Combination’ function. If you were to compare this more closely with the functions in the navigator you would observe that only one of these functions (‘Get CCID for a line’) is sourced from the ‘OM: Generate Cost of Goods Sold Account’ Item Type.GET_COST_SALE_ITEM_DERIVED) you see that the ‘Generated CCID’ Attribute is loaded with the COGS Account associated with the item as defined in the shipping inventory organization. it would be prudent to take an example workflow process and explore it. the flow is directed to the heart of the process. The ‘Generate Default Process’ will be explored. It is the simplest scenario for deriving the COGS Account. All Workflow processes for Account Generation begin with the ‘Start generating Code Combination’. Double-click on the ‘Generate Default Process’ and you will see the following design screen. When looking at the PL/SQL code for this function (OE_FLEX_COGS_PUB. in that it derives all segments from the COGS Account assigned to the item being transacted. ‘Get CCID for a line’.The ‘Generate Default Account’ Process Before continuing. NOTE: The code which calls the COGS Account Generator process takes into consideration whether 30 . It can easily be seen that this process is made up of 6 function calls.

The function ‘Get CCID for a line’ has a return Lookup Type associated with it called ‘Flexfield Result’. called FND_FLEX_SEGMENT1. With a successful completion of the function. regular sales order. it must be fed in as input to the function. and feeds in the applicable line_id. however. This function will simply transfer all Segments from the account just assigned to the ‘Generated CCID’ Attribute to the Segments for the COGS Account. change the ‘Constant’ value to ‘Item Attribute’ and choose a Value of ‘Generated CCID’.this is an RMA. a validation must be done on the generated segment combination. See the After condition above: Notice that the icon symbolizes that all source segments (top 3 yellow boxes) are being copied (shown by the arrows) to the destination segments (bottom 3 yellow boxes). and then choose the Attribute Values tab. of course. is not your intention. This operation is performed in the ‘Validate 31 . the Attribute ‘Generated CCID’ will be populated and the flow is directed to the function ‘Copy Values from Code Combination’. then an abnormal exception was encountered and the flow is directed to the error handling function. Just before ending the execution of the process. etc. To do this. you can see how this is achieved. In this case the error message is output to the log file and the workflow process ends. This means a NULL value is getting fed to the function. FND_FLEX_SEGMENT2. If you open the properties sheet for the icon as it exists within the process form. Note: These segments are actually hidden Attributes stored in the database. The input value called ‘Code Combination ID’ defaults to a Constant with no value as seen in the Before condition. A data integrity issue may cause this condition to be raised. This. ‘Abort generating Code Combination’. If the function returns a ‘Failure’. or an RMA which references a sales order. In order for the public function ‘Copy Values from Code Combination’ in the ‘Standard Flexfield Workflow’ item type to retrieve the Segments from the account assigned to the ‘Generated CCID’ attribute in the ‘Generate Cost of Goods Sold Account’. What is desired is to offer the ‘Generated Before After CCID’ as input.

The intent of this function is to retrieve the value for the ‘Salesrep ID’ attribute. With that as an assumption. Given the Line_id of the sales order line. This differs from 32 . Because the salesrep attribute is one that is populated during the initialization process. it allows for further probing into the other seeded functions within the ‘OM: Generate Cost of Goods Sold Account’ Item Type. and a Branching condition. this information is easily derived. hopefully a stronger understanding has been founded. the program would exit normally via the ‘End Generating Code Combination’ Function. then navigating to the Costing region. Finally. one for Upgrading from Flexbuilder. this takes the segments defaulted to the FND_FLEX_SEGMENT# attributes along with the specified chart of accounts and determines if a row exists in the GL_CODE_COMBINATIONS table for that combination. and use it to determine the Revenue account. if left unmodified.Code Combination’ function. These functions can be divided into 4 categories: those for retrieval of a CCID (account ID). Essentially. and can be used to design more flexible workflow processes for the COGS Account generation. Function Get CCID for a line Get CCID from Salesrep's revenue segment Get CCID from the Model for an option Get CCID from the Order Type ID Get CCID from the item and selling operating unit Get Salesrep's id Get Transaction Type for a Commitment ID Upgrade from Flexbuilder Check if the line is an option line Category Generate CCID Generate CCID Generate CCID Generate CCID Generate CCID Set Attribute Value Set Attribute Value Upgrade From Flexbuilder Branching Condition Get CCID for a line This function will return the CCID assigned to an item as it exists in the shipping warehouse. These functions are supported. it would be highly unlikely that this would fail validation. In this case since all values were defaulted from the same location. The Seeded COGS Account Generator Functions Now that a simple process has been investigated. those for setting Attribute values. The intent of this function is to retrieve the CCID from the Cost of Goods Sold assigned to the item on the sales order line within the shipping inventory organization. it does not need to be derived again. To see the value for this account from the application requires querying the item up in the Define Items form within the shipping inventory organization. The CCID return equates to the Cost of Goods Sold Account displayed. Get CCID from Salesrep’s revenue segment This function will return the CCID assigned to Salesperson’s Revenue account.

then it is a pre-requisite to first test if the option flag is set. which include OPT-1. There is a seeded function used to branch on this condition called ‘Check if the line is an option line’. then the CCID returned would be the COGS account for the PTO-1. rather than the OPT-1. Since this function only returns a value for the CCID if the line is beneath a model. Otherwise. the function will return an error for standard order lines. where the ‘Get Salesrep Id’ function needed to be called within the workflow process in order to set this attribute. ‘Get CCID from the Model for an option’ and ‘Check if the line is an option line’ The intent of this function is to return the CCID for the COGS Account of the top-level item rather than the component beneath the model that is being interfaced.Release 11. To clarify the workflow process might look similar to the following: 33 . If OPT-1 is interfaced to inventory using this function. The best way to demonstrate is with an example. Suppose you have a PTO model called PTO-1 and the bill of material has items beneath it.

Items are only defined in an Inventory Organization. Get Salesrep’s ID As mentioned previously. An argument was made that the two could be combined into one function. This is a simple function. In fact.A.8 of OEXWCGSB. and the function performs identically to the ‘Get CCID for a line’ function as of version 115. This is 34 . In order to see the Cost of Good Sold Account from within the application. OM Transaction Type) of the order. but should be used with care in the unusual event that the chart of accounts assigned to the Order Type of the order differs from the chart of accounts used by the shipping inventory organization. Go to the Finance Region and the field will be displayed. Items are never defined in an Operating Unit and therefore getting the CCID for an Item in the Selling Operating Unit can be unpredictable. in Release 11 this function was used in conjunction with the ‘Get CCID from a Salesrep’s revenue segment’. Upon this realization. The code at one time would try to retrieve the CCID from the item definition where the Organization_id for the item is equal to the ORG_ID for the operating unit of the line. Get CCID From the Item and Selling Operating Unit This function by its title is a bit of an oxy-moron. navigate to the Define Transaction Types form (OE: Setup ⇒ Orders ⇒ Transaction Types ⇒ Define). development has resolved this issue. It is a safer approach to avoid using this function.pls. one was useless without the other.Get CCID from the Order Type ID This function will return the CCID for the Cost of Goods Sold account assigned to the order type (A.K.

If there are no line level sales credits then the same task is performed for sales credits assigned to the header of the order. More often then not. First. That is a confusing mouthful. the salesrep is set based on the salesrep tied to the line of the order. This may return more than 1 row if the sales credits were split evenly among multiple salespersons. Therefore. However. In Release 11i. it looks like: SELECT INTO FROM WHERE AND SALESREP_ID l_salesrep_id OE_SALES_CREDITS LINE_ID = L_ORDER_LINE_ID SALESREP_ID = (SELECT MIN(SALESREP_ID) 35 . in most cases there will be no value in the ‘Salesrep Id’ attribute after initialization. Now. When using this function. In this case an assumption is made that the salesperson with the lowest Salesrep ID has seniority. take the maximum sales credit percentage found for sales credits assigned to this line. the Salesrep’s ID is derived by choosing the salesperson having the min salesrep_id for the salesreps that have the max quota sales credits. For those who would rather see the code for this derivation. it is probably safer to call both functions out as we did in Release 11.partially what is done in Release 11i. Implementation of such a process would look like the following process. the salesrep is tied to the header of the order and not the line of the order. so take it one piece at a time. the salesrep Id is populated when the process is initialized. This narrows the list down to only one salesperson. since they were entered into the database prior to the others.

Although this is a provided function and attribute. The ‘Copy Values from Code Combination’ function has previously been reviewed. Upgrade steps are required to implement this feature fully. refer to the Oracle Applications Upgrade Manual for Release 11i (A87325). The intent here is to allow those customers upgrading from release 10 of the applications to use their Flexbuilder rules for building the COGS Account. and the bottom three yellow boxes representing the destination segments. OE_SALES_CREDIT_TYPES SCT WHERE SC.LINE_ID = L_ORDER_LINE_ID AND SC. It is provides the bridge between the old Flexbuilder account generator and the new Workflow processes. if the scenario existed where Segment2 of the COGS account required that the source to come from Segment2 of the Order Type COGS account. Oracle Flexbuilder/Account Generator Tasks.SALES_CREDIT_TYPE_ID = SCT. For instance. this function would be used. no other seeded function uses this Attribute as a source of information. Upgrade from Flexbuilder This function is unique from all others.FROM OE_SALES_CREDITS SC . The Seeded Standard Flexfield Workflow Functions A brief word about the Standard Flexfield Workflow Functions is in order to obtain a complete understanding of the functionality and power of the Account Generator. 36 . It loads a value into the ‘Transaction Type’ attribute based on the Commitment ID.QUOTA_FLAG = 'Y' AND SC. Get the Transaction Type for a Commitment ID This infrequently used attribute assignment derives the receivables transaction type for a Commitment ID. It shows the top three yellow boxes representing the source segments. This would still require a custom function to retrieve the actual CCID from the transaction type. Rather than elaborating on those here. This would be valuable for those wanting to source the COGS account from the Revenue or Receivables account assigned to a receivables transaction type. Please note that the icon for this Function is very descriptive.PERCENT = (SELECT MAX(PERCENT) FROM OE_SALES_CREDITS WHERE LINE_ID = L_ORDER_LINE_ID) ) AND ROWNUM = 1. The important element is the single arrow.SALES_CREDIT_TYPE_ID AND SCT. Specifically refer to chapter 3. but half the work is done using this function. The functions reviewed here will be: • • • Copy Segment Value from Code Combination Copy Segment Value from other Structure Code Combination Assign Value to Segment Copy Segment Value from Code Combination This function is used to copy only one segment from the source account to the destination account. therefore it will be omitted here.

As you recall this differs in the icon for ‘Copy Values from Code Combination’ in that there is only one arrow as opposed to three arrows. there are attribute values that need to be specified.pointing from one segment to the other. If the value assigned were ‘DEPARTMENT’ or ‘department’ the assignment of this segment would fail. describing the fact that only one segment is copied instead of all segments. In addition. the attribute values would be modified to look like: Please make a special note that the ‘Segment’ value for the segment name is case sensitive. Copy Segment Value from other Structure Code Combination This function makes provisions for copying a segment value from a specified CCID (account ID). In this case. To assign the single segment called ‘Department’ from the source account to the destination (COGS) account. the source account is input by setting the attribute value of Code Combination ID to an Item Attribute with a value of ‘Generated CCID’. the case sensitive segment name for the segment is specified. The Attribute Values (function input) for this function look like: 37 . When using this function. This would be used when the derivation of the source account cannot be produced from one of the existing functions.

With these 2 values specified a single row in the GL_CODE_COMBINATIONS table is identified. With the ‘Segment Identifier’ assigned a value of ‘Name’. the attributes would be set to: Assign Value to Segment 38 . the name of Segment2 in the ‘Vision Operations (USA)’ accounting Flexfield is ‘Department’. The ‘Structure Number’ is the Chart of Accounts ID. This is where the ‘Segment Identifier’ and ‘Segment’ come into play. ‘The Code Combination ID’ is the specific CCID for this chart of accounts. For instance. Therefore in order to extract the value of the segment2 for this structure for the Code Combination ID = 1102.Each of the named attribute values would be specified using this scenario. which then allows for the individual segment values to be retrieved. then the ‘Segment’ attribute value would specify the case sensitive name of the segment within the chart of account structure.

a property sheet will display. Change the values to unique values as shown and apply: 39 . you can make a small modification to the ‘OM: Generate Default Account’ process. This can be achieved using this function by specifying the attribute values for the instance of this function as: The icon is descriptive of the function being performed. For this situation. Please do not simply modify the existing Default process. A Simple Modification to an Existing Process Definition Now that all the elements have been reviewed. After accepting this error message. an initial error is raised stating 363: Could not set activity properties for OECOGS/DEFAULT_ACCOUNT_GENERATION. is to always have a value of ‘01’. there may be a desire to assign a specific value to a segment. The modification will source the ‘Department’ segment from the Order Type COGS account. The first step is to copy the existing process to a new process. 310: Duplicate internal name. Suppose segment1.In some cases. which has a segment name of ‘Company’. All other segment values will be derived from the ‘Get CCID for a line’. When doing the copy. the ‘Assign Value to Segment’ function would be used. It shows an arrow feeding into a single block or segment.

Double-click on the new process from within the Navigator and continue by deleting the link between the ‘Start generating Code Combination’ and the ‘Get CCID for a line’ function.Now there is a copied process. The ‘Failure’ result is handled by drawing a link between the ‘Get CCID for the Order Type’ to the ‘Abort generating Code Combination’. Next drag the ‘Copy Segment Value from Code Combination’ function onto the process sheet and continue by linking it from the ‘Get CCID from the Order Type’. Choose the ‘Success’ value when displayed. which may be modified independently of the ‘Generate Default Account’. At this point in time. ‘Generate New Default Account’. draw a line connecting the ‘Start generating Code Combination’ to the ‘Get CCID from the Order Type’ function. Using the right mouse button. set the attribute values for the ‘Copy Segment Value from Code Combination’ by right-clicking on the function within the process sheet and choosing Properties. Insert between them the function ‘Get CCID from the Order Type’ by dragging it from the Navigator to the process screen. The values to set include the ‘Code Combination ID’ and the ‘Segment’ attribute values as shown: 40 .

The next step is to link the ‘Copy Segment Value from Code Combination’ to the ‘Get CCID for a line’ by dragging a line between the 2 using the right mouse button. Change the ‘Replace existing value’ to ‘False’. and choose the Attribute Values tab. 41 . One final modification is needed. which will demonstrate the use of a common attribute value called ‘Replace existing value’. Go to the properties sheet for the instance of ‘Copy Values from Code Combination’ which comes after the ‘Get CCID for a line’ function. This prevents the ‘Department’ segment from getting overwritten after it has been assigned a value from the Order Type COGS account.

Save this process definition off to the database. Using the flashlight icon choose the applicable Chart of Accounts. Then assign the new process to the ‘Generate Cost of Goods Sold Account’ Item Type as shown: 42 . The relationship between the Chart of Accounts structure and the Workflow Process for the ‘OM: Generate Cost of Good Sold’ item type is made in the ‘Account Generator Processes’ form (OM: Setup ⇒ Financials ⇒ Flexfields ⇒ Key ⇒ Accounts). but it is of no benefit unless the Chart of Accounts structure can invoke it. The final product would look like: Pointing the Chart of Accounts to the New Process Saving new Workflow Process Definitions to the database is all well and good.

43 . although the tools mentioned may not be available to everyone. These variables come seeded in a disabled state. This request log becomes a key element in troubleshooting problems with the COGS Account generation. The package name. but when they are enabled they log valuable information to the standard output. and variable for each of the packages are displayed in the following table. However. Set ‘OM: Debug Level’ = 5 to output these applicable debug messages. Package FND_FLEX_WORKFLOW FND_FLEX_WORKFLOW_APIS Filename AFFFWKFB. which enables debug messages to be output in the concurrent request log.Troubleshooting the Workflow Process Much of the following section is intended for internal Oracle Support analysts.pls Variable Debug_fnd_flex_workflow Debug_fnd_flex_workflow_apis In addition to these hard coded parameters. filename. the troubleshooting methods remain the same.pls AFFFWKAB. you can find how the profile is currently set. By using the script in Appendix A. In the case of the Inventory Interface. there is a profile called ‘OM: Debug Level’. these debug messages would be logged to the Request Log when submitted as a concurrent request. Debug parameters in the stored procedures Embedded within the stored procedures invoked by the Workflow process are debug variables.

-----------------------------1000 Standard Enter Transaction_Type_ID : 1000 LINE_ID LINE_NUMBER INVENTORY_ITEM_ID ORDERED_QUANTITY ---------.----------.Mercer@oracle.sql script. The need for this stems from the fact that values are kept in memory for the Generated CCID as well as other elements and will get used in subsequent runs.----------------. Testing the Workflow Process Using the cogs_11i script The cogs_11i.sql for your modified process follows: SQL> @cogs_11i PL/SQL procedure successfully completed.sql script was designed to allow cursory testing of the COGS Account Generator without requiring the user to process a sales order line through Inventory Interface. The only requirement is that there be an entered order with a line to reference. Enter Order Number : 43606 ORG_ID HEADER_ID ---------. Use of this script should not be construed as a full and complete unit test. There are a few notes regarding this script.---------204 43343 Enter Org_id : 204 PL/SQL procedure successfully completed. • The output is split up into sections and is not a strict chronological output of the execution. Updates to the script can be requested by sending an email to • For each test run it is recommended that you begin a new session in SQL*Plus.An example of the type of output logged will be demonstrated in the following section when testing the account using the cogs_11i. An example run of the cogs_11i. This may be a side affect of a bug where attribute values were not getting reset when run in SYNCH mode. The body of the script can be found in the Appendix B of this paper.N. TRANSACTION_TYPE_ID NAME ------------------.---------------48085 2 149 1 48074 1 3481 1 48073 1 3479 1 48075 1 3487 1 48076 1 3485 1 48077 1 3379 1 48078 1 3381 1 48079 1 3391 2 44 . The user is prompted for the required input.


However.Start_process : 48082 Chart Of accounts Id : 101 Item Key : #SYNCH Initilizing Workflow Item Attributes Calling FND_ELEX_WORKFLOW.GET_COST_SALE_ITEM_DERIVED Item Type : OECOGS Item Key : #SYNCH Activity Id : 166170 funcmode : RUN Input Paramerers : Line id :48082 Organization id :207 Output : Generated CCID :12952 Exiting from OE_Flex_COGS_Pub. the messages are stored in a temporary table and are output together afterward.Get_Cost_Sale_Item_Derived Return CCID : 12951 Concat Segments : 01-510-5110-0000-000 Concat Id : 01-510-5110-0000-000 Concat Descriptions : Operations-Vision Operations In-Cost of Sales-No Sub Account-No Product Error Message : **************************************************** * SUMMARY OF RETURNED RESULTS * **************************************************** Output Parameters: Debug Level = 5 X_RETURN_CCID = 12951 X_CONCAT_SEGS = 01-510-5110-0000-000 X_CONCAT_IDS = 01-510-5110-0000-000 X_CONCAT_DESCRS = Operations-Vision Operations In-Cost of Sales-No Sub Account-No Product X_ERRMSG = **************************************************** PL/SQL procedure successfully completed. because of the 2 different types debugging which are enabled. Setting the debug variables in the 2 stored procedures as outlined above causes the debugging to go directly to the screen when they are executed. This can make the output confusing.PROCESS STATUS IS COMPLETE PROCESS RESULT IS SUCCESS CCID IS 12951 CONCATENATED SEGMENTS IS 01-510-5110-0000-000 CONCATENATED IDS IS 01-510-5110-0000-000 CONCATENATED DESCRIPTIONS IS Operations-Vision Operations In-Cost of Sales-No Sub Account-No Product NEW COMBINATION IS FALSE VALIDATION_STATUS IS VALID **************************************************** * OUTPUT FROM OM: DEBUG LEVEL PROFILE SETTING * **************************************************** Entering OE_Flex_Cogs_Pub. when setting the profile option ‘OM: Debug Level’ to 5. It is not necessarily a simple task in interpreting this output.GET_ORDER_TYPE_DERIVED Item Type : OECOGS Item Key : #SYNCH Activity Id : 166172 funcmode : RUN Input Paramerers : Order Type ID :1000 Output : Generated CCID :12951 Entering OE_Flex_Cogs_Pub. 46 .GENERATE from START_PROCESS Entering OE_Flex_Cogs_Pub.

which is controlled by the profile option ‘Account Generator:Run in Debug Mode’. etc to the COGS Account Generator Item Type Any constructive criticism is welcome and may be sent to Richard. the L_ITEMKEY will be #SYNCH. the ‘Appendix E Addendum’ is recommended. the unique key is identified near the beginning as ‘L_ITEMKEY = 6003’ Then. As an exercise. 47 . Specific highlights are recognizing the calls to initialize the 11 parameters. the transaction is given a unique key and the values are stored in the database. This keeps the size of the workflow tables from growing at an enormous rate.If this becomes too much of a challenge. When debugging is enabled and attributes are assigned values. Use this information at your own risk. For those interested in furthering their knowledge of the Release 11 COGS Account Generator. then I recommend you obtain the debugging messages by running the Inventory Interface. the resultant CCID and concatenated segments are displayed. you should try to understand how the process flow designed in Workflow Builder manifests itself in this output. the debugging comes out in its correct order. Item Keys. Running in Synch versus Debug When executing a process to generate an account there is an option to run Debug Mode. It offers the details and corrections for the Appendix E documentation in the Oracle Order Management/Shipping Release 11 User’s Guide.Mercer@oracle. and the assignment of the one segment. unless the process ends in an error. Finally. entitled Using the Account Generator. identifying the calls to get the CCID for the Order type. In the latter case there will be no history of values assigned to the attributes on the database after the process has completed. and use the cogs_11i script to get a good idea of whether the COGS Account Generator is erroring. Conclusion Hopefully this paper has helped clarify the functionality and flexibility of the Account Generator using Workflow and the Workflow Builder. Topics for further discussion would include: • Default Error Process • Protection Level • Database Workflow Objects • Detailed analysis of workflow scripts under $APPL_TOP • Mapping Attribute Values. When the debugging is disabled. In this case. the call to get the CCID for the item and the assignment of these values to the destination COGS account. Note: This is unofficial Oracle Documentation. In the spooled output of the cogs_11i run above.

48 .Acknowledgments A special thanks to Chris Goode for explaining the use and functionality of the FSG reports.

set pagesize 200.user_name "USER" from fnd_profile_option_values fpov. organization_id.level_value and fr. 'APPLICATION'. organization_name warehouse.level_value_application_id and fr. 'RESPONSIBILITY'. fnd_application fa.This is a script to profile the source of information which -. col UPDATED_BY format a8. decode(fpov.profile_option_name Profile.3 / prompt =============================================== prompt SET OF BOOKS INFO FOR INVENTORY ORGANIZATIONS: prompt =============================================== select ood.10001. fr.the workflow uses to build a Cost of Goods Sold Account -----------------------------------------------------------------set linesize 155. Column warehouse format a30.profile_option_id and fa.level_value and fl.Appendix A: Profiling script ------------------------------------------------------------------.LAST_UPDATE_LOGIN and fpo. col Value format a10.profile_option_name = 'ONT_DEBUG_LEVEL' order by 1. col Responsibility format a30. fpov. 49 . COLUMN S_OF_B_ID FORMAT 9999999. fa. column set_of_books_id format a16.10003.'USER')"LEVEL". fu.profile_option_id=fpov. 'SITE'.level_value and fu.10002.login_id(+) = fpov. prompt prompt prompt select =========================================== VALUES FOR THE SET OF BOOKS PROFILE OPTION: =========================================== fpo.responsibility_id(+)=fpov. fnd_user fu. col Level format a14.responsibility_name Responsibility. col Profile format a20. col App format a3. fnd_responsibility_vl fr. 10004.application_id(+)=fpov. set verify off. col USER format a8.user_id(+)=fpov.application_short_name App.level_id.application_id(+)=fpov. fnd_profile_options fpo.profile_option_value Value. fnd_logins fl where fpo.

org_information1 set_of_books_id From org_organization_definitions ood.organization_id / column set_of_books_id format 9999999. SET_OF_BOOKS_ID S_OF_B_ID. prompt ======================================== prompt CHART OF ACCOUNT INFO FOR SET OF BOOKS: prompt ======================================== Select NAME SET_OF_BOOKS. CHART_OF_ACCOUNTS_NAME From GL_SETS_OF_BOOKS_V WHERE SET_OF_BOOKS_ID = &SET_OF_BOOKS_ID / prompt ===================================================== prompt FLEXFIELD SEGMENT INFO FOR CHART OF ACCTS STRUCTURE: prompt ===================================================== select segment_num. CHART_OF_ACCOUNTS_ID.org_information_context = 'Accounting Information' order by ood. wf_process_name from fnd_flex_workflow_processes where id_flex_code = 'GL#' and wf_item_type = 'OECOGS' and id_flex_num = &&Chart_of_accounts_id / 50 .inventory_enabled_flag = 'Y' and hoi. Hr_organization_information hoi Where ood. segment_name from fnd_id_flex_segments_vl where enabled_flag='Y' and id_flex_code = 'GL#' and id_flex_num = &&Chart_of_accounts_id order by segment_num / prompt ================================================= prompt WORKFLOW PROCESS ASSIGNED TO CHART OF ACCOUNTS: prompt ================================================= select id_flex_num.organization_id = hoi.organization_id and ood.

NOTE: It is safest to exit SQL*Plus after each test run since values from -The previous run seem to be kept in memory.order_number = &p_order_number.sql version 1. oe_transaction_types_v ot where h. varchar2.header_id and h. number. line_number. ordered_quantity from oe_order_lines l.00 --.This test assumes that previous validation for the transactions have been made where -. accept p_ORG_ID prompt "Enter Org_id : " execute fnd_client_info. For instance: -Item is Shippable -Item is Returnable for RMA's -Item is Stock Enabled -Item is Transactable -set pagesize 50 set recsep off set serveroutput on set verify off column act_complete format a18 column act_start format a18 column program format a35 variable p_Order_number variable P_ORDER_TYPE_ID variable P_Line_ID variable P_LINE_DETAIL_ID variable P_PICKING_LINE_DTL_ID variable p_ORG_ID --variable x_fnd_debug -. accept p_order_type_id prompt "Enter Transaction_Type_ID : " select line_id.order_type_id = ot. select ot.testcogs_11i. name from oe_order_headers h. number.debug_on. --. varchar2.Created by Rich Mercer version 1. number.fnd_flex_workflow. number. inventory_item_id.set_org_context('&p_org_id').order_number = &p_order_number. oe_order_headers h where l. number.This is a script used to test the COGS Account Generator.Appendix B: cogs_11i.transaction_type_id and h.transaction_type_id .header_id = h.I believe this has to do in running in synchronous(non-debug) mode.applicable. header_id from oe_order_headers_all where order_number = &p_Order_Number.sql Script: --.initialize. --. execute oe_debug_pub. -. accept p_line_ID prompt "Enter Line_ID : " Declare CCIDGOOD X_RETURN_CCID varchar2(1).order_type_id = &p_order_type_id and h.Please keep in mind that you may have to exit SQL*Plus after each run -. 51 .00 --. number. accept p_Order_number prompt "Enter Order Number : " select ORG_ID.

DEBUG_OFF.SetDebugLevel(5). end.g_debug_count loop dbms_output. --DBMS_OUTPUT.X_CONCAT_SEGS X_CONCAT_IDS X_CONCAT_DESCRS X_MSG_COUNT X_ERRMSG X_ORDER_LINE_ID X_FLEX_NUMBER X_DEBUG_FILE x_fnd_debug x_status begin varchar2(250). DBMS_OUTPUT.G_debug_tbl(i)).PUT_LINE('X_RETURN_CCID = ' || to_char(X_RETURN_CCID)). for i in 1.PUT_LINE('* OUTPUT FROM WORKFLOW DEBUG SETTINGS *'). --DBMS_OUTPUT.PUT_LINE('****************************************************').G_DIR||'/'|| -OE_DEBUG_PUB. DBMS_OUTPUT. DBMS_OUTPUT.START_PROCESS( 1. --X_DEBUG_FILE := OE_DEBUG_PUB. varchar2(250).Set_Debug_Mode('FILE').put_line(OE_DEBUG_PUB. X_MSG_COUNT. DBMS_OUTPUT. CCIDGOOD := OE_Flex_Cogs_Pub. DBMS_OUTPUT. X_ORDER_LINE_ID.PUT_LINE('****************************************************'). DBMS_OUTPUT. DBMS_OUTPUT. DBMS_OUTPUT.PUT_LINE('****************************************************').PUT_LINE('****************************************************').PUT_LINE('****************************************************'). number.PUT_LINE('X_ERRMSG = ' || X_ERRMSG). varchar2(250).PUT_LINE('Debug = ' || OE_DEBUG_PUB. X_CONCAT_IDS.PUT_LINE('* OUTPUT FROM OM: DEBUG LEVEL PROFILE SETTING *').0. DBMS_OUTPUT.G_DEBUG_LEVEL)). / 52 .PUT_LINE('Debug File = ' || X_DEBUG_FILE). end loop. varchar2(1000). OE_DEBUG_PUB.PUT_LINE('* SUMMARY OF RETURNED RESULTS *'). X_CONCAT_DESCRS. DBMS_OUTPUT. DBMS_OUTPUT.PUT_LINE('X_CONCAT_DESCRS = ' || X_CONCAT_DESCRS). OE_DEBUG_PUB.PUT_LINE('Debug Level = ' || to_char(OE_DEBUG_PUB.PUT_LINE('****************************************************'). DBMS_OUTPUT.PUT_LINE('X_CONCAT_IDS = ' || X_CONCAT_IDS). DBMS_OUTPUT.PUT_LINE('X_CONCAT_SEGS = ' || X_CONCAT_SEGS). --DBMS_OUTPUT. DBMS_OUTPUT. varchar2(100).OE_DEBUG_PUB. varchar2(32000).Set_Debug_Mode('TABLE').. X_CONCAT_SEGS.PUT_LINE('Output Parameters: '). DBMS_OUTPUT. dbms_output. number.PUT_LINE('****************************************************'). DBMS_OUTPUT. X_RETURN_CCID. DBMS_OUTPUT. X_DEBUG_FILE := OE_DEBUG_PUB.PUT_LINE('Debug File = ' || OE_DEBUG_PUB. DBMS_OUTPUT.enable(100000).G_DEBUG). number.PUT_LINE('X_ORDER_LINE_ID = ' || to_char(X_ORDER_LINE_ID)).G_FILE).PUT_LINE('**********************************************'). boolean. DBMS_OUTPUT. X_ORDER_LINE_ID := &p_Line_id. X_ERRMSG).

Sign up to vote on this title
UsefulNot useful