You are on page 1of 12

Final Year Report

Topic: Oracle Application


(Oracle Custom WebADI)

Name: Sahrish Kanwal


Father Name: khurshid Alam
Course: Advanced Programming Language
Roll No:45
Supervisor Name:
Sir Saad Akbar
Purpose: The Purpose of this document is to load data for oracle self-service
application for users by their own hands-on.

How to Create Custom WebADI

In this document I am creating custom WebADI for Assets Retirement (Using PL/SQL API).

Create Custom PL/SQL Package

First of all create custom PL/SQL package and using Oracle built-in API “FA_RETIREMENT_PUB.do_retirement”

Package Specification

create or replace package XX_fa_Retirement_pkg as


procedure xxfa_asset_retirement_api(P_ASSET_NUMBER IN VARCHAR2,
P_BOOK_TYPE_CODE IN VARCHAR2,
P_DATE_RETIRE IN DATE,
P_COST_RETIRE IN NUMBER,
P_UNIT_RETIRE IN NUMBER,
P_PROCEED_SALE IN NUMBER,
P_RETIREMENT_TYPE IN VARCHAR2,
P_RETIREMENT_PRO_CONV IN VARCHAR2,
P_SOLD_TO IN VARCHAR2,
P_CHECK_INVOICE IN VARCHAR2,
P_REASON IN VARCHAR2,
P_REFERENCE_NUMBER IN VARCHAR2,
P_ORBD IN VARCHAR2,
P_COMMENT IN VARCHAR2);
end XX_fa_Retirement_pkg;
/

Package Body

CREATE OR REPLACE PACKAGE BODY XX_fa_Retirement_pkg AS


PROCEDURE XXFA_ASSET_RETIREMENT_API(P_ASSET_NUMBER IN VARCHAR2,
P_BOOK_TYPE_CODE IN VARCHAR2,
P_DATE_RETIRE IN DATE,
P_COST_RETIRE IN NUMBER,
P_UNIT_RETIRE IN NUMBER,
P_PROCEED_SALE IN NUMBER,
P_RETIREMENT_TYPE IN VARCHAR2,
P_RETIREMENT_PRO_CONV IN VARCHAR2,
P_SOLD_TO IN VARCHAR2,
P_CHECK_INVOICE IN VARCHAR2,
P_REASON IN VARCHAR2,
P_REFERENCE_NUMBER IN VARCHAR2,
P_ORBD IN VARCHAR2,
P_COMMENT IN VARCHAR2
) is
-- v_header_report_id number;
l_trans_rec FA_API_TYPES.trans_rec_type;
l_dist_trans_rec FA_API_TYPES.trans_rec_type;
l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
l_asset_retire_rec FA_API_TYPES.asset_retire_rec_type;
l_asset_dist_tbl FA_API_TYPES.asset_dist_tbl_type;
l_subcomp_tbl FA_API_TYPES.subcomp_tbl_type;
l_inv_tbl FA_API_TYPES.inv_tbl_type;
l_desc_info FA_API_TYPES.desc_flex_rec_type;

l_return_status VARCHAR2(1);
l_mesg_count number;
l_mesg varchar2(4000);
le_cust_exp exception;

begin
/*fnd_global.apps_initialize(1508,50803,140);
mo_global.init('OFA');
mo_global.set_policy_context('S','104');*/
BEGIN
SELECT ASSET_ID
INTO l_asset_hdr_rec.asset_iD
FROM FA_ADDITIONS
WHERE ASSET_NUMBER = P_ASSET_NUMBER;
EXCEPTION
WHEN NO_DATA_FOUND THEN
l_mesg := 'ASSET DOES NOT EXIST';
raise_application_error(-20001, l_mesg);
END;

dbms_output.enable(1000000);
FA_SRVR_MSG.Init_Server_Message;

-- Get standard who info


