Vous êtes sur la page 1sur 65

Oracle Service Contracts

Public Application Programming


Interfaces (APIs)

Author : Service Contracts Product Management


Creation Date : 01-APR-2014
Status : Issue 1.0

Service Contracts Public APIs


Document Control
Contributors

Name Organization Title

Reviewers

Name Role Title Date Reviewed

Document References

Document Title Type of Reference Document Location

Service Contracts Public APIs


Table of Contents

Table of Contents

1. Introduction ................................................................................................................. 5
1.1 Abstract ............................................................................................................. 5
1.2 Scope for this Document ................................................................................... 5
1.3 Definitions......................................................................................................... 5

2. Service Contracts APIs ............................................................................................... 6


2.1 Create Service Contract Header: ....................................................................... 7
2.1.1 Description ....................................................................................................................7
2.1.2 API Signature and Parameter Description .....................................................................7
2.1.3 Sample Test Data ......................................................................................................... 14
2.2 Update Contract Header :................................................................................ 17
2.2.1 Description .................................................................................................................. 17
2.2.2 API Signature and Parameter Description ................................................................... 18
2.2.3 Sample Test Data ......................................................................................................... 23
2.3 Create Template from a contract: ................................................................... 26
2.3.1 Description .................................................................................................................. 26
2.3.2 API Signature and Parameter Description ................................................................... 26
2.3.3 Sample Test Data ......................................................................................................... 27
2.4 Create Contract from Template: ..................................................................... 28
2.4.1 Description .................................................................................................................. 28
2.4.2 API Signature and Parameter Description ................................................................... 28
2.4.3 Sample Test Data ......................................................................................................... 29
2.5 Create Contract Line: ...................................................................................... 30
2.5.1 Description .................................................................................................................. 30
2.5.2 API Signature and Parameter Description ................................................................... 30
2.5.3 Sample Test Data ......................................................................................................... 32
2.6 Update Contract Line: ..................................................................................... 34
2.6.1 Description .................................................................................................................. 34
2.6.2 API Signature and Parameter Description ................................................................... 34
2.6.3 Sample Test Data ......................................................................................................... 36
2.7 Generate Billing Schedules: ............................................................................ 38
2.7.1 Description .................................................................................................................. 38
2.7.2 API Signature and Parameter Description ................................................................... 38
2.7.3 Sample Test Data ......................................................................................................... 39
2.8 Create Subline: ................................................................................................ 40

Service Contracts Public APIs


2.8.1 Description .................................................................................................................. 40
2.8.2 API Signature and Parameter Description ................................................................... 41
2.8.1 Sample Test Data ......................................................................................................... 43
2.9 Update Subline: ............................................................................................... 48
2.9.1 Description .................................................................................................................. 48
2.9.2 API Signature and Parameter Description ................................................................... 49
2.9.1 Sample Test Data ......................................................................................................... 51
2.10 Contract Status Change : ................................................................................. 54
2.10.1 Description ................................................................................................................ 54
2.10.2 API Signature and Parameter Description ................................................................. 54
2.10.3 Sample Test Data ....................................................................................................... 54
2.11 Cascade Attributes on Contract: ..................................................................... 55
2.11.1 Description ................................................................................................................ 55
2.11.2 API Signature and Parameter Description ................................................................. 55
2.11.3 Sample Test Data ....................................................................................................... 56
2.12 Terminate contract/line/subline : .................................................................... 57
2.12.1 Description ................................................................................................................ 57
2.12.2 API Signature and Parameter Description ................................................................. 57
2.12.3 Sample Test Data ....................................................................................................... 58
2.13 Contract QA Check and Activation ................................................................ 59
2.13.1 Description ................................................................................................................ 59
2.13.2 API Signature and Parameter Description ................................................................. 60
2.13.3 Sample Test Data ....................................................................................................... 60
2.14 Contract Renewal : .......................................................................................... 61
2.14.1 Description ................................................................................................................ 61
2.14.2 API Signature and Parameter Description ................................................................. 61
2.14.3 Sample Test Data ....................................................................................................... 62
2.15 Delete Contract/Line/Subline: ........................................................................ 63
2.15.1 Description ................................................................................................................ 63
2.15.2 API Signature and Parameter Description ................................................................. 63
2.15.3 Sample Test Data ....................................................................................................... 64

3. Limitations ................................................................................................................. 65

Service Contracts Public APIs


1. Introduction
1.1 Abstract
Many customers implement service contracts while retaining legacy (or building
custom) front-end systems for entry of source transactions. These
legacy/custom transaction systems typically handle quoting and order entry and
when quote is approved or a deal is closed, there is a need for backend
programmatic mechanisms to create service contracts for the purposes of future
administration, billing and to provide entitlements.
This document outlines the basic concepts of the Service Contracts (OKS) APIs
and explains how you can use them to perform operations on service contracts
data .

1.2 Scope for this Document


This document is intended for Oracle Service Contracts Release 12 users,
consultants, and support engineers who want to use service contracts APIs for
manipulating service contracts data. It provides information about the
parameters of the available public APIs and important API features.
The information of the following APIs is provided in this document:
OKS_IMPORT_HEADER_PUB.Create_Contract_Header
OKS_IMPORT_HEADER_PUB.Update_Contract_Header
OKS_IMPORT_HEADER_PUB.Create_Template_from_contract
OKS_IMPORT_HEADER_PUB.Create_Contract_from_Template
OKS_IMPORT_LINE_PUB.Create_Contract_Line
OKS_IMPORT_LINE_PUB.Update_Contract_Line
OKS_IMPORT_LINE_PUB.generate_bill_schedules
OKS_STATUS_CHANGE_PUB.Change_Status
OKS_TERMINATE_CONTRACT_PUB.Terminate_Contract
OKS_DELETE_CONTRACT_PUB.Delete_Contract
OKS_RENEW_CONTRACTAPI_PUB.Renew_Contract
OKS_CASCADE_ATTRIBUTES_PUB.Oks_Cascade_Attributes
OKS_ACTIVATE_CONTRACT_PUB.Activate_Contract
OKS_IMPORT_SUBLINE_PUB.create_subline
OKS_IMPORT_SUBLINE_PUB.update_subline

1.3 Definitions

[Unique Term]
[Definition]

Service Contracts Public APIs


2. Service Contracts APIs

Pre Application Steps:


Before calling the API, org context in which the contract is to be created and FND apps should be set.
The following code snippets can be called to set the org context and FND apps:
okc_context.set_okc_org_context(p_org_id, p_organization_id);

fnd_global.apps_initialize
( user_id => p_user_id
,resp_id => p_resp_id
,resp_appl_id => p_resp_appl_id
);

Error Handling:
All the APIs set the FND messages and also the FND debug log if any exception is raised.

Customer can call the following code snippet to get the fnd messages.

FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;

Customer can capture the fnd debug log while calling the api which helps Oracle Support to analyze the errors
raised during the API call:
a) Set the following fnd profile parameters for the user that will run the api
FND: Debug Log Enabled : Yes
FND: Debug Log Level : Statement
FND: Debug Log Module : %
b) Note the maximum log_sequence number before reproducing the issue.
SELECT max(log_sequence)
FROM FND_LOG_MESSAGES;
c) Call the API
d) Note the maximum log_sequence number after reproducing the issue.
SELECT max(log_sequence)
FROM FND_LOG_MESSAGES;
e) Provide the following output in an Excel sheet:
SELECT *
FROM fnd_log_messages
WHERE log_sequence BETWEEN &max_log_no_step_b AND &max_log_no_step_d
ORDER BY log_sequence;

Service Contracts Public APIs


2.1 Create Service Contract Header:

2.1.1 Description
The create contract header API is used for creating a contract header of Service Agreements,
Subscription Agreements, Warranty and Extended Warranty.
It mainly inserts the data into okc_k_headers_all_b/tl, oks_k_headers_b/tl tables.
It supports contracts with Entered/Active statuses.
If the contract number is not provided, auto numbering setup will be considered.
It doesn’t support to create contracts which are partially billed .

2.1.2 API Signature and Parameter Description

OKS_IMPORT_HEADER_PUB.Create_Contract_Header(
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_contract_rec IN Contract_rec_type,
x_Contract_rec OUT NOCOPY Contract_rec_type);

Before calling the procedure, you will need to populate the p_contract_rec record. After the
procedure call, x_Contract_rec will return the details of the created contract header.

Parameter Description:

Data
Parameter Name Type Reqd? Description
ID NUMBER N Unique Contract Id
VARCHAR
contract_number 2 N ContractNumber
VARCHAR
contract_number_modifier 2 N ContractNumber Modifier
VARCHAR
currency_code 2 Y Contract Currency
Identifier of the Operating Unit to which the
authoring_org_id NUMBER Y contract belongs
inv_organization_id NUMBER Y Inventory Org Id
VARCHAR
scs_code 2 Y Contract Category Code
VARCHAR
sts_code 2 Y Status of contract
VARCHAR
renewal_status 2 Y Negotiation Status
start_date DATE Y Start Date of the contract

Service Contracts Public APIs


end_date DATE Y End Date of the contract
VARCHAR
short_description 2 Y Short Description
VARCHAR Indicates if this contract is a Template. Valid
template_yn 2 N values are Y and N.
VARCHAR
template_used 2 N Stores the name of the template if used.
Identify the billing address of the customer
account. References
HZ_CUST_ACCT_SITES_ALL.SITE_USE_ID where
bill_to_site_use_id NUMBER Y SITE_USE_CODE='BILL_TO'.
Identify the shipping address of the customer
account. References
HZ_CUST_ACCT_SITES_ALL.SITE_USE_ID where
ship_to_site_use_id NUMBER N SITE_USE_CODE='SHIP_TO'.
Pricing/Billing Attributes
pricing_agreement_id NUMBER N Pricing Agreement Id
Identifier of the Price List used for pricing this
Contract. Quickcodes : LIST_HEADER_ID from
price_list_id NUMBER Y QP_LIST_HEADERS_B
Stores Payment terms identifier. Identifies the
payment terms for the invoice. References
payment_term_id NUMBER Y AP_TERMS_TL.TERM_ID.
VARCHAR
payment_instruction_type 2 N Payment Instruction Type
VARCHAR Indicates if a Purchase Order is required. Valid
cust_po_number_req_yn 2 N values "Y" and "N".
Customer's Purchase Order Number If
cust_po_number NUMBER N cust_po_number_req_yn is "Y"
Payment Method Valid values are 'CCR': 'Credit
Card''COM'. 'Commitment'References
VARCHAR FND_LOOKUPS, where LOOKUP_TYPE =
payment_type 2 N "OKS_PAYMENT_METHODS"
cc_no NUMBER N Credit Card Number
cc_expiry_date DATE N Credit Card Expiry Date
VARCHAR
cc_auth_code 2 N Credit Card Authorization Code
If Payment Type is Commitment number, then
commitment id is stored in this Column.
References
commitment_id NUMBER N RA_CUSTOMER_TRX_ALL.CUSTOMER_TRX_ID
Stores the transaction id for the credit card
transactions stored in iPayments schema.
References
IBY_FNDCPT_TX_EXTENSIONS.TRXN_EXTENSIO
trxn_extension_id NUMBER N N_ID

Service Contracts Public APIs


