Oracle CRM Service Contracts Queries

March 25, 2018 | Author: ata_rehman70 | Category: Sql, Table (Database), Invoice, Oracle Database, Customer Relationship Management


Comments



Description

Oracle CRM Service Contracts QueriesSERVICE CONTRACTS QUERIES..................................................................3 SERVICE CONTRACT HEADER – TABLE OKC_K_HEADERS_ALL_B................7 SERVICE CONTRACT HEADER – ITEM VALIDATION ORGANIZATION............8 SERVICE CONTRACT HEADER – OKS_K_HEADERS_B..................................9 SERVICE CONTRACT HEADER – PARTY INFORMATION..............................11 SERVICE CONTRACT HEADER – BILL TO / SHIP TO INFORMATION............12 SERVICE CONTRACT HEADER – CUSTOMER CONTACT INFORMATION......13 SERVICE CONTRACT HEADER – VENDOR CONTACT INFORMATION..........14 SERVICE CONTRACT HEADER – PRICING / BILLING INFORMATION...........15 SERVICE CONTRACT HEADER – RENEWAL TAB........................................19 SERVICE CONTRACT HEADER – RENEWAL TAB........................................21 SERVICE CONTRACT HEADER – RENEWAL TAB........................................22 SERVICE CONTRACT HEADER – ADMIN TAB.............................................24 SERVICE CONTRACT LINES – INFORMATION.............................................25 SERVICE CONTRACT LINES – COVERAGE INFORMATION..........................27 SERVICE CONTRACT LINES – COVERAGE INFORMATION..........................28 SERVICE CONTRACT LINES – HOW TO IDENTIFY COVERAGE FOR A LINE. 29 SERVICE CONTRACT LINES – RELATIONSHIP BETWEEN COVERAGE HEADER AND LINE.........................................................................................................30 SERVICE COVERAGE; COMPLEX COVERAGE QUERY.................................31 SERVICE COVERAGE; COMPLEX COVERAGE QUERY.................................32 SERVICE CONTRACT LINES – ACCOUNTS TAB (ITEM NAME).....................34 SERVICE CONTRACT LINES – ACCOUNTS TAB (BILL TO / SHIP TO)...........35 SERVICE CONTRACT LINES – EFFECTIVITIES TAB (INVOICE TEXT)............36 SERVICE CONTRACT LINES – ACCOUNTS TAB (CONTACT INFORMATION).37 SERVICE CONTRACT LINES – ACCOUNTS TAB (CONTACT INFORMATION).38 SERVICE CONTRACT LINES – ACCOUNTS TAB (CONTACT INFORMATION).39 SERVICE CONTRACT SUBLINES – (COVERED) PRODUCT INFORMATION...40 SERVICE CONTRACT LINES – BILLING STREAM.........................................44 SERVICE CONTRACT LINES – BILLING STREAM.........................................45 SERVICE CONTRACT LINES – BILLING SCHEDULE.....................................46 SERVICE CONTRACT LINES – STREAM / SCHEDULE QUERY......................47 SERVICE CONTRACT LINES – STREAM / SCHEDULE QUERY......................48 SERVICE CONTRACT BILLING TABLES......................................................50 SERVICE CONTRACT BILLING TABLES......................................................51 SERVICE CONTRACT BILLING TABLES......................................................52 SERVICE CONTRACT BILLING TABLES......................................................53 E. Receivables Interface Data..................................................................55 G. Order Details for Contracts Created from Order Management............56 Oracle CRM Service Contracts Queries SERVICE CONTRACTS QUERIES We will create a Service Agreement. In each step of the process we will examine the rows that are created in each table and pertinent columns that are frequently referenced. How to query service contracts tables and tables from other schemas to find underlying data about contract headers, lines, sublines and contract billing in 11.5.10. (For R12 queries please see Note 816374.1). This note gives a variety of queries which can be used to find the required data for a particular contract. In the SQL statements given, <xxx> represents text that needs to be replaced with the actual values indicated between the brackets. For example, if you want to execute a query for a contract with number Test1, then whenever you see <contract number> in the SQL below, replace it with Test1. Sections in this note are: A. Contract Header Data B. Contract Line Data C. Contract Subline Data D. Contract Billing Data E. Receivables Interface Data F. Subscription Contracts Table: OKC_K_HEADERS_B Product: OKC - Contracts Core Description: Top level of a contract structure and groups all the lines and terms and conditions of a contract. Implementation/DBA Data: OKC.OKC_K_HEADERS_B Table: OKC_K_ITEMS Product: OKC - Contracts Core Description: Contract items Implementation/DBA Data: OKC.OKC_K_ITEMS Table: OKC_K_LINES_B Product: OKC - Contracts Core Oracle CRM Service Contracts Queries Description: Deliverable ITEMS grouped into a logical set usually defined by unitary price, delivery or some other classification. Implementation/DBA Data: OKC.OKC_K_LINES_B Table: OKS_BILL_SUB_LINES Product: OKS - Service Contracts Description: Related to a lower level contract line eg. coverage level or product. Implementation/DBA Data: OKS.OKS_BILL_SUB_LINES Table: OKS_BILL_CONT_LINES Product: OKS - Service Contracts Description: Records which are sent to AR. Implementation/DBA Data: OKS.OKS_BILL_CONT_LINES Table: OKS_BILL_SUB_LINE_DTLS Product: OKS - Service Contracts Description: The detail of quantities and monetary amounts either regular or adjustment. Implementation/DBA Data: OKS.OKS_BILL_SUB_LINE_DTLS Table: OKS_BILL_TRANSACTIONS Product: OKS - Service Contracts Description: The transaction (invoice, credit etc.) which is eventually received from AR. Implementation/DBA Data: OKS.OKS_BILL_TRANSACTIONS Table: OKS_BILL_TXN_LINES Product: OKS - Service Contracts Description: Holds the actual transaction amount and tax returned from AR. Implementation/DBA Data: OKS.OKS_BILL_TXN_LINES Table: OKS_STREAM_LEVELS_B Product: OKS - Service Contracts Description: Service Contracts Billing Stream Levels Implementation/DBA Data: OKS.OKS_STREAM_LEVELS_B Table: OKS_REV_DISTRIBUTIONS Product: OKS - Service Contracts Description: Database table used for storing revenue distribution information for service contract lines. Oracle CRM Service Contracts Queries Implementation/DBA Data: OKS.OKS_REV_DISTRIBUTIONS Further information on these tables can be found on eTRM Technical Reference available via My Oracle Support. The eTRM contains also the following information of the tables and ERD Diagrams: - OKS - Service Contracts - R11510 Service Contracts ERD.pdf - sub_erd_billing.pdf - sub_erd_billing_profile.pdf - sub_erd_defaults.pdf - sub_erd_order_details.pdf - sub_erd_sales_credit.pdf When AutoInvoice has been run program RAXTRX takes transactions that are on table RA_INTERFACE_LINES_ALL, validates them and if valid, passes the information into the AR tables, - RA_CUSTOMER_TRX_ALL - RA_CUSTOMER_TRX_LINES_ALL - RA_CUST_TRX_LINE_GL_DIST_ALL - RA_SALESCREDITS_ALL - AR_PAYMENT_SCHEDULES_ALL For terminations, transactions also create records on AR_RECEIVABLE_APPLICATIONS_ALL. An example of a query can be: SELECT rcta.trx_number invoice_no,         rctla.line_number invoice_line_no,        txn.bill_instance_number,         rctla.inventory_item_id,        oks_hd.contract_number,         oks_hd.contract_number_modifier,        oks_ln.line_number cont_line_no,         cii_oks.instance_id,        cii_oks.serial_number sn   FROM okc_k_headers_b oks_hd,        okc_k_lines_b oks_ln,        oks_k_lines_b oks_ln_sub,        okc_k_items oki,        oks_bill_txn_lines txn,        oks_bill_sub_lines bsl, Oracle CRM Service Contracts Queries        okx_install_items_v ocsi,        csi_item_instances cii_oks,        ra_customer_trx_all rcta,        ra_customer_trx_lines_all rctla  WHERE rctla.customer_trx_id = rcta.customer_trx_id    AND rctla.interface_line_attribute1 = oks_hd.contract_number(+)    AND NVL (rctla.interface_line_attribute2, '­') = NVL  (oks_hd.contract_number_modifier(+),'­')    AND rctla.interface_line_attribute3 = txn.bill_instance_number(+)    AND bsl.cle_id = oks_ln.ID    AND NVL (txn.bsl_id, ­999) = DECODE (txn.bsl_id, NULL, ­999, bsl.ID)    AND txn.bcl_id = bsl.bcl_id    AND oks_ln.ID = oks_ln_sub.cle_id(+)    AND oks_ln.ID = oki.cle_id(+)    AND oki.object1_id1 = ocsi.id1(+)    AND oki.object1_id2 = ocsi.id2(+)    AND ocsi.instance_id = cii_oks.instance_id(+)    AND rcta.trx_number = '&your_trans_num'    AND oks_hd.contract_number = '&your_contr_num' There is a synonym from OKC_K_HEADERS_B to OKC_K_HEADERS_ALL_B. a value that can be seen in Order Management. Contract Header Data SELECT * FROM okc_k_headers_b WHERE contract_number = '&contract_number' AND contract_number_modifier = '&contract_modifier'. This query provides some of the header level information: R12 select * from OKC_K_HEADERS_ALL_B where contract_number = '23572'. . The inv_organization_id is the inventory validation org.5. Queries in R12 should reference OKC_K_HEADERS_ALL_B unless client_info is set to the appropriate organization. the table name is OKC_K_HEADERS_B. This was done so that Service Contracts can use the MO: Security Profile to control which organizations are accessible from a given responsibility. the table name is OKC_K_HEADERS_ALL_B. In R12.10. Note: In release 11. Two important columns in OKC_K_HEADERS_ALL_B are the authoring_org_id and the inv_organization_id. The authoring_org_id will always be the org id that matches the Vendor name. A. Enter the header information and nothing more.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – TABLE OKC_K_HEADERS_ALL_B NAV: Contract Administration / Launchpad using the Service Contracts Manager responsibility. 11i select * from OKC_K_HEADERS_B where contract_number = '23572'. Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – ITEM VALIDATION ORGANIZATION NAV: Setup / System Parameters / Values. Use this method to identify the Item Validation organization for an operating unit. All services and products must be defined / assigned to this organization. . The Operating Unit that appears in this form is the profile setting MO: Operating Unit. id = oks. Similar rules were consolidated in OKC_RULE_GROUPS_B. Due to performance issues.* from OKC_K_HEADERS_ALL_B k. HOLD_BILLING  FROM oks_auth_headers_v  WHERE CONTRACT_NUMBER like '<contract number>'. STS_CODE "Status". TO_CHAR( END_DATE. It is a good idea to run queries from both tables and save them in a spreadsheet so that changes can be observed as additional information is entered in the contract.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – OKS_K_HEADERS_B OKS_K_HEADERS_B has information that was once stored in the rules tables in early product releases. Rule Groups had one or more rules.chr_id. etc. this information was moved to OKS_K_HEADERS_B (and OKS_K_LINES_B at the line level). SHORT_DESCRIPTION "Description"  . ACCT_RULE_ID  . TO_CHAR( id ) "Id"  . the column is chr_id. 'DD­MON­YYYY' ) "Start Date"  . the column dnz_chr_id maps to the column id in OKC_K_HEADERS_ALL_B. were stored in individual rows in OKC_RULES_B. PRICE_LIST_ID  . In this table. This SQL takes data from views rather than from actual contracts tables and is useful for reviewing data but not ideal for verifying if base tables hold correct data. 'DD­MON­YYYY' ) "Date Terminated"  . CURRENCY_CODE "Currency"  .            OKS_K_HEADERS_B oks  where contract_number = '23572' and k. BILL_TO_SITE_USE_ID  . 'DD­MON­YYYY' ) " End Date"  . TO_CHAR( START_DATE. A. invoicing rules. select oks. INV_RULE_ID  . UPG_ORIG_SYSTEM_REF  . CLASS_MEANING  . In most tables. TRN_CODE  . PAYMENT_TERM_ID  . INV_ORGANIZATION_ID "Organization Id"  . SHIP_TO_SITE_USE_ID  . scs_code  . Contract Header Data A1. TO_CHAR( DATE_TERMINATED. TEMPLATE_YN  . Information such as credit card numbers. AR_INTERFACE_YN  .  . tax codes. SELECT CONTRACT_NUMBER "Contract"  . . object1_id1 lists the org_id for a vendor and the party number for a customer. SERVICE CONTRACT HEADER – PARTY INFORMATION The vendor party is automatically populated when the cursor is positioned in the Parties tab. Select the entry for party role = Customer.Oracle CRM Service Contracts Queries OKS_AUTH_HEADERS_V is not a table but a view. pty.object1_id1  from OKC_K_HEADERS_ALL_B k. OKC_STATUSES_V and OKC_SUBCLASSES_V. Run this query: select pty.cle_id is null and   k.id = pty.rle_code.      OKC_K_PARTY_ROLES_B pty where k. OKC_K_HEADERS_TL .dnz_chr_id and   pty. This view is comprised of table OKC_K_HEADERS_B .contract_number = '23572'. This information is returned: RLE_CODE OBJECT1_ID1 ----------------.-----------------VENDOR 204 CUSTOMER 4429 As you can see. Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – BILL TO / SHIP TO INFORMATION Run this query before and after entering the Bill To and Ship To Information in your contract. select bill_to_site_use_id.              ship_to_site_use_id from OKC_K_HEADERS_ALL_B where contract_number = '23572'. the information is stored in OKC_K_HEADERS_ALL_B. As you can see. . .contract_number = '23572'.-------------BUYER OKX_PCONTACT 401670 Run this query to get the contact information: select * from hz_parties where party_id = 401670.-----------------------.        ct. Run this query to identify the contact: select cro_code "Contact Role".jtot_object1_code.id = ct.        object1_id1 "Contact ID" from OKC_CONTACTS ct.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – CUSTOMER CONTACT INFORMATION Create a customer contact.dnz_chr_id and jtot_object1_code = 'OKX_PCONTACT' and k.           OKC_K_HEADERS_ALL_B k where k. This information is returned: Contact Role jtot_object1_code Contact ID ----------------. This information is returned.        object1_id1 "Contact ID" from OKC_CONTACTS ct.contract_number = '23572'. The results will be different when you run this query because line level contacts are created later in this presentation. Notice that the jtot_object1_code for the new entry is OKX_RESOURCE. Either of these queries will return the information: select * from OKX_RESOURCES_V where id1 = 10199. Rerun this query: select cro_code "Contact Role".id = ct.           OKC_K_HEADERS_ALL_B k where k. Contact Role ----------------BUYER ADMIN jtot_object1_code Contact ID -----------------------. select * from JTF_RS_RESOURCE_EXTNS where resource_id = 10199.dnz_chr_id and k.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – VENDOR CONTACT INFORMATION Now create a contact for the Vendor.jtot_object1_code. .-------------OKX_PCONTACT 401670 OKX_RESOURCE 10199 The resource information is located in a table and a view.        ct. payment_term_id. 'Accounting Rule'. The information is stored in OKC_K_HEADERS_ALL_B and some is stored in OKS_K_HEADERS_B.            OKS_K_HEADERS_B oks  where contract_number = '23572' and k. Enter the Price List.  decode (type. Payment Terms. Invoicing Rule.        oks. 'Invoicing Rule') "Rule  Type" from ra_rules where rule_id in (1.list_header_id = 1000 and pl. 'A'.acct_rule_id.hold_billing "Hold Credits".list_header_id = tl.list_header_id.summary_trx_yn "Summary Transactions" from OKC_K_HEADERS_ALL_B k. select k.id = oks. ­2) . this query returns the Corporate price list: select name from QP_LIST_HEADERS_B pl.            QP_LIST_HEADERS_TL tl where pl.        k. Accounting Rule.inv_rule_id. The values are the id’s in other tables.        k.        oks.price_list_id. Hold Credits checkbox and Summary Transactions checkbox.        oks.chr_id. For example.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – PRICING / BILLING INFORMATION Let’s progress to the Pricing / Billing tab for the contract. 'I'. This query returns the invoicing and accounting rules: select name. the codes have the following meanings: Regular Invoice -RI.date_billed_to. hdr.SRI.CLE_ID  AND C.id = <contract id from query A1>.cle_id = line. btn_id "Billing Transaction ID" . For the bill_action.contract_number_modifier "Modifier"  . oks_bill_txn_lines aa  .DNZ_CHR_ID = D. oks_bill_cont_lines b  . 'DD­MON­YYYY' ) "Date Billed To"  FROM oks_bill_cont_lines cont  .ID  AND B.Oracle CRM Service Contracts Queries D.creation_date. okc_k_headers_b hdr  WHERE hdr.TR. SELECT DISTINCT d.ID  AND d.contract_number "Contract"  .dnz_chr_id  AND cont.AV. hdr.id = <contract id from query A1>  ORDER BY cont. Contract Billing Data D1.creation_date. SELECT hdr. TO_CHAR( DATE_BILLED_TO. TO_CHAR( DATE_BILLED_FROM. Settlement Invoice . okc_k_lines_b c  .contract_number  .id = line.  .b.id  .a. Note that -99 will be shown for invoice number if the 'Service Contracts Fetch Receivables Info For Billing' concurrent program has not been run after Autoinvoice has been run. This query shows the billing transaction details.TO_CHAR( b.id  AND hdr.BCL_ID = B.TO_CHAR( b. 'DD­MON­YYYY HH24­MI' ) "Bill To"  .trx_number "Invoice Number"  . 'DD­MON­YYYY HH24:MI') "Creation Date"  .date_billed_from. Termination Credit . okc_k_headers_b d  WHERE A. okc_k_lines_b line  . The data in this table is shown in the History tab of the Billing Schedule form in the contract.ID = AA. Averaging . bill_action  . 'DD­MON­YYYY' ) "Date Billed From"  . TO_CHAR( cont. This query shows the billing invoice details. Settlement Credit .CLE_ID = C.BTN_ID  AND AA. 'DD­MON­YYYY HH24­MI' ) "Bill From"  .amount  FROM oks_bill_transactions a  .  D2.STR. amount  . id "Contract id"  .BCL.  OKS_BILL_TRANSACTIONS BTN. TO_CHAR(bsl.date_billed_from  . lvl. bsl.DNZ_CHR_ID  And OKL.BCL.oks_bill_cont_lines bcl  . SELECT TO_CHAR(bcl.  D4. bsl.BTN_ID   And BTL.ID = OKL. lvl. TO_CHAR(lvl.ID = BCL.CLE_ID  And BTN.DATE_TRANSACTION  .BTN_ID = BTN.OKH.BILL_INSTANCE_NUMBER IS NOT NULL . This query returns information about what the contract billing schedule for a contract and can be used to investigate amounts expected to be billed in a billing period. lvl.cle_id  .id "Line id"  . lvl.id  .id)  . bcl. This query returns data about the contract Line ids corresponding to each invoice as well as invoice details.date_end  .contract_number = '<contract number>'  And OKH.oks_level_elements lvl  .bill_action  .BCL.  OKC_K_LINES_B OKL. BTN.date_billed_to  . lvl.CLE_ID IS NULL  And OKL. bsl.TRX_NUMBER "Invoice"  . SELECT BCL.DATE_NEXT_INVOICE  .ID = BCL. TO_CHAR(lvl.id)  .  OKC_K_HEADERS_B OKH.PARENT_CLE_ID)  .date_billed_from  .  OKS_BILL_TXN_LINES BTL  WHERE OKH. TO_CHAR(RUL_ID)  .DATE_TO_INTERFACE  .date_start  .DATE_COMPLETED  .date_billed_to  FROM OKS_BILL_CONT_LINES BCL. bcl.amount  FROM oks_bill_sub_lines bsl  .bcl.btn_id  .Oracle CRM Service Contracts Queries D3.ID  And BTL.id)  .OKL. dnz_chr_id = kh.id = bsl.dnz_chr_id = kh.cle_id = kl.okc_K_LINES_B kl  .bcl_id  AND lvl.id  AND lvl.id  AND bcl. .Oracle CRM Service Contracts Queries .contract_number = '&enter_contract_number'  AND kl.okc_k_headers_b kh  WHERE kh.id  AND bcl.cle_id = bsl.cle_id . id = oks. The value is ‘Y’ when approval is required.lookup_type = 'OKS_RENEWAL_TYPE'              and k. This query returns the Billing Profile: select bp.source_lang = 'US' and k.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – RENEWAL TAB Let’s review the top portion of the Renewals tab.contract_number = '23572'. The Approval (Required) is returned by running this query.contract_number = '23572'.list_header_id  and pr.renewal_type_code = fnd. The price list information is stored in QP_LIST_HEADERS_B.contract_number.meaning "Renewal Type" from OKC_K_HEADERS_ALL_B k. but this query will provide the list header name.id and contract_number = '23572'. select pr.profile_number "Billing Profile" from OKC_K_HEADERS_ALL_B k. .chr_id and oks.billing_profile_id = bp.name  from OKC_K_HEADERS_ALL_B k. QP_LIST_HEADERS_TL pr where k.            FND_LOOKUP_VALUES fnd where k. select approval_type  from OKC_K_HEADERS_ALL_B where contract_number = '23572'. This query returns the Renewal Process: select k.           oks_billing_profiles_v bp where k.price_list_id = pr.            OKS_K_HEADERS_B oks.lookup_code              and fnd. fnd.              oks.            oks. This query returns the desired information.             oks.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – RENEWAL TAB Let’s review the middle portion of the Renewals tab. .            oks.renewal_grace_duration.renewal_grace_period. select oks.id = oks.            OKS_K_HEADERS_B oks where k.renewal_est_rev_period from OKC_K_HEADERS_ALL_B k.renewal_est_rev_duration.             oks.renewal_est_rev_percent.renewal_po_number.chr_id and contract_number = '23572'. .             substr(csv.chr_id = okc.           HZ_PARTIES hp.account_name.quote_to_email_id = cp.           HZ_CUST_ACCOUNTS hca.1.           HZ_CONTACT_POINTS cp.description.cust_account_role_id.             substr(hca.party_name.  The quote_to_contact_id in OKS_K_HEADERS_B maps to  HZ_CUST_ACCOUNT_ROLES.  which then maps to HZ_CONTACT_POINTS. select substr(okc.cust_account_id and oks.cust_account_role_id and oks.quote_to_contact_id.              car. The quote_to_email_id maps in OKS_K_HEADERS_B maps to HZ_CONTACT_POINTS The quote_to_site_id in oks_k_headers_b is mapped to OKX_CUST_SITES_V Refer to Note 471398.account_number "Account Number".contract_number = '23572'.id  and oks. This query returns the Quote To information.             substr(cp.            OKC_K_HEADERS_ALL_B okc.party_id.             substr(hp.1 .party_id = car.1.email_address.            HZ_CUST_ACCOUNT_ROLES car .quote_to_site_id = csv.quote_to_contact_id = car.           OKX_CUST_SITES_V csv where oks.1.id1 and okc. The query can be simplified to return specific fields. How to Find the Quote To Party ID in a Service Agreement.40) "Account Name".30) "Contract Number".60) "Quote To Address".             car.1.              hca.             oks.30) "Email Address". It is a single query from multiple tables.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – RENEWAL TAB Let’s review the Quote To portion of the Renewals tab.1.cust_account_id from OKS_K_HEADERS_B oks.contact_point_id and hp. for additional information.40) "Contact Party Name".party_id and car.contract_number.              car.cust_account_id = hca. select substr(k.contract_number_modifier is null and tl.            substr(k.1.cgp_parent_id = tl.id and k.contract_number = '23572'.Oracle CRM Service Contracts Queries SERVICE CONTRACT HEADER – ADMIN TAB The contract group is stored in OKC_K_GRPINGS.included_chr_id = k.contract_number. This query can be used to obtain the contract group(s) for a contract.25) "Group Name" from OKC_K_HEADERS_ALL_B k.language = 'US' AND gp.id and k.name.           OKC_K_GROUPS_TL tl where gp.-----------------AL .1.25) "Modifier".           OKC_K_GRPINGS gp. Contract Number ----------------------23572 Modifier Group Name ------------.25) "Contract Number".1.contract_number_modifier.             substr(tl. select ls.lse_name  . TO_CHAR( oal. oal. an important identifier in a contract line.id and k. oll. B1. Contract Line Data Note: in OKC_K_LINES_B the chr_id field is only populated with the contract header id for contract lines.service_name  .LSE_ID. OKC_LINE_STYLES_B.id = l.           OKC_K_LINES_B l. This table has descriptions for the lse_id. old.lty_code. The cle_id in OKS_K_LINES_B points to the id in OKC_K_LINES_B.dnz_chr_id and l.contract_number = '23572'. oal.ship_to_site_use_id from okc_k_headers_all_b k.id = okls.cle_id and l. This SQL takes data from views rather than from actual contracts tables and is useful for reviewing data but not ideal for verifying if base tables hold correct data SELECT DISTINCT oal.START_DATE.TRN_CODE.bill_to_site_use_id.END_DATE. TO_CHAR( oal.             l. 'DD­MON­YYYY' ) "Start Date"  . Dnz_chr_id is populated with the contract header id for both lines and sublines. 'DD­MON­YYYY' ) "End Date"  .----------------------------.---------------------SERVICE 3731 6798 B.             l.           OKS_K_LINES_B okls.lse_id = ls. oal. this value is NULL.CURRENCY_CODE "Currency|Code"  .LINE_NUMBER  . oal. For contract sublines. From this query you can see that the relationship between OKC_K_LINES_B and OKS_K_LINES_B is similar to the relationship for the corresponding tables at the header level. A new table is introduced.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – INFORMATION The contract line information is stored in OKC_K_LINES_B and OKS_K_LINES_B.           OKC_LINE_STYLES_B ls where k.STS_CODE "Status"  . Create a service line. LTY_CODE BILL_TO_SITE_USE_ID SHIP_TO_SITE_USE_ID -------------. From this query you see that the lse_id indicates that this is a service line. id  AND cle_id IS NULL  AND qpl.chr_id = '<value of id taken from query A1>'  ORDER BY to_number(line_number).id = oll.Oracle CRM Service Contracts Queries . okc_launch_lgrid_v oll  . USAGE_PERIOD  .CONTRACT_ID = oll.chr_id  AND oll. (Note that this query may appear to return duplicate lines. USAGE_TYPE  . select *  from OKC_K_LINES_B  where CHR_ID IN (select id  from okc_k_headers_b  where contract_number = '<contract number>'). . qp_pricelists_lov_v qpl  . Data taken directly from contract table. INV_RULE_ID  . BILLING_SCHEDULE_TYPE  . UOM_QUANTIFIED  . CUST_ACCT_ID  .NAME "Price List Name"  .  B2. SHIP_TO_SITE_USE_ID  . BILL_TO_SITE_USE_ID  . ACCT_RULE_ID  . INVOICE_TEXT  FROM oks_auth_lines_v oal  . oks_line_details_v old  WHERE oal. as the query on okc_k_headers_b will return more than one contract if the contract has been renewed).PRICE_LIST_ID = oal.PRICE_LIST_ID  AND old. SHIP_TO_SITE_USE_ID  . qpl. Again use Help / Diagnostics / Examine to review the id. This allows users to change all contract coverages simply by modifying the standard coverage. Use Help / Diagnostics / Examine to get the id for the coverage header.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – COVERAGE INFORMATION Let’s examine the coverage for this line. Search for the Gold coverage. The coverages for all contract lines reference a standard coverage. . This is a new feature in R12. Open the Effectivities tab for the line and press the Details button. Exit the contract and navigate to Setup / Contract / Standard Coverage. Notice that the values are the same. Use Help / Diagnostics / Examine again.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – COVERAGE INFORMATION To illustrate the difference. changing it to a custom coverage. Open the coverage Details and press the Customize button. modify the coverage for this line. Generating a custom coverage causes the application to create a new coverage record. . one that is specific to this contract. This is returned: COVERAGE_ID STANDARD_COV_YN ------------------------------------------------224040514744793365267559317923181517851 N For reference purposes. You will see that the coverage_id is the id for the standard coverage.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – HOW TO IDENTIFY COVERAGE FOR A LINE So how does the application know which coverage to use? Where is the information likely to be located? My guess is OKS_K_LINES_B. standard_cov_yn from OKS_K_LINES_B where cle_id = 224040514744789738490100474035657399323. Use Help / Diagnostics / Examine from the contract line to get the ID: Now run this query: select coverage_id. My next guess would be OKC_K_LINES_B. Why? Because this is the type of information that was probably placed in a rules table at one time. run a similar query for a contract line that uses a standard coverage. . id and coverage.lse_id = covls. we will see the same relationship between a contract subline and it’s parent. This is because the coverage information and the line information are stored in the same table. The cle_id for the Business Process is the id for it’s parent. the Coverage (Name). Later.              covls. Position the cursor in the Time Zone.           OKC_LINE_STYLES_B toplinels where coverage. The first two columns in the result are from the coverage record. Notice that OKC_K_LINES_B is queried twice. a contract line.id and topline. in this case.lty_code from OKC_K_LINES_B coverage. Now position the cursor in the Business Process.id).cle_id = topline. The id for this line is the cle_id for the child Time Zone record.id = 224040514744793365267559317923181517851 and coverage. .             to_char(topline. The cle_id in the coverage points to it’s parent. the top line.             toplinels. TO_CHAR(COVERAGE.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – RELATIONSHIP BETWEEN COVERAGE HEADER AND LINE In a previous page we found that the id for the coverage is 224040514744793365267559317923181517851.           OKC_K_LINES_B topline.id).ID) LTY_CODE TO_CHAR(TOPLINE.id. This query demonstrates how the cle_id can be used to find the parent. select to_char(coverage.           OKC_LINE_STYLES_B covls.lty_code. Use Help / Diagnostics / Examine to get the cle_id.lse_id = toplinels.ID) LTY_CODE ----------------------------------------------------------------------------------------224040514744793365267559317923181517851 COVERAGE 224040514744789738490100474035657399323 SERVICE The same pattern can be seen throughout the coverage template. The full query is on the next page. This leads us to the coverage in okc_k_lines_b. The id for this record allows us to identify the business processes (via business process cle_id). let’s expand the query to show much of the information that appears in the Coverage Details form. We first obtain the coverage_id for the contract line from oks_k_lines_b. the id for the business processes allows us to identify the reaction times (again. one that accesses the table okc_k_lines_b many times. This is a complicated query. via cle_id). . COMPLEX COVERAGE QUERY Now that we know how to identify the coverage id.Oracle CRM Service Contracts Queries SERVICE COVERAGE. cle_id = covline.1.           CS_INCIDENT_SEVERITIES css where hdr.15) "Coverage Name".25) "Contract  Modifier".name.           OKS_K_LINES_B oksline.             substr(mtl.lse_id = '2'     and covline.           OKS_ACTION_TIME_TYPES att.1.           OKS_ACTION_TIMES at.id     and covtl.inventory_item_id     and hdr.             at.id = it.             at.1.dnz_chr_id     and line.           OKC_K_LINES_TL covtl.1.            OKC_K_LINES_B line.             at.cle_id .             at.           OKC_K_LINES_B covline. COMPLEX COVERAGE QUERY select substr(hdr.15) "Line Number".Oracle CRM Service Contracts Queries SERVICE COVERAGE.contract_number_modifier.organization_id     and line.25) "Business Process Name".lse_id = '1'     and line.inv_organization_id = mtl.object1_id1 = mtl.             substr(bproc.contract_number.             at.uom_code "Reaction UOM".1.           MTL_SYSTEM_ITEMS_B mtl.sat_duration "Saturday Duration".cle_id     and it.           OKS_K_LINES_B reactoksline.lse_id = '3'     and bpline.20) "Contract Number".name.           OKC_K_LINES_B bpline.contract_number = '23572'     and hdr.             substr(covtl.id = oksline.              substr(line.             at.           CS_BUSINESS_PROCESSES bproc.           OKC_K_ITEMS it.id = oksline.thu_duration "Thursday Duration".             at.id = line.1.cle_id     and covline.language = 'US'     and bpline.sun_duration "Sunday Duration" from OKC_K_HEADERS_ALL_B hdr.           OKC_K_ITEMS itbp.wed_duration "Wednesday Duration".           OKC_K_LINES_B reactline.             at.              substr(hdr.segment1.fri_duration "Friday Duration".20) "Service Name".id = covtl.tue_duration "Tuesday Duration".coverage_id     and covline.id     and bpline.id = itbp.             css.mon_duration "Monday Duration".line_number.name "Severity Name". Oracle CRM Service Contracts Queries     and itbp.  .cle_id     and at.cle_id = reactline.id     and reactline.id = at.business_process_id     and reactline.cov_action_type_id = att.incident_severity_id = css.id     and att.lse_id = 4     and reactline.id     and att.id = reactoksline.incident_severity_id.object1_id1 = bproc.cle_id     and reactline.cle_id = bpline.action_type_code = 'RCN'     and reactoksline.           MTL_SYSTEM_ITEMS_B mtl.contract_number_modifier.25) "Modifier Number".dnz_chr_id and okc.            substr(k.inventory_item_id and it.organization_id. is the org_id.30) "Service Name".cle_id and it.            substr(mtl.id = it.            it.           OKC_K_LINES_B okc.object1_id1 = mtl.------------------.contract_number = '23572' and k. but we will see other object_code values are used to identify the line or subline type. Contract Number Modifier Number Service Name Object Code -----------------------.           OKC_K_ITEMS it where k.id = okc.1.segment1. How do you identify the item name? The item information for a contract topline is stored in okc_k_items.jtot_object1_code "Object Code" from OKC_K_HEADERS_ALL_B k.----------------23572 WRTEST OKX_SERVICE The value for object_code isn’t that important for this query.contract_number.1. . The column object1_id1 has the inventory_item_id.-----------------------.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – ACCOUNTS TAB (ITEM NAME) Let’s examine several of the fields at the line level. The org_id is also stored in okc_k_headers_all_b. select substr(k. The column object1_id2.object1_id2 = mtl.lse_id = '1' and okc. a value that is mapped to the table mtl_system_items_b.1.25) "Contract Number". Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – ACCOUNTS TAB (BILL TO / SHIP TO) You may see similarities to a previous header level query.lse_id = '1'.cle_id and okc. .25) "Contract Number". The Bill To and Site information are stored in OKC_K_LINES_B.bill_to_site_use_id "Bill To". remember to check the values in OKC_LINE_STYLES_B.           OKS_K_LINES_B oks where k.line_number.1. When in doubt about the values.id = okc.contract_number = '23572' and k. select substr(k.ship_to_site_use_id "Ship To" from OKC_K_HEADERS_ALL_B k.1.        okc.contract_number.        substr(okc.10) "Line Number".dnz_chr_id and okc.id = oks.           OKC_K_LINES_B okc.        okc. Why did I restrict the query to lse_id = 1? The top line lse_id for a Service Line in a Service Agreement is ‘1’. 10) "Line Number".line_number.        substr(tl.id = tl.cle_id and oks.           OKC_K_LINES_B okc. The text is located in OKS_K_LINES_TL a translation table for OKS_K_LINES_B.1.1. To obtain the information. the line to the oks line and then the oks line to the translation table.30) "Invoice Text" from OKC_K_HEADERS_ALL_B k. select substr(k.lse_id = '1' and okc.contract_number = '23572' and k.id = oks.1.        substr(okc.25) "Contract Number".id. join the contract header to the line.           OKS_K_LINES_B oks. .           OKS_K_LINES_TL tl where k.invoice_text.dnz_chr_id and okc.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – EFFECTIVITIES TAB (INVOICE TEXT) This query displays the invoice text.contract_number.id = okc. CLE_ID RLE_CODE OBJECT1_ID1 ---------------------------------------------------------------.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – ACCOUNTS TAB (CONTACT INFORMATION) The contact information is in okc_contacts.-----------------CUST_BILLING 56854 CUST_SHIPPING 3736 .           OKC_CONTACTS contact  where contact. a link to hz_parties for the customer record.object1_id1 from OKC_K_PARTY_ROLES_B pr. This query returns the party_id. Two main okc tables retain the data. The cle_id (contract line id) is in OKC_K_PARTY_ROLES_B. rle_code.cle_id = 224040514744789738490100474035657399323 CRO_CODE OBJECT1_ID1 -----------------------------. object1_id1 from OKC_K_PARTY_ROLES_B where cle_id = 224040514744789738490100474035657399323. contact.id and pr.cro_code.cpl_id = pr.--------------------------------------------------------------------224040514744789738490100474035657399323 CUSTOMER 4429 Use the cle_id to find the entry in okc_contacts: select contact. select cle_id. party_id.           HZ_CUST_ACCOUNT_ROLES hz.------------------------------------------CUST_BILLING Ray Adams-Business World.cpl_id and contact.party_id and pr.id = contact. but this is one way to identify the contacts.1. CRO_CODE SUBSTR(HP. hz.cle_id = 224040514744789738490100474035657399323.cust_account_id from OKC_K_PARTY_ROLES_B pr.cro_code.party_id = hz.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – ACCOUNTS TAB (CONTACT INFORMATION) The object1_id1 links to hz_cust_account_roles.PARTY_NAME.cust_account_role_id and hp.25) PARTY_ID CUST_ACCOUNT_ID -----------------------.           OKC_CONTACTS contact. which then links to hz_parties.-------------------------.            HZ_PARTIES hp where pr.             hz.25).             substr(hp.1.object1_id1 = hz.party_name. select contact.4554 3347 CUST_SHIPPING Nicole Burg-Business Worl 4452 3347 . The query actually references tables. The payment information is also stored in OKS_K_LINES_B. Purchase Order and Credit Card Information Stored in the Service Contracts Tables? The Note describes the location in OKS_K_HEADERS_ALL_B. This is a sample query. Refer to Note 459982. The same information is stored at the line level in OKS_K_LINES_B.               tax_exemption_id from OKS_K_LINES_B where cle_id = 224040514744789738490100474035657399323.1. Where Is Commitment. but it will return no information because the tax information is not entered in this contract. select tax_code.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – ACCOUNTS TAB (CONTACT INFORMATION) The tax information is in OKS_K_LINES_B. . This is used to identify the subline type. covered customer. covered system. we again need to establish a link to MTL_SYTEM_ITEMS_B.inventory_item_id = mtl.1.dnz_chr_id and okc.            csi. Contract Subline Data Note: When you add a subline to a contract OKC_K_LINES_B is populated with data. but the table is included in case other columns from that table are needed.id and ki.            CSI_ITEM_INSTANCES csi. .instance_number from  OKC_K_HEADERS_ALL_B k.ID = ki.            mtl.object1_id1) = csi.            OKC_LINE_STYLES_V ks.ID = ki. The query does not need to access CSI_ITEM_INSTANCES. To identify the product name. This time the object1_id1 has the instance_id Jtot_objecdt1_code has the value ‘OKX_CUSTPROD’.Oracle CRM Service Contracts Queries SERVICE CONTRACT SUBLINES – (COVERED) PRODUCT INFORMATION Let’s create a contract subline.            substr(ks. etc. Run this query to get a general idea of the type of content in OKC_K_ITEMS.organization_id and TO_NUMBER(ki.1.segment1 "Item Name".contract_number = '23572'. etc. Let’s review this query in detail: OKC_K_ITEMS is referenced again.last_vld_organization_id = mtl.            OKC_K_LINES_B okc.inventory_item_id and k.ID = okc.dnz_chr_id and k.15) "Covered Level".instance_id and csi.cle_id and okc.lse_id = ks. C.contract_number_modifier IS NULL and k.jtot_object1_code IN ('OKX_CUSTPROD') and csi.              OKC_K_ITEMS ki.            MTL_SYSTEM_ITEMS_B mtl where k. Modifications in the query are needed to obtain the information for covered item. one for a covered product.NAME.15) "Subline Number". You will see the object codes that are used to identify usage items. select substr(okc.line_number. select distinct jtot_object1_code from OKC_K_ITEMS. select  id  . Query for all the sublines on a contract with a Level type that can be seen when authoring the contract (i. price_type  . Customer or Site). C1.e. (Note that this query may appear to return duplicate lines. price_negotiated  . pricing_date  . currency_code  .Oracle CRM Service Contracts Queries some of the data created there for each subline is internal data. date_terminated  . 'Party'. price_list_id  . price_unit_percent  . System. object_version_number  . 9. 'Customer') "Level"  . 3). item_to_price_YN  . Item. Site.           11.           7. 1. restricts to lines which have Level of Product.           9. 7.           35. line_number  . 10. sts_code  . 'Item'. start_date  . Replace <parent line number> with the line number of the required contract line (e. price_level_ind  . Use the LSE_ID to restrict the data returned when querying. price_unit  . or from query B2. cle_id  . (Note that this query may appear to return . taken either from the contract form. 2.g. 35). end_date  from OKC_K_LINES_B  where DNZ_CHR_ID IN (select id                      from okc_k_headers_b                      where contract_number = '<contract number>')  and lse_id IN(8. as the query on okc_k_headers_b will return more than one contract if the contract has been renewed). decode(lse_id. hidden_ind  .           8. 'Site'. 'Product'. 11. price_list_line_id  . Query for contract sublines for a given contract line only.           10.  C2. 'System'. C3. sts_code  . currency_code  . price_list_line_id  . the subline is for a particular install base instance). 'System'.segment1  .NAME . price_negotiated  . start_date  . price_type  .           8. 'Site'.           7. 'Item'. item_to_price_YN  .line_number. 'Party'. line_number  . end_date  from OKC_K_LINES_B  where DNZ_CHR_ID IN (select id                      from okc_k_headers_b                      where contract_number = '<contract number>')  and cle_id IN (select id               from okc_k_lines_b               where chr_id IN (select id                               from okc_k_headers_b                               where contract_number = '<contract  number>')               and line_number = <parent line number>)  and lse_id IN(8.           10. 9. decode(lse_id. 10. This query returns the inventory item for a given contract subline where the Level = Product (i. object_version_number  .Oracle CRM Service Contracts Queries duplicate lines.           9.           35. pricing_date  .e. 7. 'Customer') "Level"  . price_level_ind  . select  id  . ks. price_unit_percent  . SELECT kl. price_unit  . 35). price_list_id  . date_terminated  . 'Product'. cle_id  . 11. i. as the query on okc_k_headers_b will return more than one contract if the contract has been renewed).           11. dnz_chr_id  AND kh.organization_id  AND TO_NUMBER(ki.ID  AND ki.  csi_item_instances c.  okc_k_lines_b kl.  okc_line_styles_v ks.cle_id  AND kl. .ID = ki.ID = kl.last_vld_organization_id = i.  mtl_system_items_b i  WHERE  kh.inventory_item_id .dnz_chr_id  AND kl.inventory_item_id = i.contract_number = '<contract number>'  AND kh.lse_id = ks.object1_id1) = c.contract_number_modifier IS NULL ­­can be populated  AND kh.jtot_object1_code IN ('OKX_CUSTPROD')  AND c.instance_id  AND c.Oracle CRM Service Contracts Queries FROM  okc_k_headers_b kh.ID = ki.  okc_k_items ki. This query returns the information that appears at the top of the Billing Schedule form. select okc. etc. are also stored in OKS_K_LINES_B.              oks. suppressed credit amount.           OKS_K_LINES_B oks where okc.             oks. We know the line id from previous queries. credit.inv_rule_id. .cle_id and okc.id = oks.acct_rule_id. The accounting rule and billing schedule type are stored in OKS_K_HEADERS_B.id = 224040514744789738490100474035657399323.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – BILLING STREAM Let’s begin with the information that appears at the top of the Billing Schedule. INV_RULE_ID ACCT_RULE_ID BILLING_SCHEDULE_TYPE --------------------------------------------------------------------2 1 T The unbilled.billing_schedule_type from OKC_K_LINES_B okc. The invoicing rule (for the line) is stored in OKC_K_HEADERS_B.               uom_per_period.              level_periods.             start_date.             uom_code from OKS_STREAM_LEVELS_B where cle_id = 224040514744789738490100474035657399323. SEQUENCE_NO LEVEL_PERIODS START_DATE END_DATE UOM_PER_PERIOD UOM_CODE ------------------------------------------------------------------------------------------------------------------1 1 11-MAY-10 10-NOV-10 6 MTH 2 2 11-NOV-10 10-MAY-11 1 QRT Remember that these billing streams exist at the subline level too.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – BILLING STREAM There are two billing streams in this example.             end_date. This query returns the pertinent information. select sequence_no. . -----------------------------------------1 11-MAY-10 1 11-NOV-10 2 11-FEB-11 DATE_END AMOUNT --------------- -------------- 10-NOV-10 10-FEB-11 10-MAY-11 55 27. remember that this information appears at the subline level too. This query displays the schedule information. This is a critical field in the table. select substr(sequence_number.15) "Sequence Number". date_start.5 The date_completed is not populated.            amount. Again.            date_start. . Sequence Number DATE_START DATE_COMPLETED ------------------------. This column is populated when an invoice is generated for the contract.5 27.1.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – BILLING SCHEDULE Press the Schedule button to generate the billing schedules.             date_end.             date_completed from OKS_LEVEL_ELEMENTS where cle_id = 224040514744789738490100474035657399323 order by sequence_number.               lvl. .             lvl.             lvl.cle_id = lvl.              lvl. but you are not sure which one.              to_char(lvl.1.15) "Sequence Number".amount. This query links the tables OKS_STREAM_LEVELS_B and OKS_LEVEL_ELEMENTS based on the common column cle_id.amount.             substr(lvl.cle_id and lvl. that you feel there is corruption with one of the streams.parent_cle_id) "Top Level Line ID".             lvl. select strm.           OKS_LEVEL_ELEMENTS lvl where strm.date_end. A minor change in the query allows us to display the information for all of the sublines.              lvl.              to_char(lvl.             to_char(lvl.date_end.             lvl.cle_id = lvl. The level elements table also has a column parent_cle_id. one that is populated with 224040514744789738490100474035657399323 for all of the sublines.sequence_no "Stream Number". select strm.           OKS_LEVEL_ELEMENTS lvl where strm.date_start.1.sequence_number.             to_char(lvl.cle_id) "Level Element Line ID".             substr(lvl. A query is sometimes needed to show the information for the top line and all of the subline streams. In many cases there are multiple sublines.date_completed from OKS_STREAM_LEVELS_B strm.cle_id and strm.sequence_number.date_completed from OKS_STREAM_LEVELS_B strm. This is insufficient though because it does not show the information for the sublines. Let’s assume that you know the line id.15) "Sequence Number".sequence_no "Stream Number".date_start.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – STREAM / SCHEDULE QUERY Identifying why schedules are corrupt can be difficult.parent_cle_id) "Top Level Line ID".parent_cle_id = 224040514744789738490100474035657399323.cle_id = 224040514744789738490100474035657399323.cle_id) "Level Element Line ID".              lvl. amount.cle_id = lvl.cle_id) "Level Element Line ID".date_start.1.Oracle CRM Service Contracts Queries SERVICE CONTRACT LINES – STREAM / SCHEDULE QUERY Let’s combine the two and sort them so that the topline schedule is followed immediately by all of the subline schedule entries for that line.parent_cle_id = 224040514744789738490100474035657399323 order by 1.date_end.              to_char(lvl.              lvl.             lvl.amount.sequence_number.              to_char(lvl.parent_cle_id) "Top Level Line ID".             substr(lvl.              lvl.date_end.cle_id) "Level Element Line ID".15) "Sequence Number". select strm.             substr(lvl.cle_id and lvl.date_completed from OKS_STREAM_LEVELS_B strm. 5.1.             to_char(lvl.sequence_no "Stream Number".           OKS_LEVEL_ELEMENTS lvl where strm.sequence_number.date_start.cle_id = 224040514744789738490100474035657399323 UNION select strm. Stream Number Sequence Number Top Level Line ID Level Element Line ID DATE_START AMOUNT DATE_COMPLETED ---------------------------------------------.             lvl.15) "Sequence Number".             lvl.              lvl. 2.sequence_no "Stream Number".           OKS_LEVEL_ELEMENTS lvl where strm.parent_cle_id) "Top Level Line ID".              lvl.cle_id = lvl.             to_char(lvl.date_completed from OKS_STREAM_LEVELS_B strm.------------------------------------------------------------------------------------------------------1 1 224040514744789738490100474035657399323 224040514744789738490100474035657399323 11-MAY-10 55 1 1 224040514744789738490100474035657399323 224654994456990219633500215272306024339 11-MAY-10 55 1 1 224040514744789738490100474035657399323 DATE_END --------------- 10-NOV-10 10-NOV-10 .             lvl.cle_id and strm. .5 10-FEB-11 10-FEB-11 The first entry is for the top line. the schedule entry for May 11 to Nov 10.5 1 1 224040514744789738490100474035657399323 224654994456990219633500215272306024339 11-NOV-10 27.Oracle CRM Service Contracts Queries 224040514744789738490100474035657399323 11-NOV-10 27. Notice that the Top Level Line ID and Level Element Line ID have the same value. The second entry is for the subline. Oracle CRM Service Contracts Queries Lines 3 and 4 are for the next schedule entry for stream 1. 2011.SERVICE CONTRACT BILLING TABLES Let’s run Main Billing for the first Billing Period. See what happens to the level elements when this query is rerun after billing. We know from this query that an invoice has been generated for schedule entry 1.            date_start.             date_end. .15) "Sequence Number".5 27.1. date_start.             date_completed from OKS_LEVEL_ELEMENTS where cle_id = 224040514744789738490100474035657399323 order by sequence_number.-----------------------------------------1 11-MAY-10 10-NOV-10 1 11-NOV-10 2 11-FEB-11 DATE_END AMOUNT --------------- -------------- 10-NOV-10 10-FEB-11 10-MAY-11 55 27. the billing schedule for Nov 11 to Feb 11.5 The date_completed is now populated. select substr(sequence_number. Sequence Number DATE_START DATE_COMPLETED ------------------------. One invoice has been generated.            amount. let’s examine other billing tables.cle_id).-------------------------------------------------------------------------------------------------------------------. select substr(hdr.creation_date. Contract Number Modifier Creation Date TO_CHAR(BCL. for termination.             bill_action. for regular invoice.contract_number_modifier. The value is -44 when a contract line is terminated and the credits are suppressed.             to_char(bcl.Oracle CRM Service Contracts Queries SERVICE CONTRACT BILLING TABLES Now.           OKC_K_LINES_B  line.id and contract_number = '23572' order by hdr. this value tells Main Billing to ignore the entry. Services for sales order lines are invoiced via integration from OM to Receivables.dnz_chr_id = hdr.             to_char(bcl.contract_number.15)  "Contract Number".1. It also has this value when the entry is created a Sales Order.'MM/DD/YYYY HH24:MI:SS')  "Creation Date".cle_id = line.CLE_ID) BILL_ACTION AMOUNT ----------------------.1. The bill_action is generally RI.15) "Modifier". and TR.             substr(hdr.           OKS_BILL_CONT_LINES  bcl where bcl.contract_number.-------------23572 05/19/2010 17:29:24 224763666759272367907400019617050675714 224040514744789738490100474035657399323 RI 55 What to look for in this table: The btn_id is populated when Main Billing has processed the transaction.id and     line.btn_id).             to_char(bcl.BTN_ID) TO_CHAR(BCL. amount from OKC_K_HEADERS_ALL_B hdr. . The btn_id will be -44 under two circumstances. Contract Number Modifier Creation Date TO_CHAR(BCL. Run the same query again. I know that Main Billing has not picked up the transaction. TR.CLE_ID) BILL_ACTION AMOUNT ----------------------.BTN_ID) TO_CHAR(BCL. Notice that there is another entry.61 . Because it is not yet populated.-------------------------------------------------------------------------------------------------------------------.Oracle CRM Service Contracts Queries SERVICE CONTRACT BILLING TABLES Let’s terminate the contract subline and run Main Billing again. The btn_id is not populated.-------------23572 05/19/2010 17:29:24 224763666759272367907400019617050675714 224040514744789738490100474035657399323 RI 55 23572 05/19/2010 17:57:30 224040514744789738490100474035657399323 TR -52. transaction. a termination. parent_cle_id = 224040514744789738490100474035657399323 order by 1.date_completed from OKS_STREAM_LEVELS_B strm.parent_cle_id) "Top Level Line ID".             lvl.             to_char(lvl.date_end.1.             to_char(lvl.------------------------------------------------------------------------------------------------------1 1 224040514744789738490100474035657399323 224040514744789738490100474035657399323 11-MAY-10 55 1 1 224040514744789738490100474035657399323 224654994456990219633500215272306024339 11-MAY-10 55 1 1 224040514744789738490100474035657399323 DATE_END --------------- 10-NOV-10 10-NOV-10 .              lvl.1.15) "Sequence Number".           OKS_LEVEL_ELEMENTS lvl where strm.parent_cle_id) "Top Level Line ID". select strm.cle_id) "Level Element Line ID". 5.amount.date_end.             substr(lvl.             lvl.cle_id = 224040514744789738490100474035657399323 UNION select strm.              lvl. run this query again.              lvl. 2.              to_char(lvl.date_start.Oracle CRM Service Contracts Queries SERVICE CONTRACT BILLING TABLES As a final action.sequence_no "Stream Number".sequence_no "Stream Number". Stream Number Sequence Number Top Level Line ID Level Element Line ID DATE_START AMOUNT DATE_COMPLETED ---------------------------------------------.cle_id and strm.cle_id = lvl.cle_id = lvl.             substr(lvl.sequence_number.              to_char(lvl.             lvl.sequence_number.           OKS_LEVEL_ELEMENTS lvl where strm.amount.cle_id and lvl.date_start.              lvl.             lvl.cle_id) "Level Element Line ID".15) "Sequence Number".date_completed from OKS_STREAM_LEVELS_B strm. The entry still exists at the line level. cle_id 224654994456990219633500215272306024339. not the line. only because the subline was terminated. . The termination process truncated all of the schedule entries if the date_start is greater than the termination date. no longer exists.Oracle CRM Service Contracts Queries 224040514744789738490100474035657399323 11-NOV-10 0 10-FEB-11 If you compare this result to the one that was run earlier you will see that the Nov 11 entry for the subline. contract_number_modifier.'­')) AND ose. F.  csi_item_instances csi.Oracle CRM Service Contracts Queries E. This is what this query is retrieving). Note that this query will not return any data if Autoinvoice has been run since the records are deleted from this table once they have been successfully processed by Autoinvoice. This will return the data populated into the table by Service Contracts Main Billing.  okc_k_headers_b okh.  okh. Query to return all the data in the RA interface table for a given service contract.id  AND okh. (Note that when you enter a subscription line. Subscription Contracts F1.'­') = Nvl('<contract modifier>'. SELECT *  FROM ra_interface_lines_all  WHERE sales_order = '<contract number>' . Query to find which subscription contract line created the install base instance.dnz_chr_id IN (SELECT id  FROM okc_k_headers_b  WHERE contract_number = '<contract number>'  AND NVL(contract_number_modifier. SELECT osh.id  AND osh.id  AND okl. the application automatically creates an Oracle Install Base item instance.  okc_k_lines_b okl  WHERE osh.order_line_id = csi.contract_number.  okl.instance_number  FROM oks_subscr_elements ose.'­') = NVL('<contract  modifier>'.contract_number_modifier.contract_number_modifier.contract_number = '<contract number>'  AND NVL(okh.  okh. for a subscription fulfillment.contract_number.  csi_item_instances csi  WHERE ose.cle_id = okl.'­').  . SELECT okh.chr_id = okh. Query to find the install base instances created by a Subscription Contract as a result of subscription fulfillment.line_number  FROM oks_subscr_elements ose.last_oe_order_line_id.dnz_chr_id = okh.line_number  FROM oks_subscr_header_b osh. Receivables Interface Data E1.instance_id. How to find the install base instance created for the subscription line item.  F3.  okh. SELECT csi.  okl. F2. The table OKS_K_ORDER_DETAILS captures service contract details when a service is ordered in Order Management.  okc_k_lines_b okl  WHERE csi. okc_k_rel_objs_v obj where okl.id = ose. obj.dnz_chr_id = <contract id from query A1>  and lse_id in (7. SELECT * FROM OKS_K_ORDER_DETAILS WHERE CHR_ID =<contract id from query A1> . Order Details for Contracts Created from Order Management G1. obj.dnz_cle_id.dnz_chr_id  AND okl.18. G2. G. 11.id  AND okl.jtot_object1_code from okc_k_lines_b okl .cle_id Service_Line . 25.order_line_id = csi. okl. 8.id = ose.chr_id and okl.dnz_chr_id . okl.object1_id1 .dnz_chr_id = obj.last_oe_order_line_id  AND okh. 10.instance_number = '<Instance Number>'  AND ose.chr_id = okh.Oracle CRM Service Contracts Queries okc_k_headers_b okh.35). Query which retrieves the order header id and order line id for a given contract. 9.id Subline . object1_id1 gives the order header id where jtot_object1_code = OKX_ORDERHEAD and the order line id where jtot_object1_code = OKX_ORDERLINE select okl. Receivables.'||okc.line_number||'.country. etc.city.end_date.  hl.  hz_party_sites hps. OKC_K_HEADERS_B_N4)  INDEX(okc. select /*+ INDEX(grpings.  k.state.  hz_cust_site_uses_all hcsu. hz_cust_accounts_all hca. The result of this is being not too familiar on how the tables are related and how to come up with information.  k.address1.Oracle CRM Service Contracts Queries Service Contract Coverage and Price Information The hardest part in Service Contract module is that it is pretty new relative to the other modules such as the Order Management. OKC_K_LINES_B okct.  . OKC_K_GRPINGS_N1)   INDEX(k.  mtl. hl. This is a sample script.location.party_name customer_name. An example of a requirement is to produce an active contracts with price and covered item information.  hcsu.description item_des. There could be an enhancement to this but this can be a good basis to extract information which is Install Baseddriven. CSI_ITEM_INSTANCES csi. OKC_K_LINES_B_N6)  INDEX(ki OKC_K_ITEMS_N2) */  k.postal_code. Inventory.start_date. hz_parties hp.  okc.  hl. hl.address2. csi.  hl.segment1 item .contract_number.  hz_locations hl.price_negotiated from OKC_K_HEADERS_B k.  mtl. okct.  hl.serial_number. okc_k_groups_tl groups1.  hl.address3. okc_k_grpings grpings. OKC_K_LINES_B okc. OKC_K_ITEMS ki.line_number  line_number. MTL_SYSTEM_ITEMS_B mtl. hp. ID = ki. SYSDATE + 1) > SYSDATE and ki.date_terminated FROM csi_item_instances cii.end_date > SYSDATE AND k.party_id and hps.cle_id and okc.object1_id1) = csi.line_number||'.hp.location.ship_to_site_use_id = hcsu.line_number.name = 'GROUP NAME' and groups1.start_date <= SYSDATE aND k. cii.'||okc.id = grpings.date_terminated.Oracle CRM Service Contracts Queries hz_cust_acct_sites_all hcas where 1 = 1  and groups1.dnz_chr_id and okc.jtot_object1_code IN ('OKX_CUSTPROD') and csi. mtl.description  item_des.end_Date >= SYSDATE  and NVL(okc.state.end_Date >= SYSDATE and okct.segment1 item .party_name  customer_name.last_vld_organization_id = mtl.cgp_parent_id and grpings.cust_acct_site_id and hcas.contract_number. OKC_K_LINES_B okc. apps.ID = okc.serial_number.inventory_item_id Another option without considering the termination date as the filter but just select the termination date would be: SELECT k.okct. hl.instance_id and csi.hl.language = 'US' and groups1. mtl.party_site_id and k.cust_acct_site_id = hcas.address2.lse_id = 9 and okc.date_terminated.party_id = hp.organization_id and TO_NUMBER(ki.address1. .location_id = hl. k.dnz_chr_id and k.inventory_item_id = mtl.city.id   and k.site_use_code = 'SHIP_TO' and hca.postal_code.location_id and hcsu. apps. OKC_K_HEADERS_B k.ID = okc.  hl.  k.start_date.site_use_id and hcsu.start_date <= SYSDATE and okc.address3. hl.country.party_id and hps. hl. hl.party_id = hp.party_site_id = hps.cle_id and okct.OKS_AUTH_LINES_V  okct. SYSDATE + 1) > SYSDATE and NVL(k.included_chr_id = k.service_name .hl. ocl. hcsu. OKC_K_ITEMS ki.end_date.ID = ki.OKS_LINE_DETAILS_V ocl. k.start_date <= SYSDATE and okct. cle_id AND k.cust_acct_site_id = hcas.cgp_parent_id = 10000 ­­­­ or you can replace this with a  list of Group IDs or all IDs AND grpings.inv_master_organization_id = 104 ­­ Parent Organization ID AND okct.ID = ki. 'DD­MON­YYYY') AND cii.line_id (+) AND okc.org_id = 116 .party_id AND hps.party_site_id = hps.cust_acct_site_id AND hcas.start_date <= TO_DATE('31­DEC­2011'.ship_to_site_use_id = hcsu.inventory_item_id = mtl.site_use_code = 'SHIP_TO' AND hca.  okc_k_grpings grpings.id = ocl.lse_id = 9 AND okc.dnz_chr_id AND k.inventory_item_id AND mtl.ID = okc.ID = okc.party_id = hp.instance_id AND ki.organization_id = last_vld_organization_id AND grpings. 'DD­MON­YYYY') AND k.  hz_cust_site_uses_all hcsu.object1_id1) = cii.  hz_party_sites hps.party_id AND hps.party_id = hp.Oracle CRM Service Contracts Queries mtl_system_items mtl.location_id AND hcsu.  hz_cust_accounts_all hca. hz_locations hl.jtot_object1_code IN ('OKX_CUSTPROD') AND cii.party_site_id AND hcsu.start_date >= TO_DATE('01­JAN­2011'.location_id = hl.cle_id AND okct.hz_parties hp.id AND k. hz_cust_acct_sites_all hcas WHERE 1 = 1 AND TO_NUMBER(ki.site_use_id AND hcsu.included_chr_id = k.
Copyright © 2024 DOKUMEN.SITE Inc.