l_asset_hdr_rec.book_type_code := P_BOOK_TYPE_CODE;
l_asset_retire_rec.cost_retired := P_COST_RETIRE;
l_asset_retire_rec.calculate_gain_loss := FND_API.G_FALSE;
l_desc_info.attribute12 := P_DATE_RETIRE;
l_desc_info.attribute13 := P_REASON;
l_desc_info.attribute14 := P_REFERENCE_NUMBER;
l_desc_info.attribute_category_code := P_ORBD;
l_asset_retire_rec.desc_flex := l_desc_info;
l_asset_retire_rec.proceeds_of_sale := P_PROCEED_SALE;
l_trans_rec.transaction_name := P_COMMENT;
l_asset_retire_rec.retirement_type_code := P_RETIREMENT_TYPE;
l_asset_retire_rec.date_retired := P_DATE_RETIRE;
l_asset_retire_rec.retirement_prorate_convention := P_RETIREMENT_PRO_CONV;
l_asset_retire_rec.sold_to := P_SOLD_TO;
l_asset_retire_rec.reference_num := P_CHECK_INVOICE;
l_asset_retire_rec.units_retired := P_UNIT_RETIRE;
FA_RETIREMENT_PUB.do_retirement(
-- std parameters
p_api_version => 1.0,
p_init_msg_list => FND_API.G_FALSE,
p_commit => FND_API.G_FALSE,
p_validation_level => FND_API.G_VALID_LEVEL_FULL,
p_calling_fn => NULL,
x_return_status => l_return_status,
x_msg_count => l_mesg_count,
x_msg_data => l_mesg,
-- api parameters
px_trans_rec => l_trans_rec,
px_dist_trans_rec => l_dist_trans_rec,
px_asset_hdr_rec => l_asset_hdr_rec,
px_asset_retire_rec => l_asset_retire_rec,
p_asset_dist_tbl => l_asset_dist_tbl,
p_subcomp_tbl => l_subcomp_tbl,
p_inv_tbl => l_inv_tbl
);

--dump messages
if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
for i in 1 .. l_mesg_count loop
l_mesg := l_mesg || CHR(10) ||fnd_msg_pub.Get_Detail(p_msg_index => i,
p_encoded => fnd_api.G_TRUE);
dbms_output.put_line(l_mesg);
end loop;
--fnd_msg_pub.delete_msg();
raise le_cust_exp;
end if;
commit;
exception
when le_cust_exp then
fnd_message.set_name('OFA', 'XXHDC_ASSET_ERROR');
fnd_message.set_token('XXHDC_ASSET_ERROR', l_mesg);
l_mesg := fnd_message.get();
-- fnd_message.raise_error;
raise_application_error(-20001, l_mesg);
when others then
l_mesg := sqlerrm;
fnd_message.set_name('OFA', 'XXHDC_ASSET_ERROR');
fnd_message.set_token('XXHDC_ASSET_ERROR', l_mesg);
l_mesg := fnd_message.get();
-- fnd_message.raise_error;
raise_application_error(-20001, l_mesg);
end;
end;

Note: Please make sure the above package is compiled and perform transactions successfully.
Responsibility

Assign the following responsibilities to user.

1) Desktop Integration Manager.


2) Desktop Integrator.

Desktop Integration Manager  Create Integrators.

JSP page will be open on your browser (shown in below screenshot).


Enter the values.

Integrator Name = XX_TEST


Internal Name = XX_TEST
Application = Assets
Reporting only = Unchecked (By default)
Enabled = Yes (By default)
Display in create document = Checked
Function = Desktop Integration - Create Document (Click Add button)

Click Next (button)

Interface Name = XX_fa_Retirement_pkg


Interface Type = API – Procedure
Package Name = XX_fa_Retirement_pkg (should be same as your package name)
Procedure/Function = xxfa_asset_retirement_api (should be same as procedure name created in your package)
API Returns = FND Message Code

Click Apply (Button)

Click on Radio Button (Top Prompt “Select”)

Now you can see all parameters defined in your package.

You can change parameters as per your requirement. For example.

Enable/Disable, Default Value, Top Prompt (in Update option) etc.

Click Next (Button)

Click Next (Button) again

Select Uploader = ‘From Template’ and Click Create (button).


Click Submit (Bottom)

Navigate Desktop Integrator  Define Layout.

Select Integrator XX_TEST and Go.

Click Create (Button shown right bottom).

Enter the Layout name ( WebADI Document name).

Layout Name = XX_Retirement


Click Next (Button)

Here you can define which field Placement (Appears in Header or Line).

For Example : I selected line level for all field in placement except BOOK_TYPE_CODE. In the WebADI Document
Insert value for BOOK_TYPE_CODE one time on header level.

Click Next (Button)

Protect Sheet = No
Style Sheet = Default
Apply Filter = Yes
Header Level
Title = XX_Retirement

Line Level

Data Entry Rows = how many (As per your requirement.)

Now on the below you can arrange all field sequences (As per your requirement).
For example : which field appears first, second or last.

Click Apply (Button).

Download the WebADI Document for transactions

Navigate : Desktop Integrator  Create Document

Select Integrator XX_TEST (which is your document name).

Click Next (Button)

Select viewer (Excel 2000,2003)

Click Next (Button)

Click Create Document (Button)


Click OK.

Wait for couple of second until confirmation.

Click Close.

Let’s check your custom WebADI. (Final Screen Shot below).

You might also like