VARCHAR
conversion_type 2 N Contract currency conversion type
Rate for converting amount to functional
conversion_rate NUMBER N currency
conversion_rate_date DATE N Valid date for conversion rate
Revenue recognition rule identifier. References
acct_rule_id NUMBER Y RA_RULES.RULE_ID
Stores invoicing rule identifier. This column is
used to bill invoices in Advance or Arrears.
inv_rule_id NUMBER Y References RA_RULES.RULE_ID where TYPE='I'
VARCHAR Partial Period attribute represents type of
period_type 2 N period i.e. Fixed or Actual.
VARCHAR Partial Period attribute that defines how partial
period_start 2 N periods are calculated. 'Service' OR 'Calendar'
VARCHAR Partial Periods Computation - Price UOM used
price_uom 2 N for partial period computation
VARCHAR Indicates if Contract pre-payment required .
pre_pay_req_yn 2 N Valid values Y and N.
This is the PO Number, which will be used by
Service Request charges. IT is irrespective of
service_po_number NUMBER N whether SERVICE_PO_REQUIRED is 'Y' or 'N'
Valid values are 'Y' or 'N'. IF it is 'Y' then a PO
VARCHAR number is essential for creating a Service
service_po_required 2 N Request.
Stores the transaction type name for invoices
VARCHAR and credit memos. References
inv_trx_type 2 N RA_CUSTOMER_TRX_TYPES_ALL.NAME
VARCHAR
inv_print_profile 2 N Invoice Print Profile
Valid values are 'Y' and 'N'. 'Y' indicates
VARCHAR transactions must be interfaced to Accounts
ar_interface_yn 2 N Receivables
Valid values are 'Y' and 'N'. 'Y' indicates to hold
VARCHAR the credit till next billing cycle (Hold Credit
hold_billing 2 N functionality).
Valid values are 'Y' or 'N'.If this column is set to
'Y', billing transactions of contract lines are
interfaced to AR. 'N' indicates, billing
VARCHAR transactions of Contract sub lines are interfaced
summary_trx_yn 2 N to AR
Valid values are 'E': 'Equal Amount'/'T': 'Top
Level' /'P': 'Covered Level'.Reference
VARCHAR FND_LOOKUPS where lookup_type
billing_schedule_type 2 N ='OKS_BILLSCH_LEVEL'

Service Contracts Public APIs


This column stores the tax codes e.g. Exempt,
VARCHAR VAT etc. References
tax_classification_code 2 N zx_output_classifications_v.lookup_code
This column indicates the valid tax statuses e.g.
Standard, Exemp, Require etc. This references
VARCHAR FND_LOOKUPS.LOOKUP_CODE, where
tax_status 2 N LOOKUP_TYPE = 'ZX_EXEMPTION_CONTROL'
tax_exemption_id NUMBER N Tax Exemption ID
This column stores the exemption certificate
number and is populated when the tax
classification code = 'EXEMPT'. References
exempt_certificate_numbe ZX_EXEMPTIONS_V.EXEMPT_CERTIFICATE_NU
r NUMBER N MBER
This column stores the exemption reason and is
populated when the tax classification code =
VARCHAR 'EXEMPT'. References
exempt_reason_code 2 N ZX_EXEMPTIONS_V.EXEMPT_REASON_CODE
Renewal Attributes
This specifies how the contract will be renewed
e.g. Manual, Electronic or Evergreen .
VARCHAR References fnd_lookup-values.lookup_code
renewal_type_code 2 N where lookup_type = OKC_RENEWAL_TYPE.
VARCHAR
approval_type 2 N
Unique identifier for specifying the billing
profile which will be used at the time of
Contract Renewal. References
billing_profile_id NUMBER N OKS_BILLING_PROFILES_B.ID
VARCHAR Valid values are 'Y' and 'N'.If this flag is set to 'Y',
renewal_po_required 2 N renewal PO number is required
Customer Purchase order Number, used at the
time of Contract Renewal. In the renewed
contract, this value gets copied to
OKC_K_HEADERS_B.CUST_PO_NUMBER & to
renewal_po_number NUMBER N OKS_K_HEADERS_B.RENEWAL_PO_NUMBER
VARCHAR
renewal_pricing_type 2 N Holds the pricing methods at time of renewal.
Stores Price list id for renewal. This is required if
RENEWAL_PRICING_TYPE is 'LST'. References
renewal_price_list NUMBER N QP_LIST_HEADERS.LIST_HEADER_ID.
Stores percentage value by which a Contract
will be marked up or down, at the time of
renewalThis column is mandatory if
renewal_markup_percent NUMBER N RENEWAL_PRICING_TYPE is 'PCT'

Service Contracts Public APIs


Grace duration for entitlements that will be set
for the renewed contract, when the current
contract is renewed. This value is valid only for
Service, Warranty and Extended Warranty
renewal_grace_duration NUMBER N contract lines.
Time Period for RENEWAL_GRACE_DURATION.
VARCHAR References
renewal_grace_period 2 N MTL_UNITS_OF_MEASURE_TL.UOM_CODE)
Value defined in this column gets copied to
column EST_REV_PERCENT, in the renewed
renewal_est_rev_percent NUMBER N contract
Value defined in this column becomes the
Estimated Revenue duration, in the renewed
renewal_est_rev_duration NUMBER N contract
Value defined in this column becomes the
VARCHAR Estimated Revenue period, in the renewed
renewal_est_rev_period 2 N contract
The end date till which the contract can be
renewal_end_date DATE N renewed as Evergreen
Holds customer account contact id to which the
Quote letter will be sent, at the time of renewal.
References
quote_to_contact_id NUMBER N HZ_CUST_ACCOUNTS.CUST_ACCOUNT_ROLE_ID
This column is used to store the Site id
associated with Customer Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID..
References
quote_to_site_id NUMBER N HZ_CUST_ACCOUNTS.CUST_ACCT_SITE_ID
This column is used to store the email address
associated with Customer Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID.
References
HZ_CONTACT_POINTS.CONTACT_POINT_ID
where
HZ_CONTACT_POINTS.CONTACT_POINT_TYPE =
quote_to_email_id NUMBER N 'EMAIL'
This column is used to store phone number of
the contact point. Associated with Customer
Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID.
References
HZ_CONTACT_POINTS.CONTACT_POINT_ID
Where
HZ_CONTACT_POINTS.CONTACT_POINT_ID =
quote_to_phone_id NUMBER N 'PHONE'

Service Contracts Public APIs


This column is used to store phone number of
the contact point. Associated with Customer
Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID.
References
HZ_CONTACT_POINTS.CONTACT_POINT_ID
Where
HZ_CONTACT_POINTS.CONTACT_POINT_ID =
quote_to_fax_id NUMBER N 'FAX'
This is the party id of the person who is marked
as the quote to contact for the contract.
person_party_id NUMBER N References HZ_PARTIES.PARTY_ID.
VARCHAR
cc_email_address 2 N email address to whom the quote can be sent
Workflow Attributes
date_approved DATE N Date contract was approved.
date_signed DATE N Date contract was signed.
date_renewed DATE N Date contract was renewed.
The length of time an expired contract can still
be eligible for Entitlement.This value is valid
only for Service, Warranty and Extended
grace_duration NUMBER N Warranty contract lines.
VARCHAR Time Period for GRACE_DURATION. References
grace_period 2 N MTL_UNITS_OF_MEASURE_TL.UOM_CODE
Estimated percentage value of a contract that a
est_rev_percent NUMBER N Salesrep expects/foresees, to close the deal
Date on which Estimated Revenue percentage
est_rev_date DATE N was entered
This column stores the action that the salesrep
needs to follow up with the customer or
internally e.g. Call Customer. References
VARCHAR FND_LOOKUP_VALUES.LOOKUP_CODE where
follow_up_action 2 N LOOKUP_TYPE='OKS_FOLLOWUP_ACTION'
The date by which the salesrep needs to follow
follow_up_date DATE N up.
The date on which the customer accepted the
date_accepted DATE N contract
The person who accepted the contract i.e. the
customer for on-line acceptance or any vendor
side user accepting on behalf of the customer
accepted_by NUMBER N by submitting for approval.
VARCHAR
upg_orig_system_ref 2 N Identifies original source of data
upg_orig_system_ref_id NUMBER N Unique Id from original system
VARCHAR
orig_system_source_code 2 N Identifier of the source system

Service Contracts Public APIs


orig_system_id1 NUMBER N Unique identifier in the source system
VARCHAR
orig_system_reference1 2 N Unique identifier in the source system
VARCHAR
renewal_comment 2 N Renewal Comment
qcl_id NUMBER Y ID of QA check list applicable to this contract.
ID of the process definition associated with this
pdf_id NUMBER Y Workflow Approval process..
VARCHAR
comments 2 N Comments about the contract
VARCHAR
description 2 N User entered free format text description.
VARCHAR
attribute_category 2 N Descriptive flexfield category column.
VARCHAR
attribute1 2 N Descriptive flexfield column.
VARCHAR
attribute2 2 N Descriptive flexfield column.
VARCHAR
attribute3 2 N Descriptive flexfield column.
VARCHAR
attribute4 2 N Descriptive flexfield column.
VARCHAR
attribute5 2 N Descriptive flexfield column.
VARCHAR
attribute6 2 N Descriptive flexfield column.
VARCHAR
attribute7 2 N Descriptive flexfield column.
VARCHAR
attribute8 2 N Descriptive flexfield column.
VARCHAR
attribute9 2 N Descriptive flexfield column.
VARCHAR
attribute10 2 N Descriptive flexfield column.
VARCHAR
attribute11 2 N Descriptive flexfield column.
VARCHAR
attribute12 2 N Descriptive flexfield column.
VARCHAR
attribute13 2 N Descriptive flexfield column.
VARCHAR
attribute14 2 N Descriptive flexfield column.
VARCHAR
attribute15 2 N Descriptive flexfield column.
General Attributes
created_by NUMBER N Standard Who column.

Service Contracts Public APIs


creation_date DATE N Standard Who column.
last_updated_by NUMBER N Standard Who column.
last_update_date DATE N Standard Who column.
last_update_login NUMBER N Standard Who column.

2.1.3 Sample Test Data

declare
l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_contract_rec oks_import_header_pub.Contract_rec_type;
x_Contract_rec oks_import_header_pub.Contract_rec_type;
l_party_role_tbl oks_import_header_pub.chr_party_roles_tbl;
x_party_role_tbl oks_import_header_pub.chr_party_roles_tbl;
l_ctc_in_tbl oks_import_header_pub.ctc_in_tbl ;
x_ctc_tbl oks_import_header_pub.ctcv_tbl_type;
l_oks_grpings oks_import_header_pub.oks_grpings_tbl_type;
x_oks_grpings oks_import_header_pub.oks_grpings_tbl_type;
l_srv_quota oks_import_header_pub.scrv_quota_tbl_type;
x_srv_quota oks_import_header_pub.scrv_quota_tbl_type ;

begin

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(204,204);

-- l_contract_rec.ID
l_contract_rec.contract_number :='test_qa_demo_5';
-- l_contract_rec.contract_number_modifier
l_contract_rec.currency_code :='USD' ;
l_contract_rec.authoring_org_id :=204;
l_contract_rec.INV_ORGANIZATION_ID :=204 ;
l_contract_rec.scs_code := 'SERVICE' ;
l_contract_rec.sts_code := 'ENTERED' ;
-- l_contract_rec.renewal_status
l_contract_rec.start_date :='01-JAN-2014' ;
l_contract_rec.end_date :='31-DEC-2014';
l_contract_rec.short_description := 'create CONTRACT qa demo' ;
-- l_contract_rec.cognomen
l_contract_rec.template_yn :='N';
-- l_contract_rec.template_used
l_contract_rec.bill_to_site_use_id := 3729;
l_contract_rec.ship_to_site_use_id := 3730;
-- l_contract_rec.pricing_agreement_id
l_contract_rec.price_list_id :=1000;
l_contract_rec.payment_term_id :=5;
-- l_contract_rec.payment_instruction_type

Service Contracts Public APIs


-- l_contract_rec.cust_po_number_req_yn
-- l_contract_rec.cust_po_number
-- l_contract_rec.payment_type OKS_K_HEADERS_
-- l_contract_rec.cc_no OKS_K_HEADERS_V.CC_NO
-- l_contract_rec.cc_expiry_date OKS_K_HEADER
-- l_contract_rec.cc_auth_code OKS_K_HEADERS_
-- l_contract_rec.commitment_id NUMBER := OKC
-- l_contract_rec.trxn_extension_id NUMBER :=
-- l_contract_rec.conversion_type
-- l_contract_rec.conversion_rate
-- l_contract_rec.conversion_rate_date
l_contract_rec.acct_rule_id := 1;
l_contract_rec.inv_rule_id := -2;
l_contract_rec.period_type :=NULL;
l_contract_rec.period_start :=NULL;
l_contract_rec.price_uom := NULL;
-- l_contract_rec.pre_pay_req_yn
-- l_contract_rec.service_po_number OKS_K_HEA
-- l_contract_rec.service_po_required OKS_K_H
-- l_contract_rec.inv_trx_type OKS_K_HEADERS_
-- l_contract_rec.inv_print_profile OKS_K_HEA
l_contract_rec.ar_interface_yn := 'Y';
-- l_contract_rec.hold_billing OKS_K_HEADERS_
-- l_contract_rec.summary_trx_yn OKS_K_HEADER
-- l_contract_rec.billing_schedule_type OKS_K
-- l_contract_rec.tax_status OKS_K_HEADERS_V.
-- l_contract_rec.tax_exemption_id NUMBER :=
-- l_contract_rec.exempt_certificate_number O
-- l_contract_rec.exempt_reason_code OKS_K_HE
-- l_contract_rec.renewal_type_code := 'DNR';
-- l_contract_rec.renewal_notify_to
-- l_contract_rec.approval_type :='Y';
-- l_contract_rec.billing_profile_id NUMBER :
-- l_contract_rec.renewal_po_required OKS_K_H
-- l_contract_rec.renewal_po_number OKS_K_HEA
-- l_contract_rec.renewal_pricing_type VARCh
-- l_contract_rec.renewal_price_list NUMBER :
-- l_contract_rec.renewal_markup_percent NUMB
-- l_contract_rec.renewal_grace_duration NUMB
-- l_contract_rec.renewal_grace_period OKS_K_
-- l_contract_rec.renewal_est_rev_percent NUM
-- l_contract_rec.renewal_est_rev_duration NU
-- l_contract_rec.renewal_est_rev_period OKS_
-- l_contract_rec.renewal_end_date date :=
-- l_contract_rec.quote_to_contact_id NUMBER
-- l_contract_rec.quote_to_site_id NUMBER :=
-- l_contract_rec.quote_to_email_id NUMBER :=
-- l_contract_rec.quote_to_phone_id NUMBER :=
-- l_contract_rec.quote_to_fax_id NUMBER := O
-- l_contract_rec.person_party_id NUMBER := O
-- l_contract_rec.cc_email_address OKS_K_HEAD
-- l_contract_rec.date_approved
-- l_contract_rec.date_signed
-- l_contract_rec.date_renewed
-- l_contract_rec.grace_duration NUMBER := OK
-- l_contract_rec.grace_period OKS_K_HEADERS_

Service Contracts Public APIs


-- l_contract_rec.est_rev_percent NUMBER := O
-- l_contract_rec.est_rev_date OKS_K_HEADERS_
-- l_contract_rec.follow_up_action OKS_K_HEAD
-- l_contract_rec.follow_up_date OKS_K_HEADER
-- l_contract_rec.date_accepted OKS_K_HEADERS
-- l_contract_rec.accepted_by NUMBER := OKC_A
-- l_contract_rec.upg_orig_system_ref
-- l_contract_rec.upg_orig_system_ref_id
-- l_contract_rec.orig_system_source_code
-- l_contract_rec.orig_system_id1
-- l_contract_rec.orig_system_reference1
-- l_contract_rec.electronic_renewal_flag OKS
-- l_contract_rec.security_group_id NUMBER :=
-- l_contract_rec.tax_classification_code OKS
-- l_contract_rec.renewal_comment OKS_K_HEADE
l_contract_rec.qcl_id :=1;

l_contract_rec.pdf_id :=3;
-- l_contract_rec.IN_PROCESS_YN
-- l_contract_rec.comments
l_contract_rec.description :='Test create contract wrapper api' ;
/* l_contract_rec.attribute_category
l_contract_rec.attribute1
l_contract_rec.attribute2
l_contract_rec.attribute3
l_contract_rec.attribute4
l_contract_rec.attribute5
l_contract_rec.attribute6
l_contract_rec.attribute7
l_contract_rec.attribute8
l_contract_rec.attribute9
l_contract_rec.attribute10
l_contract_rec.attribute11
l_contract_rec.attribute12
l_contract_rec.attribute13
l_contract_rec.attribute14
l_contract_rec.attribute15
l_contract_rec.created_by
l_contract_rec.creation_date
l_contract_rec.last_updated_by
l_contract_rec.last_update_date
l_contract_rec.last_update_login
*/

l_party_role_tbl (1).role_code:= 'CUSTOMER' ;


l_party_role_tbl (1).object1_id1:= 4429;

l_ctc_in_tbl(1).CRO_CODE := 'SALESPERSON';
l_ctc_in_tbl(1).OBJECT1_ID1 :=1001;
l_ctc_in_tbl(1).PARTY_ID :=204;
l_ctc_in_tbl(1).start_date := '01-JAN-2013' ;
l_ctc_in_tbl(1).END_date := '31-DEC-2013';

l_oks_grpings(1).cgp_parent_id:=2 ;

l_srv_quota (1).percent :=100;

Service Contracts Public APIs


l_srv_quota (1).ctc_id :=100000024;
l_srv_quota (1).sales_credit_type_id1:=1;

oks_import_header_pub.create_contract_header_wrapper
(
p_api_version => 1.0,
p_init_msg_list => OKC_API.G_TRUE,
x_return_status=>l_return_status,
x_msg_count=>l_msg_count ,
x_msg_data=>l_msg_data ,
p_contract_rec=>l_contract_rec,
x_Contract_rec =>x_Contract_rec,
p_party_role_tbl =>l_party_role_tbl ,
x_party_role_tbl =>x_party_role_tbl ,
p_ctc_in_tbl =>l_ctc_in_tbl ,
x_ctc_tbl =>x_ctc_tbl ,
p_oks_grpings=>l_oks_grpings ,
x_oks_grpings =>x_oks_grpings ,
p_srv_quota => l_srv_quota,
x_srv_quota =>x_srv_quota
);

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line('Contract is created successfully '||x_Contract_rec.contract_number );
COMMIT;
END IF;

Dbms_Output.put_line(l_return_status);
Dbms_Output.put_line(l_msg_count);
Dbms_Output.put_line(l_msg_data);

FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;
END;

2.2 Update Contract Header :

2.2.1 Description
The Update contract header API is used for updating contract header
information. It mainly updates the data of okc_k_headers_all_b/tl,
oks_k_headers_b/tl tables.

Service Contracts Public APIs


2.2.2 API Signature and Parameter Description

OKS_IMPORT_HEADER_PUB.Update_Contract_Header(
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_contract_rec IN Update_rec_type,
x_Contract_rec OUT NOCOPY Update_rec_type);

Parameter Description:

Data
Parameter Name Type Reqd? Description
Header Summary
Attributes
ID NUMBER Y Unique Contract Id
VARCHAR
contract_number 2 N ContractNumber
VARCHAR
contract_number_modifier 2 N ContractNumber Modifier
VARCHAR
currency_code 2 N Contract Currency
start_date DATE N Start Date of the contract
end_date DATE N End Date of the contract
VARCHAR
short_description 2 N Short Description
Identify the billing address of the customer
account. References
HZ_CUST_ACCT_SITES_ALL.SITE_USE_ID where
bill_to_site_use_id NUMBER N SITE_USE_CODE='BILL_TO'.
Identify the shipping address of the customer
account. References
HZ_CUST_ACCT_SITES_ALL.SITE_USE_ID where
ship_to_site_use_id NUMBER N SITE_USE_CODE='SHIP_TO'.
Pricing/Billing Attributes
pricing_agreement_id NUMBER N Pricing Agreement Id
Identifier of the Price List used for pricing this
Contract. Quickcodes : LIST_HEADER_ID from
price_list_id NUMBER N QP_LIST_HEADERS_B
Flag which decides whether reprice has to
happen when price list/currency is changed.
Holds 'R' -Reprice and 'C' -Cascade and Reprice.
When currency is changed,please pass it as "R"
VARCHAR as it is mandatory to reprice when currency is
pricing_flag 2 N changed.

Service Contracts Public APIs


Stores Payment terms identifier. Identifies the
payment terms for the invoice. References
payment_term_id NUMBER N AP_TERMS_TL.TERM_ID.
VARCHAR
payment_instruction_type 2 N Payment Instruction Type
VARCHAR Indicates if a Purchase Order is required. Valid
cust_po_number_req_yn 2 N values "Y" and "N".
Customer's Purchase Order Number If
cust_po_number NUMBER N cust_po_number_req_yn is "Y"
Payment Method Valid values are 'CCR': 'Credit
Card''COM'. 'Commitment'References
VARCHAR FND_LOOKUPS, where LOOKUP_TYPE =
payment_type 2 N "OKS_PAYMENT_METHODS"
cc_no NUMBER N Credit Card Number
cc_expiry_date DATE N Credit Card Expiry Date
VARCHAR
cc_auth_code 2 N Credit Card Authorization Code
If Payment Type is Commitment number, then
commitment id is stored in this Column.
References
commitment_id NUMBER N RA_CUSTOMER_TRX_ALL.CUSTOMER_TRX_ID
Stores the transaction id for the credit card
transactions stored in iPayments schema.
References
IBY_FNDCPT_TX_EXTENSIONS.TRXN_EXTENSIO
trxn_extension_id NUMBER N N_ID
VARCHAR
conversion_type 2 N Contract currency conversion type
Rate for converting amount to functional
conversion_rate NUMBER N currency
conversion_rate_date DATE N Valid date for conversion rate
Revenue recognition rule identifier. References
acct_rule_id NUMBER N RA_RULES.RULE_ID
Stores invoicing rule identifier. This column is
used to bill invoices in Advance or Arrears.
inv_rule_id NUMBER N References RA_RULES.RULE_ID where TYPE='I'
VARCHAR Indicates if Contract pre-payment required .
pre_pay_req_yn 2 N Valid values Y and N.
This is the PO Number, which will be used by
Service Request charges. IT is irrespective of
service_po_number NUMBER N whether SERVICE_PO_REQUIRED is 'Y' or 'N'
Valid values are 'Y' or 'N'. IF it is 'Y' then a PO
VARCHAR number is essential for creating a Service
service_po_required 2 N Request.
Stores the transaction type name for invoices
VARCHAR and credit memos. References
inv_trx_type 2 N RA_CUSTOMER_TRX_TYPES_ALL.NAME

Service Contracts Public APIs


VARCHAR
inv_print_profile 2 N Invoice Print Profile
Valid values are 'Y' and 'N'. 'Y' indicates
VARCHAR transactions must be interfaced to Accounts
ar_interface_yn 2 N Receivables
Valid values are 'Y' and 'N'. 'Y' indicates to hold
VARCHAR the credit till next billing cycle (Hold Credit
hold_billing 2 N functionality).
Valid values are 'Y' or 'N'.If this column is set to
'Y', billing transactions of contract lines are
interfaced to AR. 'N' indicates, billing
VARCHAR transactions of Contract sub lines are interfaced
summary_trx_yn 2 N to AR
Valid values are 'E': 'Equal Amount'/'T': 'Top
Level' /'P': 'Covered Level'. Reference
VARCHAR FND_LOOKUPS where lookup_type
billing_schedule_type 2 N ='OKS_BILLSCH_LEVEL'
This column indicates the valid tax statuses e.g.
Standard, Exemp, Require etc. This references
VARCHAR FND_LOOKUPS.LOOKUP_CODE, where
tax_status 2 N LOOKUP_TYPE = 'ZX_EXEMPTION_CONTROL'
tax_exemption_id NUMBER N Tax Exemption ID
This column stores the exemption certificate
number and is populated when the tax
classification code = 'EXEMPT'. References
exempt_certificate_numbe ZX_EXEMPTIONS_V.EXEMPT_CERTIFICATE_NU
r NUMBER N MBER
This column stores the exemption reason and is
populated when the tax classification code =
VARCHAR 'EXEMPT'. References
exempt_reason_code 2 N ZX_EXEMPTIONS_V.EXEMPT_REASON_CODE
Renewals Attributes
This specifies how the contract will be renewed
e.g. Manual, Electronic or Evergreen.
VARCHAR References fnd_lookup-values.lookup_code
renewal_type_code 2 N where lookup_type = OKC_RENEWAL_TYPE.
VARCHAR
approval_type 2 N
Unique identifier for specifying the billing
profile which will be used at the time of
Contract Renewal. References
billing_profile_id NUMBER N OKS_BILLING_PROFILES_B.ID
VARCHAR Valid values are 'Y' and 'N'.If this flag is set to 'Y',
renewal_po_required 2 N renewal PO number is required
Customer Purchase order Number, used at the
time of Contract Renewal. In the renewed
renewal_po_number NUMBER N contract, this value gets copied to

Service Contracts Public APIs


OKC_K_HEADERS_B.CUST_PO_NUMBER & to
OKS_K_HEADERS_B.RENEWAL_PO_NUMBER
VARCHAR
renewal_pricing_type 2 N Holds the pricing methods at time of renewal.
Stores Price list id for renewal. This is required if
RENEWAL_PRICING_TYPE is 'LST'. References
renewal_price_list NUMBER N QP_LIST_HEADERS.LIST_HEADER_ID.
Stores percentage value by which a Contract
will be marked up or down, at the time of
renewal. This column is mandatory if
renewal_markup_percent NUMBER N RENEWAL_PRICING_TYPE is 'PCT'
Grace duration for entitlements that will be set
for the renewed contract, when the current
contract is renewed. This value is valid only for
Service, Warranty and Extended Warranty
renewal_grace_duration NUMBER N contract lines.
Time Period for RENEWAL_GRACE_DURATION.
VARCHAR References
renewal_grace_period 2 N MTL_UNITS_OF_MEASURE_TL.UOM_CODE)
Value defined in this column gets copied to
column EST_REV_PERCENT, in the renewed
renewal_est_rev_percent NUMBER N contract
Value defined in this column becomes the
Estimated Revenue duration, in the renewed
renewal_est_rev_duration NUMBER N contract
Value defined in this column becomes the
VARCHAR Estimated Revenue period, in the renewed
renewal_est_rev_period 2 N contract
The end date till which the contract can be
renewal_end_date DATE N renewed as Evergreen
Holds customer account contact id to which the
Quote letter will be sent, at the time of renewal.
References
quote_to_contact_id NUMBER N HZ_CUST_ACCOUNTS.CUST_ACCOUNT_ROLE_ID
This column is used to store the Site id
associated with Customer Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID..
References
quote_to_site_id NUMBER N HZ_CUST_ACCOUNTS.CUST_ACCT_SITE_ID
This column is used to store the email address
associated with Customer Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID.
References
HZ_CONTACT_POINTS.CONTACT_POINT_ID
where
HZ_CONTACT_POINTS.CONTACT_POINT_TYPE =
quote_to_email_id NUMBER N 'EMAIL'

Service Contracts Public APIs


This column is used to store phone number of
the contact point. Associated with Customer
Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID.
References
HZ_CONTACT_POINTS.CONTACT_POINT_ID
Where
HZ_CONTACT_POINTS.CONTACT_POINT_ID =
quote_to_phone_id NUMBER N 'PHONE'
This column is used to store phone number of
the contact point. Associated with Customer
Account ID stored in
OKS_K_HEADERS_B.QUOTE_TO_CONTACT_ID.
References
HZ_CONTACT_POINTS.CONTACT_POINT_ID
Where
HZ_CONTACT_POINTS.CONTACT_POINT_ID =
quote_to_fax_id NUMBER N 'FAX'
This is the party id of the person who is marked
as the quote to contact for the contract.
person_party_id NUMBER N References HZ_PARTIES.PARTY_ID.
VARCHAR
cc_email_address 2 N email address to whom the quote can be sent
Workflow Attributes
The length of time an expired contract can still
be eligible for Entitlement. This value is valid
only for Service, Warranty and Extended
grace_duration NUMBER N Warranty contract lines.
VARCHAR Time Period for GRACE_DURATION. References
grace_period 2 N MTL_UNITS_OF_MEASURE_TL.UOM_CODE
Estimated percentage value of a contract that a
est_rev_percent NUMBER N Salesrep expects/foresees, to close the deal
Date on which Estimated Revenue percentage
est_rev_date DATE N was entered
This column stores the action that the salesrep
needs to follow up with the customer or
internally e.g. Call Customer. References
VARCHAR FND_LOOKUP_VALUES.LOOKUP_CODE where
follow_up_action 2 N LOOKUP_TYPE='OKS_FOLLOWUP_ACTION'
The date by which the salesrep needs to follow
follow_up_date DATE N up.
VARCHAR
renewal_comment 2 N Renewal Comment
VARCHAR
comments 2 N Comments about the contract
VARCHAR
description 2 N User entered free format text description.

Service Contracts Public APIs


VARCHAR
attribute_category 2 N Descriptive flexfield category column.
VARCHAR
attribute1 2 N Descriptive flexfield column.
VARCHAR
attribute2 2 N Descriptive flexfield column.
VARCHAR
attribute3 2 N Descriptive flexfield column.
VARCHAR
attribute4 2 N Descriptive flexfield column.
VARCHAR
attribute5 2 N Descriptive flexfield column.
VARCHAR
attribute6 2 N Descriptive flexfield column.
VARCHAR
attribute7 2 N Descriptive flexfield column.
VARCHAR
attribute8 2 N Descriptive flexfield column.
VARCHAR
attribute9 2 N Descriptive flexfield column.
VARCHAR
attribute10 2 N Descriptive flexfield column.
VARCHAR
attribute11 2 N Descriptive flexfield column.
VARCHAR
attribute12 2 N Descriptive flexfield column.
VARCHAR
attribute13 2 N Descriptive flexfield column.
VARCHAR
attribute14 2 N Descriptive flexfield column.
VARCHAR
attribute15 2 N Descriptive flexfield column.
last_updated_by NUMBER N Standard Who column.
last_update_date DATE N Standard Who column.
last_update_login NUMBER N Standard Who column.
ID of QA check list applicable to this contract.
Can be updated for only ENTERED Status
qcl_id NUMBER N Contracts
ID of the process definition associated with this
Workflow Approval process. Can be updated
pdf_id NUMBER N for only ENTERED Status Contracts

2.2.3 Sample Test Data

declare

Service Contracts Public APIs


l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_contract_rec oks_import_header_pub.Update_rec_type;
x_Contract_rec oks_import_header_pub.Update_rec_type;
l_msg_index_out NUMBER;

BEGIN

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(204,204);

/*update contract header */


l_contract_rec.ID := 202111 ;
--l_contract_rec.contract_number
--l_contract_rec.contract_number_modifier
l_contract_rec.currency_code :='EUR';
--l_contract_rec.start_date
--l_contract_rec.end_date
l_contract_rec.short_description :='Test Update contract Header' ;
--l_contract_rec.cognomen
--l_contract_rec.bill_to_site_use_id
--l_contract_rec.ship_to_site_use_id
--l_contract_rec.pricing_agreement_id
--l_contract_rec.price_list_id
l_contract_rec.pricing_flag := 'R';
--l_contract_rec.payment_term_id
--l_contract_rec.payment_instruction_type
--l_contract_rec.cust_po_number_req_yn
--l_contract_rec.cust_po_number
--l_contract_rec.payment_type
--l_contract_rec.cc_no OKS_K_HEADERS_V.
--l_contract_rec.cc_expiry_date OKS_K_H
--l_contract_rec.cc_auth_code OKS_K_HEA
--l_contract_rec.commitment_id NUMBER :
--l_contract_rec.trxn_extension_id NUMB
l_contract_rec.conversion_type := 'User';
l_contract_rec.conversion_rate :=1;
l_contract_rec.conversion_rate_date:='08-jan-2014';
--l_contract_rec.acct_rule_id NUMBER :=
--l_contract_rec.inv_rule_id
--l_contract_rec.pre_pay_req_yn
--l_contract_rec.service_po_number OKS_
--l_contract_rec.service_po_required OK
--l_contract_rec.inv_trx_type OKS_K_HEA
--l_contract_rec.inv_print_profile OKS_
--l_contract_rec.ar_interface_yn OKS_K_
--l_contract_rec.hold_billing OKS_K_HEA
--l_contract_rec.summary_trx_yn OKS_K_H

Service Contracts Public APIs


---l_contract_rec.billing_schedule_type
--l_contract_rec.tax_status OKS_K_HEADE
--l_contract_rec.tax_exemption_id NUMBE
--l_contract_rec.exempt_certificate_num
--l_contract_rec.exempt_reason_code OKS
--l_contract_rec.renewal_type_code
--l_contract_rec.renewal_notify_to
--l_contract_rec.approval_type
--l_contract_rec.billing_profile_id NUM
--l_contract_rec.renewal_po_required OK
/*l_contract_rec.renewal_po_number OKS_
l_contract_rec.renewal_pricing_type
l_contract_rec.renewal_price_list NUM
l_contract_rec.renewal_markup_percent
l_contract_rec.renewal_grace_duration
l_contract_rec.renewal_grace_period O
l_contract_rec.renewal_est_rev_percen
l_contract_rec.renewal_est_rev_durati
l_contract_rec.renewal_est_rev_period
l_contract_rec.renewal_end_date dat
l_contract_rec.quote_to_contact_id NU
l_contract_rec.quote_to_site_id NUMBE
l_contract_rec.quote_to_email_id NUMB
l_contract_rec.quote_to_phone_id NUMB
l_contract_rec.quote_to_fax_id NUMBER
l_contract_rec.person_party_id NUMBER
l_contract_rec.cc_email_address OKS_K
l_contract_rec.grace_duration NUMBER
l_contract_rec.grace_period OKS_K_HEA
l_contract_rec.est_rev_percent NUMBER
l_contract_rec.est_rev_date OKS_K_HEA
l_contract_rec.follow_up_action OKS_K
l_contract_rec.follow_up_date OKS_K_H
l_contract_rec.renewal_comment OKS_K_
l_contract_rec.comments */
l_contract_rec.description := 'Test update contract header API';
/*l_contract_rec.attribute_category
l_contract_rec.attribute1
l_contract_rec.attribute2
l_contract_rec.attribute3
l_contract_rec.attribute4
l_contract_rec.attribute5
l_contract_rec.attribute6
l_contract_rec.attribute7
l_contract_rec.attribute8
l_contract_rec.attribute9
l_contract_rec.attribute10
l_contract_rec.attribute11
l_contract_rec.attribute12
l_contract_rec.attribute13
l_contract_rec.attribute14
l_contract_rec.attribute15
l_contract_rec.created_by
l_contract_rec.creation_date
l_contract_rec.last_updated_by
l_contract_rec.last_update_date

Service Contracts Public APIs


l_contract_rec.last_update_login
l_contract_rec.pdf_id
l_contract_rec.qcl_id
*/

oks_import_header_pub.update_contract_header
(
p_api_version => 1.0,
p_init_msg_list => OKC_API.G_TRUE,
x_return_status=>l_return_status,
x_msg_count=>l_msg_count ,
x_msg_data=>l_msg_data ,
p_contract_rec=>l_contract_rec,
x_Contract_rec =>x_Contract_rec
);

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line('Contract Header is updated successfully '||x_Contract_rec.contract_number );
COMMIT;
END IF;

FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out
);
fnd_message.set_encoded (l_msg_data);
l_msg_data := fnd_message.get;
dbms_output.put_line(l_msg_data);
END LOOP;

END;

2.3 Create Template from a contract:

2.3.1 Description
The create template from contract API is used for creating a template contract from any
contract.

2.3.2 API Signature and Parameter Description

OKS_IMPORT_HEADER_PUB.Create_Template_from_contract(
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 DEFAULT
OKC_API.G_FALSE,

Service Contracts Public APIs


x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_source_contract_id IN NUMBER,
p_template_name IN VARCHAR2,
x_Contract_id OUT NOCOPY NUMBER);

Parameter Description:

Parameter Name Data Type Reqd? Description


p_source_contract_id NUMBER Y Contract Id
p_template_name Varchar2 Y Name of the template
x_Contract_id NUMBER Output parameter Contract Id of the template created.

2.3.3 Sample Test Data

DECLARE

l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_contract_id NUMBER;

BEGIN

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(204,204);

oks_import_header_pub.Create_Template_from_contract
(
p_api_version => 1.0,
p_init_msg_list => OKC_API.G_TRUE,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data ,
p_source_contract_id => 202111 ,
p_template_name => 'test_temp_qa_demo' ,
x_Contract_id => l_contract_id
) ;

Dbms_Output.put_line('l_return_status '||l_return_status);

Service Contracts Public APIs


IF l_return_status='S' THEN
Dbms_Output.put_line(' Template created from contract ' );
COMMIT;
END IF;

IF l_return_status<>'S' THEN

FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;

END IF;
END;

2.4 Create Contract from Template:

2.4.1 Description
The create contract from template API is used for creating a contract from a template.

2.4.2 API Signature and Parameter Description

OKS_IMPORT_HEADER_PUB.Create_Contract_from_Template(
p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 DEFAULT
OKC_API.G_FALSE,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
p_template_rec IN templ_rec_type,
x_Contract_id OUT NOCOPY NUMBER);

--input record to create contract form template


TYPE templ_rec_type IS RECORD (
template_name OKC_K_HEADERS_V.CONTRACT_NUMBER%TYPE :=
OKC_API.G_MISS_CHAR,
template_modifier OKC_K_HEADERS_V.CONTRACT_NUMBER_MODIFIER%TYPE :=
OKC_API.G_MISS_CHAR,
start_date OKC_K_HEADERS_V.START_DATE%TYPE :=
OKC_API.G_MISS_DATE,
end_date OKC_K_HEADERS_V.END_DATE%TYPE :=
OKC_API.G_MISS_DATE
);

Parameter Description:

Parameter Name Data Type Reqd? Description

Service Contracts Public APIs


template_name VARCHAR2 Y Template Name
template_modifier VARCHAR2 Y Template Modifier
Start_Date DATE Y Start Date of the Contract
End_Date DATE Y End Date of the contract
x_Contract_id NUMBER Output parameter Id of the contract created.

2.4.3 Sample Test Data

DECLARE

l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_contract_id NUMBER;
l_template_rec oks_import_header_pub.templ_rec_type;

BEGIN

begin
fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(204,204);
END;

l_template_rec.template_name := 'test_temp_qa_demo' ;
l_template_rec.template_modifier :=NULL;
l_template_rec.start_date := '01-jan-2015';
l_template_rec.end_date := '31-dec-2015';

oks_import_header_pub.Create_Contract_from_Template
(
p_api_version => 1.0,
p_init_msg_list => OKC_API.G_TRUE,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data ,
p_template_rec => l_template_rec ,
x_Contract_id => l_contract_id
) ;

Dbms_Output.put_line('l_contract_id '||l_contract_id);

IF l_return_status='S' THEN
Dbms_Output.put_line(' Template created from contract ' );
COMMIT;

Service Contracts Public APIs


END IF;

IF l_return_status<>'S' THEN

FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;

END IF;
END;

2.5 Create Contract Line:

2.5.1 Description
The create contract line is used for creating contract lines of type Service, Usage, Extended
Warranty and Subscription.

2.5.2 API Signature and Parameter Description

OKS_IMPORT_LINE_PUB.Create_Contract_Line
( p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 default OKC_API.G_TRUE,
p_line_tbl IN line_tbl_type,
x_line_tbl OUT NOCOPY line_tbl_type,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
);

Parameter Description:

Data
Parameter Name Type Reqd Description
contract_id Number Yes Contract Id
contract_line_id Number No (Derived in the API) Contract Line Id
contract_line_number Varchar2 No (Derived in the API) Contract Line Number

Service Contracts Public APIs


Line Tye Valid Values are
Line_Type Varchar2 Yes 'SERVICE','EXT_WARRANTY','USAGE','SUBSCRIP
lse_id Number No (Derived in the API) Lse Id
Inventory Item Id of
Service/Usage/Subscription/Extended Warranty
Inventory_Item_id Number Yes Item
Line_Ref Varchar2 No Line Reference
bill_to_site_use_id Number No Bill To Site Use Id
ship_to_site_use_id Number No ship to Site Use Id
cust_acct_id Number No Customer Account Id
sts_code Varchar2 No Line Status
start_date Date No Start Date
end_date Date No End Date
coverage_id Number No Coverage Id
price_list_id Number No Price List Id
from_day Number No From Day
to_day Number No To Day
inv_rule_id Number No Invoice rule Id
acct_rule_id Number No Accounting Rule Id
billing_schedule_type Varchar2 No Billing schdule Type
invoice_text Varchar2 No Invoice Text
averaging_interval Number No averaging interval
settlement_interval Varchar2 No settlement interval
usage_type Varchar2 No usage type
termn_method Varchar2 No termination method
usage_period Varchar2 No usage period
Subscription_Quantity Number No Subscription Quantity
Subscription_UOM Varchar2 No Subscription UOM
line_renewal_type_code Varchar2 No Line Renewal Type
price_uom Varchar2 No Price UOM
price_negotiated Number No Price negotiated
inv_print_flag Varchar2 No Print Flag
tax_status Varchar2 No Tax status
tax_classification_code Varchar2 No Tax Classification Code
exempt_certificate_number Varchar2 No Exempt Certificate Number
exempt_reason_code Varchar2 No Exempt Reason Code
payment_instruction_type Varchar2 No Payment Instruction type
payment_type Varchar2 No Payment Type
commitment_id Number No Commitment Id
Credit_Card_Number Varchar2 No Credit Card Number
Credit_Card_expiry_date Varchar2 No Credit Card Expiry Date

Service Contracts Public APIs


Credit_Card_seurity_code Varchar2 No Credit Card security code
cust_po_number_req_yn Varchar2 No Customer PO Number Required flag
cust_po_number Varchar2 No Customer PO Number Required flag
attribute_category Varchar2 No Descriptive flexfield category column.
attribute1 Varchar2 No Descriptive flexfield column.
attribute2 Varchar2 No Descriptive flexfield column.
attribute3 Varchar2 No Descriptive flexfield column.
attribute4 Varchar2 No Descriptive flexfield column.
attribute5 Varchar2 No Descriptive flexfield column.
attribute6 Varchar2 No Descriptive flexfield column.
attribute7 Varchar2 No Descriptive flexfield column.
attribute8 Varchar2 No Descriptive flexfield column.
attribute9 Varchar2 No Descriptive flexfield column.
attribute10 Varchar2 No Descriptive flexfield column.
attribute11 Varchar2 No Descriptive flexfield column.
attribute12 Varchar2 No Descriptive flexfield column.
attribute13 Varchar2 No Descriptive flexfield column.
attribute14 Varchar2 No Descriptive flexfield column.
attribute15 Varchar2 No Descriptive flexfield column.
processing_status Varchar2 No Processing status of the current record
status_msg Varchar2 No Error messages

2.5.3 Sample Test Data

SET SERVEROUTPUT ON;

DECLARE

l_return_status VARCHAR2(200);
l_msg_count NUMBER;
l_msg_data VARCHAR2(200);
l_msg_index_out NUMBER;
l_data VARCHAR2(2000);
lp_line_tbl OKS_IMPORT_LINE_PUB.line_tbl_type;
lx_line_tbl OKS_IMPORT_LINE_PUB.line_tbl_type;
l_ctc_tbl OKS_IMPORT_LINE_PUB.ctc_line_in_tbl;

Service Contracts Public APIs


i NUMBER :=1;

BEGIN
--set the org context
okc_context.set_okc_org_context(204,204);

FND_GLOBAL.apps_initialize(1000200,21708,515);

lp_line_tbl(1).contract_id := 202111;
lp_line_tbl(1).Line_Type := 'SERVICE';
lp_line_tbl(1).Inventory_Item_id := 474 ;
lp_line_tbl(1).invoice_text:= 'createline from api' ;

lp_line_tbl(2).contract_id := 202111;
lp_line_tbl(2).Line_Type := 'SERVICE';
lp_line_tbl(2).Inventory_Item_id := 474 ;

OKS_IMPORT_LINE_PUB.CREATE_CONTRACT_LINE
( p_api_version =>1.0,
p_init_msg_list =>OKC_API.G_FALSE,
x_return_status =>l_return_status,
x_msg_count =>l_msg_count,
x_msg_data =>l_msg_data,
p_line_tbl =>lp_line_tbl,
X_LINE_TBL => lx_line_tbl);

DBMS_OUTPUT.PUT_LINE ('After Calling


OKS_IMPORT_LINE_PUB.CREATE_CONTRACT_LINE');

dbms_output.put_line(l_msg_count);
dbms_output.put_line(l_return_status);

IF l_return_status<>'S' then
FOR i IN 1 .. fnd_msg_pub.count_msg

Service Contracts Public APIs


LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out
);
fnd_message.set_encoded (l_msg_data);
l_msg_data := fnd_message.get;
dbms_output.put_line(l_msg_data);
END LOOP;

END IF;
END;

2.6 Update Contract Line:

2.6.1 Description
The update contract line is used for updating contract lines of type Service, Usage, Extended
Warranty and Subscription.

2.6.2 API Signature and Parameter Description

OKS_IMPORT_LINE_PUB.Update_Contract_Line
( p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 default OKC_API.G_TRUE,
p_line_tbl IN line_tbl_type,
x_line_tbl OUT NOCOPY line_tbl_type,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
);

Parameter Description:

Data
Parameter Name Type Reqd Description
contract_id Number Yes Contract Id

Service Contracts Public APIs


contract_line_id Number Yes Contract Line Id
No (Derived in the
contract_line_number Varchar2 API) Contract Line Number

Line Type Valid Values are


Line_Type Varchar2 No 'SERVICE','EXT_WARRANTY','USAGE','SUBSCRIPTIO
No (Derived in the
lse_id Number API) Lse Id
Inventory Item Id of
Service/Usage/Subscription/Extended Warranty
Inventory_Item_id Number No Item
Line_Ref Varchar2 No Line Reference
bill_to_site_use_id Number No Bill To Site Use Id
ship_to_site_use_id Number No ship to Site Use Id
cust_acct_id Number No Customer Account Id
sts_code Varchar2 No Line Status
start_date Date No Start Date
end_date Date No End Date
coverage_id Number No Coverage Id
price_list_id Number No Price List Id
from_day Number No From Day
to_day Number No To Day
inv_rule_id Number No Invoice rule Id
acct_rule_id Number No Accounting Rule Id
billing_schedule_type Varchar2 No Billing schdule Type
invoice_text Varchar2 No Invoice Text
averaging_interval Number No averaging interval
settlement_interval Varchar2 No settlement interval
usage_type Varchar2 No usage type
termn_method Varchar2 No termnination method
usage_period Varchar2 No usage period
Subscription_Quantity Number No Subscription Quantity
Subscription_UOM Varchar2 No Subscription UOM
line_renewal_type_code Varchar2 No Line Renewal Type
price_uom Varchar2 No Price UOM
price_negotiated Number No Price negotiated
inv_print_flag Varchar2 No Print Flag
tax_status Varchar2 No Tax status
tax_classification_code Varchar2 No Tax Classification Code
exempt_certificate_number Varchar2 No Exempt Certificate Number
exempt_reason_code Varchar2 No Exempt Reason Code
payment_instruction_type Varchar2 No Payment Instruction type
payment_type Varchar2 No Payment Type

Service Contracts Public APIs


commitment_id Number No Commitment Id
Credit_Card_Number Varchar2 No Credit Card Number
Credit_Card_expiry_date Varchar2 No Credit Card Expiry Date
Credit_Card_seurity_code Varchar2 No Credit Card security code
trxn_extension_id Number No Credit card trxn_extension_id
cust_po_number_req_yn Varchar2 No Customer PO Number Required flag
cust_po_number Varchar2 No Customer PO Number Required flag
attribute_category Varchar2 No Descriptive flexfield category column.
attribute1 Varchar2 No Descriptive flexfield column.
attribute2 Varchar2 No Descriptive flexfield column.
attribute3 Varchar2 No Descriptive flexfield column.
attribute4 Varchar2 No Descriptive flexfield column.
attribute5 Varchar2 No Descriptive flexfield column.
attribute6 Varchar2 No Descriptive flexfield column.
attribute7 Varchar2 No Descriptive flexfield column.
attribute8 Varchar2 No Descriptive flexfield column.
attribute9 Varchar2 No Descriptive flexfield column.
attribute10 Varchar2 No Descriptive flexfield column.
attribute11 Varchar2 No Descriptive flexfield column.
attribute12 Varchar2 No Descriptive flexfield column.
attribute13 Varchar2 No Descriptive flexfield column.
attribute14 Varchar2 No Descriptive flexfield column.
attribute15 Varchar2 No Descriptive flexfield column.
processing_status Varchar2 No Processing status of the current record
status_msg Varchar2 No Error messages

2.6.3 Sample Test Data

SET SERVEROUTPUT ON;

DECLARE

l_return_status VARCHAR2(200);
l_msg_count NUMBER;
l_msg_data VARCHAR2(200);
l_msg_index_out NUMBER;
l_data VARCHAR2(2000);
lp_line_tbl OKS_IMPORT_LINE_PUB.line_tbl_type;

Service Contracts Public APIs


lx_line_tbl OKS_IMPORT_LINE_PUB.line_tbl_type;
l_ctc_tbl OKS_IMPORT_LINE_PUB.ctc_line_in_tbl;

i NUMBER :=1;

BEGIN
--set the org context
okc_context.set_okc_org_context(204,204);

FND_GLOBAL.apps_initialize(1000200,21708,515);

lp_line_tbl(1).contract_line_id :=
371685909989288577372718868168293172903;
lp_line_tbl(1).LINE_RENEWAL_TYPE_code := 'DNR';

OKS_IMPORT_LINE_PUB.update_CONTRACT_LINE
( p_api_version =>1.0,
p_init_msg_list =>OKC_API.G_true,
x_return_status =>l_return_status,
x_msg_count =>l_msg_count,
x_msg_data =>l_msg_data,
p_line_tbl =>lp_line_tbl,
X_LINE_TBL => lx_line_tbl);

DBMS_OUTPUT.PUT_LINE ('After Calling


OKS_IMPORT_LINE_PUB.CREATE_CONTRACT_LINE');

dbms_output.put_line(l_msg_count);
dbms_output.put_line(l_return_status);
dbms_output.put_line('Processing status'||lx_line_tbl(1).processing_status);
dbms_output.put_line('Message '||lx_line_tbl(1).status_msg);

--IF l_return_status<>'S' then

FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP

Service Contracts Public APIs


fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out
);
fnd_message.set_encoded (l_msg_data);
l_msg_data := fnd_message.get;
dbms_output.put_line(l_msg_data);
END LOOP;

END;

2.7 Generate Billing Schedules:

2.7.1 Description
The generate_bill_schedules API is used for generating the billing schedules.

2.7.2 API Signature and Parameter Description

OKS_IMPORT_LINE_PUB.generate_bill_schedules
( p_api_version IN NUMBER,
p_init_msg_list IN VARCHAR2 default OKC_API.G_FALSE,
p_id IN NUMBER ,
p_level IN VARCHAR2,
p_sll_tbl IN strem_level_tbl ,
x_return_status OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2
);

Parameter Description:

Data
Parameter Name Type Reqd? Description
p_id Number Y

Billing schedule type.Lookup code from


p_level Varchar2 Y lookup_type = 'OKS_BILLSCH_LEVEL'
p_sll_tbl

Service Contracts Public APIs


Chronological sequence of the billing stream
levels associated with a contract, line and
Seq_no Number Y sub line

Total number of billing periods defined for


no_of_periods Number the stream

Start date of the stream level. The value is


start date of the contract line or sub line for
the first record and end date of the previous
start_date Date Y stream plus 1 for subsequent records

End date of the stream level. The value is


validated using start date, uom, periods and
end_date Date Y UOM per period information

duration Number Y Stores the unit of measure frequency

Prorated amount in case of Equal Amounts


Amount Number Y billing schedule type

invoice_offset_days Number N Invoice offset days for Transaction Date

interface_offset_days Number N Interface offset days for interface to AR

Stores the unit of measure for the duration.


Referenced from
uom_code Varchar2 Y OKC_TIME_CODE_UNITS_B.UOM_CODE

2.7.3 Sample Test Data


DECLARE
l_sll_tbl oks_import_line_pub.strem_level_tbl;

l_return_status VARCHAR2(1);
l_msg_count NUMBER;
l_msg_data VARCHAR2(1000);
l_id NUMBER;
l_level VARCHAR2(1);

BEGIN

Service Contracts Public APIs


fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(204,204);

l_id:= 325615642872142512110346544268840703818;
l_level:= 'E';

l_sll_tbl(1).seq_no := 1;
l_sll_tbl(1).start_date := '01-JAN-2014';
l_sll_tbl(1).end_date := '31-DEC-2014';
l_sll_tbl(1).no_of_periods := 12;
l_sll_tbl(1).Duration := 1;
l_sll_tbl(1).uom_code := 'MTH';

oks_import_line_pub.generate_bill_schedules
(
p_api_version => 1.0,
p_init_msg_list => OKC_API.G_TRUE,
x_return_status => l_return_status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data ,
p_id => l_id ,
p_level => l_level ,
p_sll_tbl => l_sll_tbl
) ;

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line('Contract line billing schedules are created successfully ' );
--COMMIT;
END IF;

IF l_return_status<>'S' THEN

FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;

END IF;
END;

2.8 Create Subline:

2.8.1 Description
The create subline API is used for creating a subline/covered level under a service/usage or
extended warranty line.

Service Contracts Public APIs


2.8.2 API Signature and Parameter Description

OKS_IMPORT_SUBLINE_PUB.create_subline( p_api_version IN
NUMBER,
p_init_msg_list IN VARCHAR2 default OKC_API.G_TRUE,
p_subline_tbl IN OUT NOCOPY l_subline_inrec_tbl,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
);

Parameter Description:

Data
Parameter Name Type Reqd? Description
top_line_id NUMBER Y Unique Parent Contract Line Id
cov_level VARCHA
R2 Y
item_id NUMBER N Inventory Item Id
Customer_id NUMBER N Customer Id
System_id NUMBER N System Id
Party_id NUMBER N Party Id
Product_id NUMBER N Product Id
serial_number NUMBER N Serial Number
subline_status_CODE VARCHA
R2 N Status of new subline
subline_ref VARCHA
R2 N Negotiation Status
start_date DATE Y Start Date of the Subline
end_date DATE Y End Date of the Subline
invoice_text VARCHA
R2 N Invoice Text
Quantity NUMBER Y Quantity
uom VARCHA
R2 N Quantity UOM
price_uom VARCHA
R2

Y Price UOM
price_subtotal NUMBER Y Subtotal
renewal_type VARCHA
R2 N Renewal Type Code
instance_id NUMBER
N Instance Id
inv_print_flag VARCHA
R2
N Invoice Print Flag ‘Y’ or ‘N’.
attribute_category VARCHA N Descriptive Flexfield

Service Contracts Public APIs


R2
attribute1 VARCHA Descriptive Flexfield Segments
R2
N
attribute2 VARCHA Descriptive Flexfield Segments
R2

N
attribute3 VARCHA Descriptive Flexfield Segments
R2 N
attribute4 VARCHA Descriptive Flexfield Segments
R2 N
attribute5 VARCHA Descriptive Flexfield Segments
R2 N
attribute6 VARCHA Descriptive Flexfield Segments
R2

N
attribute7 VARCHA Descriptive Flexfield Segments
R2

N
attribute8 VARCHA Descriptive Flexfield Segments
R2 N
attribute9 VARCHA Descriptive Flexfield Segments
R2 N
attribute10 VARCHA Descriptive Flexfield Segments
R2 N
attribute11 VARCHA Descriptive Flexfield Segments
R2 Y
attribute12 VARCHA Descriptive Flexfield Segments
R2

Y
attribute13 VARCHA Descriptive Flexfield Segments
R2
N
attribute14 VARCHA Descriptive Flexfield Segments
R2
N
attribute15 VARCHA Descriptive Flexfield Segments
R2
N
Usage Items

usage_estimation_defa NUMBER
ult N Estimation Default
usage_min NUMBER

N Minimum Usage Value


usage_estimation_meth VARCHA
od R2
N Estimation Method
usage_estimation_start DATE
_date
N Estimation Start Date

Service Contracts Public APIs


usage_net_reading NUMBER N Net Reading
usage_level VARCHA
R2
N Usage Level
usage_fill VARCHA
R2
N Usage Fill value as ‘Y’ or ‘N’
usage_fixed NUMBER

N Usage Fixed Value


usage_subtotal NUMBER

N Subtotal for Usage lines.


usage_duration NUMBER
N Duration
usage_period VARCHA
R2

N Period
usage_break_uom NUMBER N Break Up UOM
usage_prorate NUMBER

N Prorate

2.8.1 Sample Test Data


SampleScript1:CreateService subline
DECLARE
l_api_version NUMBER;
l_init_msg_list VARCHAR2(20) := 'T';
SUBTYPE subline_tbl IS oks_import_subline_pub.l_subline_inrec_tbl;
l_subline_tbl subline_tbl;
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
l_msg_data VARCHAR2(2000);
x_return_status VARCHAR2(1);
l_number_of_records NUMBER;
i NUMBER := 1;

BEGIN

okc_context.set_okc_org_context(204,204);
l_api_version := 1.0;

Service Contracts Public APIs


l_number_of_records := 1;
l_subline_tbl.DELETE;

--i:=1;
LOOP

l_subline_tbl(i).top_line_id :=
373300712291761735194527620190905246688;
l_subline_tbl(i).cov_level := 'COVER_ITEM';
l_subline_tbl(i).item_id := '149';
--l_subline_tbl(i).party_id :=
--l_subline_tbl(i).product_id
--l_subline_tbl(i).site_id
--l_subline_tbl(i).system_id
--l_subline_tbl(i).customer_id
l_subline_tbl(i).subline_ref := 'Test';
l_subline_tbl(i).start_date := '10-JAN-2014';
l_subline_tbl(i).end_date := '04-NOV-2014';
l_subline_tbl(i).invoice_text := 'Text';
l_subline_tbl(i).qty := 1;
l_subline_tbl(i).uom := 'EA';
l_subline_tbl(i).price_uom := 'YR';
--l_subline_tbl(i).price_subtotal
l_subline_tbl(i).renewal_type := 'FUL';
--l_subline_tbl(i).instance_id :=
l_subline_tbl(i).inv_print_flag := 'Y';
l_subline_tbl(i).attribute_category := 'Test';
l_subline_tbl(i).attribute1 := 'Test1';
l_subline_tbl(i).attribute2 := 'Test2';
l_subline_tbl(i).attribute3 := 'Test3';
l_subline_tbl(i).attribute4 := 'Test4';
l_subline_tbl(i).attribute5 := 'Test5';
l_subline_tbl(i).attribute6 := 'Test6';
l_subline_tbl(i).attribute7 := 'Test7';
l_subline_tbl(i).attribute8 := 'Test8';

Service Contracts Public APIs


l_subline_tbl(i).attribute9 := 'Test9';
l_subline_tbl(i).attribute10 := 'Test10';
l_subline_tbl(i).attribute11 := 'Test11';
l_subline_tbl(i).attribute12 := 'Test12';
l_subline_tbl(i).attribute13 := 'Test13';
l_subline_tbl(i).attribute14 := 'Test14';
l_subline_tbl(i).attribute15 := 'Test15';
--usage--
/*l_subline_tbl(i).usage_estimation_default
l_subline_tbl(i).usage_min
l_subline_tbl(i).usage_estimation_method
l_subline_tbl(i).usage_estimation_start_date
l_subline_tbl(i).usage_net_reading
l_subline_tbl(i).usage_level
l_subline_tbl(i).usage_fill
l_subline_tbl(i).usage_fixed
l_subline_tbl(i).usage_subtotal
l_subline_tbl(i).usage_duration
l_subline_tbl(i).usage_period
l_subline_tbl(i).usage_break_uom
l_subline_tbl(i).usage_prorate*/

EXIT WHEN (i = 1);


i := i+1;
END LOOP;

oks_import_subline_pub.create_subline( p_api_version => l_api_version,


p_init_msg_list => l_init_msg_list,
p_subline_tbl => l_subline_tbl,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
x_return_status => x_return_status
);

IF l_subline_tbl.Count > 0 THEN


i := l_subline_tbl.FIRST;

Service Contracts Public APIs


LOOP
DBMS_OUTPUT.PUT_LINE('Top Line ID : '||l_subline_tbl(i).top_line_id);
DBMS_OUTPUT.PUT_LINE('Sub Line ID : '||l_subline_tbl(i).subline_id);
DBMS_OUTPUT.PUT_LINE('Status : '||l_subline_tbl(i).status);

EXIT WHEN (i = 1);


i := i+1;
END LOOP;
END IF;

COMMIT;
END;

--------------------------------------------------------------
SampleScript2: Create Usage subline
DECLARE
l_api_version NUMBER;
l_init_msg_list VARCHAR2(20) := 'T';
SUBTYPE subline_tbl IS oks_import_subline_pub.l_subline_inrec_tbl;
l_subline_tbl subline_tbl;
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
l_msg_data VARCHAR2(2000);
x_return_status VARCHAR2(1);
l_number_of_records NUMBER;
i NUMBER := 1;

BEGIN

okc_context.set_okc_org_context(204,204);
l_api_version := 1.0;
l_number_of_records := 1;
l_subline_tbl.DELETE;

Service Contracts Public APIs


--i:=1;
LOOP

l_subline_tbl(i).top_line_id :=
373300712291849986779359488120658797536;
l_subline_tbl(i).cov_level := 'INST_CTR';
l_subline_tbl(i).item_id := '6564';
--l_subline_tbl(i).party_id :=
--l_subline_tbl(i).product_id
--l_subline_tbl(i).site_id
--l_subline_tbl(i).system_id
--l_subline_tbl(i).customer_id
l_subline_tbl(i).subline_ref := 'Test';
l_subline_tbl(i).start_date := '10-JAN-2014';
l_subline_tbl(i).end_date := '04-NOV-2014';
l_subline_tbl(i).invoice_text := 'Text';
l_subline_tbl(i).qty := 1;
l_subline_tbl(i).uom := 'EA';
l_subline_tbl(i).price_uom := 'YR';
-- l_subline_tbl(i).price_subtotal := 100 ;
l_subline_tbl(i).renewal_type := 'FUL';
--l_subline_tbl(i).instance_id :=
l_subline_tbl(i).inv_print_flag := 'Y';
l_subline_tbl(i).attribute_category := 'Test';
l_subline_tbl(i).attribute1 := 'Test1';
l_subline_tbl(i).attribute2 := 'Test2';
l_subline_tbl(i).attribute3 := 'Test3';
l_subline_tbl(i).attribute4 := 'Test4';
l_subline_tbl(i).attribute5 := 'Test5';
l_subline_tbl(i).attribute6 := 'Test6';
l_subline_tbl(i).attribute7 := 'Test7';
l_subline_tbl(i).attribute8 := 'Test8';
l_subline_tbl(i).attribute9 := 'Test9';
l_subline_tbl(i).attribute10 := 'Test10';
l_subline_tbl(i).attribute11 := 'Test11';
l_subline_tbl(i).attribute12 := 'Test12';
l_subline_tbl(i).attribute13 := 'Test13';

Service Contracts Public APIs


l_subline_tbl(i).attribute14 := 'Test14';
l_subline_tbl(i).attribute15 := 'Test15';
--usage--
l_subline_tbl(i).usage_fixed := 10;
l_subline_tbl(i).usage_subtotal := 2;

EXIT WHEN (i = 1);


i := i+1;
END LOOP;

oks_import_subline_pub.create_subline( p_api_version => l_api_version,


p_init_msg_list => l_init_msg_list,
p_subline_tbl => l_subline_tbl,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
x_return_status => x_return_status
);

IF l_subline_tbl.Count > 0 THEN


i := l_subline_tbl.FIRST;
LOOP
DBMS_OUTPUT.PUT_LINE('Top Line ID : '||l_subline_tbl(i).top_line_id);
DBMS_OUTPUT.PUT_LINE('Sub Line ID : '||l_subline_tbl(i).subline_id);
DBMS_OUTPUT.PUT_LINE('Status : '||l_subline_tbl(i).status);

EXIT WHEN (i = 1);


i := i+1;
END LOOP;
END IF;

COMMIT;
END;

2.9 Update Subline:

2.9.1 Description
The update contract subline API is used for updating contract subline.

Service Contracts Public APIs


2.9.2 API Signature and Parameter Description

OKS_IMPORT_SUBLINE_PUB.update_subline( p_api_version IN
NUMBER,
p_init_msg_list IN VARCHAR2 default OKC_API.G_TRUE,
p_subline_tbl IN OUT NOCOPY l_subline_updrec_tbl,
x_msg_count OUT NOCOPY NUMBER,
x_msg_data OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
);

Parameter Description:

Re
qd
Parameter Name Data Type ? Description
Subline_id NUMBER Y Unique Subline Id to be updated
subline_ref VARCHAR
2 N Negotiation Status
start_date DATE N Start Date of the Subline
end_date DATE N End Date of the Subline
invoice_text VARCHAR N
2 Invoice Text
Quantity NUMBER N Quantity
uom VARCHAR N
2 Quantity UOM
price_uom VARCHAR N
2

Price UOM
price_subtotal NUMBER N Subtotal
renewal_type VARCHAR N
2 Renewal Type Code
inv_print_flag VARCHAR N
2
Invoice Print Flag ‘Y’ or ‘N’.
attribute_category VARCHAR N
2 Descriptive Flexfield
attribute1 VARCHAR N Descriptive Flexfield Segments
2
attribute2 VARCHAR N Descriptive Flexfield Segments
2

attribute3 VARCHAR N Descriptive Flexfield Segments


2

Service Contracts Public APIs


attribute4 VARCHAR N Descriptive Flexfield Segments
2
attribute5 VARCHAR N Descriptive Flexfield Segments
2
attribute6 VARCHAR N Descriptive Flexfield Segments
2

attribute7 VARCHAR N Descriptive Flexfield Segments


2

attribute8 VARCHAR N Descriptive Flexfield Segments


2
attribute9 VARCHAR N Descriptive Flexfield Segments
2
attribute10 VARCHAR N Descriptive Flexfield Segments
2
attribute11 VARCHAR N Descriptive Flexfield Segments
2
attribute12 VARCHAR N Descriptive Flexfield Segments
2

attribute13 VARCHAR N Descriptive Flexfield Segments


2
attribute14 VARCHAR N Descriptive Flexfield Segments
2
attribute15 VARCHAR N Descriptive Flexfield Segments
2
Usage Items N

usage_estimation_default NUMBER N Estimation Default


usage_min NUMBER N

Minimum Usage Value


usage_estimation_metho VARCHAR N
d 2
Estimation Method
usage_estimation_start_d DATE N
ate
Estimation Start Date
usage_net_reading NUMBER N Net Reading
usage_level VARCHAR N
2
Usage Level
usage_fill VARCHAR N
2
Usage Fill value as ‘Y’ or ‘N’
usage_fixed NUMBER N

Usage Fixed Value

Service Contracts Public APIs


usage_subtotal NUMBER N

Subtotal for Usage lines.


usage_duration NUMBER N
Duration
usage_period VARCHAR N
2

Period
usage_break_uom NUMBER N Break Up UOM
usage_prorate NUMBER N

Prorate

2.9.1 Sample Test Data


DECLARE
l_api_version NUMBER;
l_init_msg_list VARCHAR2(20);
SUBTYPE subline_updrec_tbl IS
oks_import_subline_pub.l_subline_updrec_tbl;
l_subline_updrec_tbl subline_updrec_tbl;
x_msg_count NUMBER;
x_msg_data VARCHAR2(2000);
l_msg_data VARCHAR2(2000);
x_return_status VARCHAR2(1);
l_number_of_records NUMBER;
i NUMBER := 1;

BEGIN

okc_context.set_okc_org_context(204,204);
l_api_version := 1;
l_number_of_records := 1;

i:=1;
LOOP

l_subline_updrec_tbl(i).subline_id:=37168596476783824608226582464130628
1685;
l_subline_updrec_tbl(i).qty:=20;

Service Contracts Public APIs


l_subline_updrec_tbl(i).uom:=null;
l_subline_updrec_tbl(i).unit_price:=null;
l_subline_updrec_tbl(i).price_uom:=null;
l_subline_updrec_tbl(i).price_subtotal:=null;
l_subline_updrec_tbl(i).renewal_type:=null;
l_subline_updrec_tbl(i).inv_print_flag:=null;
l_subline_updrec_tbl(i).attribute_category:=null;
l_subline_updrec_tbl(i).attribute1:=null;
l_subline_updrec_tbl(i).attribute2:=null;
l_subline_updrec_tbl(i).attribute3:=null;
l_subline_updrec_tbl(i).attribute4:=null;
l_subline_updrec_tbl(i).attribute5:=null;
l_subline_updrec_tbl(i).attribute6:=null;
l_subline_updrec_tbl(i).attribute7:=null;
l_subline_updrec_tbl(i).attribute8:=null;
l_subline_updrec_tbl(i).attribute9:=null;
l_subline_updrec_tbl(i).attribute10:=null;
l_subline_updrec_tbl(i).attribute11:=null;
l_subline_updrec_tbl(i).attribute12:=null;
l_subline_updrec_tbl(i).attribute13:=null;
l_subline_updrec_tbl(i).attribute14:=null;
l_subline_updrec_tbl(i).attribute15:=null;
l_subline_updrec_tbl(i).usage_estimation_default:=null;
l_subline_updrec_tbl(i).usage_min:=null;
l_subline_updrec_tbl(i).usage_estimation_method:=null;
l_subline_updrec_tbl(i).usage_estimation_start_date:=null;
l_subline_updrec_tbl(i).usage_net_reading:=null;
l_subline_updrec_tbl(i).usage_level:=null;
l_subline_updrec_tbl(i).usage_fill:=null;
l_subline_updrec_tbl(i).usage_fixed:=null;
l_subline_updrec_tbl(i).usage_subtotal:=null;
l_subline_updrec_tbl(i).usage_duration:=null;
l_subline_updrec_tbl(i).usage_period:=null;
l_subline_updrec_tbl(i).usage_break_uom:=null;
l_subline_updrec_tbl(i).usage_prorate:=null;

Service Contracts Public APIs


EXIT WHEN (i = 1);
i := i+1;
END LOOP;

oks_import_subline_pub.update_subline( p_api_version => l_api_version,


p_init_msg_list => l_init_msg_list,
p_subline_tbl => l_subline_updrec_tbl,
x_msg_count => x_msg_count,
x_msg_data => x_msg_data,
x_return_status => x_return_status);

COMMIT;

IF x_return_status = OKC_API.G_RET_STS_ERROR THEN


dbms_output.put_line('x_msg_data : '||x_msg_data);
FOR i IN 1 .. fnd_msg_pub.count_msg LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => x_msg_data,
p_msg_index_out => x_msg_count);
fnd_message.set_encoded (x_msg_data);
l_msg_data := fnd_message.get;
dbms_output.put_line(l_msg_data);
END LOOP;

END IF;
/*
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('sqlerrm : '||sqlerrm);
*/
END;

Service Contracts Public APIs


2.10 Contract Status Change :

2.10.1 Description
Contract Status Change API is used to change the contract status from Entered to Cancelled,
Cancelled to Entered and also to different statuses within the same status type.

2.10.2 API Signature and Parameter Description

OKS_STATUS_CHANGE_PUB.change_status(p_contract_id in varchar2,
p_line_id in varchar2,
p_subline_id in varchar2,
p_reason_code in varchar2,
p_comments in varchar2,
p_new_status_code IN VARCHAR2,
x_msg_data OUT NOCOPY VARCHAR2,
x_msg_count OUT NOCOPY NUMBER,
x_return_status out nocopy
varchar2);

Parameter Description:

Data
Parameter Name Type Reqd? Description
p_contract_id NUMBER Y Unique Contract Id
Required if line/subline status has to be
p_line_id NUMBER changed Contract Number
VARCHAR Contract Number
p_subline_id 2 Required if subline status has to be changed Modifier
VARCHAR Status Change
p_reason_code 2 Y Reason Code
Additional
VARCHAR Comments to
p_comments 2 N change status
New Status to
which
p_new_status_cod VARCHAR contract/line/subli
e 2 Y ne to be modified

2.10.3 Sample Test Data

declare
l_return_status VARCHAR2(20);
l_msg_data VARCHAR2(1000);
l_msg_count NUMBER;
begin

Service Contracts Public APIs


fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

oks_status_change_pub.change_status(p_contract_id =>447068,
p_line_id =>NULL,
p_subline_id =>NULL,
p_reason_code =>'EXPIRED',
p_comments =>NULL,
p_new_status_code =>'NEW',
x_msg_data =>l_msg_data,
x_msg_count => l_msg_count,
x_return_status => l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line(‘Status Change Action on contract occurred with return_status : '|| l_return_status );
COMMIT;
END IF;

IF l_return_status<>'S' then
FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;
END IF;

END;

2.11 Cascade Attributes on Contract:

2.11.1 Description
Cascade Attributes API is used to cascade attributes like dates and price list from headers to
lines and from lines to sublines.

2.11.2 API Signature and Parameter Description

OKS_CASCADE_ATTRIBUTES_PUB. OKS_CASCADE_ATTRIBUTES (
p_contract_id IN NUMBER
,header_lines_tbl IN cas_header_lines_tbl_type
,lines_sublines_tbl IN cas_lines_sublines_tbl_type
,X_return_status OUT NOCOPY Varchar2
,x_msg_tbl IN OUT NOCOPY OKS_ATTR_DEFAULTS_PVT.attr_msg_tbl_type
,x_line_msg_tbl IN OUT NOCOPY OKS_ATTR_DEFAULTS_PVT.attr_msg_tbl_type);

Parameter Description:

Service Contracts Public APIs


Data
Parameter Name Type Reqd? Description
P_contract_Id Number Y Contract Header Id
Table Type to hold line id, dates flag,
price list flag which indicates if the
dates and price list is to be cascaded
header_lines_tbl Varchar2 N from header to lines
Table Type to hold line id, subline id,
dates flag which indicates if the
dates to be cascaded from lines to
lines_sublines_tbl Varchar2 N sublines.

2.11.3 Sample Test Data

declare
l_header_lines_tbl oks_Cascade_attributes_pub.cas_header_lines_tbl_type;
l_lines_sublines_tbl oks_Cascade_attributes_pub.cas_lines_sublines_tbl_type;
i NUMBER;
l_contract_id NUMBER;
l_id NUMBER;
l_return_status VARCHAR2(100);
l_msg_tbl OKS_ATTR_DEFAULTS_PVT.attr_msg_tbl_type;
l_line_msg_tbl OKS_ATTR_DEFAULTS_PVT.attr_msg_tbl_type;
G_EXCEPTION_HALT_VALIDATION EXCEPTION;

CURSOR get_lines_csr(p_con_id NUMBER)


IS
SELECT id
FROM okc_k_lines_b
WHERE chr_id =p_con_id
AND cle_id IS NULL
AND lse_id=1;

begin

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

l_contract_id :=200068;

okc_context.set_okc_org_context(p_chr_id =>l_contract_id);

i :=1;
OPEN get_lines_csr(l_contract_id);
LOOP
FETCH get_lines_csr INTO l_id;
EXIT WHEN get_lines_csr%NOTFOUND;

Service Contracts Public APIs


l_header_lines_tbl(i).line_id :=l_id;
l_header_lines_tbl(i).dates_flag := 'Y';

i :=i+1;
END LOOP;

oks_cascade_attributes_pub.OKS_CASCADE_ATTRIBUTES(
p_contract_id => l_contract_id
,header_lines_tbl => l_header_lines_tbl
,lines_sublines_tbl => l_lines_sublines_tbl
,X_return_status => l_return_status
,x_msg_tbl => l_msg_tbl
,x_line_msg_tbl => l_line_msg_tbl );

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line(‘Cascade Attributes Action is completed successfully ‘);
COMMIT;
END IF;

IF l_return_status<>'S' then
FOR i IN 1..l_msg_tbl.count
LOOP
l_msg_data := l_msg_tbl(i).description
Dbms_Output.put_line(l_msg_data);
END LOOP;
END IF;

END;

2.12 Terminate contract/line/subline :

2.12.1 Description

Terminate API is used to terminate a contract/line/subline with various options like suppress
credit, full credit or with some override amount.

2.12.2 API Signature and Parameter Description

OKS_TERMINATE_CONTRACT_PUB. Terminate_Contract (p_contract_id IN NUMBER


,p_line_id IN NUMBER
,p_subline_id IN NUMBER
,P_Termination_Date IN DATE
,p_fullcredit_yn IN
VARCHAR2
,p_suppress_credit_yn IN
VARCHAR2

Service Contracts Public APIs


,p_term_reason_code IN
VARCHAR2
,p_override_amount IN
VARCHAR2
,x_return_status OUT NOCOPY
VARCHAR2);

Parameter Description:

Data
Parameter Name Type Reqd? Description

P_contract_id Number Y Contract Header Id


Required if
line/subline
has to be
Line Id Number terminated Contract Line Id
Required if
subline has
to be
P_subline_id Number terminated Contract Subline Id
P_termination_date Date Y Termination Date

Indicates if full credit has to be given


during termination and default value
P_fullcredit_yn Varchar2 N is ‘N’
Indicates if credit has to be
suppressed during termination and
p_suppress_credit_yn Varchar2 N default value is ‘N’
p_term_reason_code Varchar2 Y Termination Reason
p_override_amount NUMBER N Override Amount

2.12.3 Sample Test Data

declare

l_return_status VARCHAR2(100);
l_date_term DATE;
L_MSG_DATA VARCHAR2(1000);
l_msg_count NUMBER;
l_msg_index_out NUMBER;

BEGIN

fnd_global.apps_initialize
( user_id => 1000200

Service Contracts Public APIs


,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(p_chr_id =>361068);

oks_terminate_contract_pub.Terminate_Contract (p_contract_id =>361068


,p_line_id =>354811770843263715042387550343852930508
,p_subline_id =>NULL
,P_Termination_Date =>To_Date('28-oct-2013')
,p_fullcredit_yn =>'N'
,p_suppress_credit_yn =>'N'
,p_term_reason_code =>'BRE'
,p_override_amount =>NULL
,x_return_status =>l_return_status);

Dbms_Output.put_line('l_return_status - '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line('Party Contact Id : '||x_ctcv_rec_type.id ||' is created ');
COMMIT;
END IF;

IF l_return_status<>'S' then

FOR i IN 1 .. fnd_msg_pub.count_msg
LOOP
fnd_msg_pub.get (p_msg_index => i,
p_encoded => 'T',
p_data => l_msg_data,
p_msg_index_out => l_msg_index_out
);
fnd_message.set_encoded (l_msg_data);
l_msg_data := fnd_message.get;
dbms_output.put_line(l_msg_data);
END LOOP;

END IF;

END;

2.13 Contract QA Check and Activation

2.13.1 Description

Service Contracts Public APIs


This API is used to perform QA check and submit the contract for approval for contracts which
are in ‘Entered Status’. Contracts in QA hold status are moved to Active once the contract
passes the QA check.

2.13.2 API Signature and Parameter Description

OKS_ACTIVATE_CONTRACT_PUB. Activate_Contract(p_contract_id IN NUMBER


,p_submit_for_approval_yn IN VARCHAR2 DEFAULT
'N'
,p_ignore_warning_yn IN VARCHAR2 DEFAULT
'Y'
,x_return_status OUT NOCOPY VARCHAR2
,x_msg_tbl OUT NOCOPY
okc_qa_check_pub.msg_tbl_type
,x_msg_data OUT NOCOPY VARCHAR2
,x_msg_count OUT NOCOPY NUMBER
);

Parameter Description:

Data
Parameter Name Type Reqd? Description
p_contract_id Number Y Contract Header Id
Indicates if the contract
has to be submitted for
p_submit_for_approval_yn Varchar2 N approval
Indicates if QA
warnings can be
ignored when
p_ignore_warning_yn Varchar2 N submitting for approval

2.13.3 Sample Test Data

Declare
l_return_status VARCHAR2(1000);
l_msg_tbl okc_qa_check_pub.msg_tbl_type;

L_MSG_DATA VARCHAR2(1000);
l_msg_count NUMBER;
l_msg_index_out NUMBER;
begin

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(p_chr_id => 451071);

Service Contracts Public APIs


oks_activate_contract_pub.Activate_Contract(p_contract_id =>451071
,p_submit_for_approval_yn =>'Y'
,p_ignore_warning_yn =>'Y'
,x_return_status =>l_return_status
,x_msg_tbl =>l_msg_tbl
,x_msg_data =>l_msg_data
,x_msg_count =>l_msg_count);

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line('Contract QA check is performed and submitted for approval’);
COMMIT;
END IF;

IF l_return_status<>'S' then
FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;
END IF;

END;

2.14 Contract Renewal :

2.14.1 Description
This API is used to renew a contract.

2.14.2 API Signature and Parameter Description


OKS_RENEW_CONTRACTAPI_PUB. renew_contract(p_contract_id IN NUMBER
,p_new_Contract_number IN
VARCHAR2
,p_new_contract_modifier IN
VARCHAR2
,p_new_startdate IN DATE
,p_new_enddate IN DATE
,p_newduration IN NUMBER
,p_new_uomcode IN
MTL_UNITS_OF_MEASURE_TL.uom_code%TYPE
,p_ignore_warning_yn IN VARCHAR2
,x_contract_id OUT NOCOPY NUMBER
,x_msg_data OUT NOCOPY
VARCHAR2
,x_msg_count OUT NOCOPY NUMBER
,x_return_status OUT NOCOPY
VARCHAR2);

Service Contracts Public APIs


Parameter Description:

Parameters Mandatory Description


p_contract_id Yes Contract Header Id
p_new_Contract_number New contract number
No
New Contract Number
p_new_contract_modifier Modifier
No
p_new_startdate Start Date of new contract
No
p_new_enddate End Date of new Contract
No
p_newduration Duration of the new contract
Yes

Indicates if warnings can be


p_ignore_warning_yn No ignored. Default value is ‘N’

p_new_uomcode Period
Yes

2.14.3 Sample Test Data

declare
l_ctr_id NUMBER;
l_ret_sts VARCHAR2(100);
L_MSG_DATA VARCHAR2(1000);
l_msg_count NUMBER;
l_msg_index_out NUMBER;

begin

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(p_chr_id => 451070);

oks_renew_contractapi_pub.renew_contract(p_contract_id =>451070
,p_new_Contract_number =>NULL
,p_new_contract_modifier =>NULL
,p_new_startdate =>NULL
,p_new_enddate =>NULL
,p_newduration =>1
,p_new_uomcode =>'YR'
,p_ignore_warning_yn =>’Y’

Service Contracts Public APIs


,x_contract_id =>l_ctr_id
,x_msg_data => l_msg_data
,x_msg_count =>l_msg_count
,x_return_status =>l_ret_sts);

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line(‘Contract is renewed successfully ' );
COMMIT;
END IF;

IF l_return_status<>'S' then
FOR i IN 1..l_msg_count
LOOP
l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;
END IF;

END;

2.15 Delete Contract/Line/Subline:

2.15.1 Description
This API is used to delete contract/line/subline.

2.15.2 API Signature and Parameter Description

OKS_DELETE_CONTRACT_PUB.DELETE_CONTRACT(p_contract_id IN NUMBER
,p_line_id IN NUMBER
,p_subline_id IN NUMBER
,x_msg_count OUT NOCOPY
NUMBER
,x_msg_data OUT NOCOPY
VARCHAR2
,x_return_status OUT NOCOPY
VARCHAR2);

Parameter Description:

Parameter Name Data Type Reqd? Description


P_Contract_id NUMBER Y Unique Contract Id
Required if
line/subline
has to be
P_line_id NUMBER deleted Contract line Id
Required if
subline has
to be
P_subline_id NUMBER deleted Contract Subline Id

Service Contracts Public APIs


2.15.3 Sample Test Data

declare
l_return_status VARCHAR2(100);
l_msg_count VARCHAR2(1000);
l_msg_data VARCHAR2(1000);
l_msg_index_out NUMBER;
begin

fnd_global.apps_initialize
( user_id => 1000200
,resp_id => 21708
,resp_appl_id => 515
);

okc_context.set_okc_org_context(p_chr_id=>451069);

oks_delete_contract_pub.DELETE_CONTRACT(p_contract_id =>451070
,p_line_id =>371800622146928394901908716247989042342
,p_subline_id =>371800622146939275234285247910561397926
,x_msg_data => l_msg_data
,x_msg_count => l_msg_count
,x_return_status =>l_return_status);

Dbms_Output.put_line('l_return_status '||l_return_status);

IF l_return_status='S' THEN
Dbms_Output.put_line(‘Delete Action Performed successfully ');
COMMIT;
END IF;
Dbms_Output.put_line(l_return_status);
FOR i IN 1..l_msg_count
LOOP l_msg_data := FND_MSG_PUB.Get(i, p_encoded => FND_API.G_FALSE);
Dbms_Output.put_line(l_msg_data);
END LOOP;
END;

Service Contracts Public APIs


3. Limitations

Service Contracts Public APIs

Vous aimerez peut-être aussi