Friday, April 24, 2009

Locate Trace file and Enviroment files from Front End

Locate Trace file and Enviroment files from Front End

After completing traceinge, You can find the Trace file location path by using following methods

Method 1) select value from v$parameter
where name ='user_dump_dest'

The above Query returns Trace file location Path.

Method 2) Login As sysadmin
Click at Goto ->OAM->OAM Setup->Site MAP->Monitoring->System Configuration-> Databse Init.ora Setting.

Here You can find out Parameter name as user_dump_dest , utl_file_dir and corresponding values.

Concurrent Program output in MS Excel format

Concurrent Program output in MS Excel format

1)Login as sysadmin
2) switch to Sysadmin responsibility
3)go to Install->Viewer Options
4) Add entries as Below

File Format =Text Mime
Type=application/vnd.ms-excel
Description=Microsoft Excel


5) save the changes
6) Run any concurrent program
7) Goto-> tools and Copy file
Your able to see the output into Excel format

Diffierent types Apps Tables

Diffierent types Apps Tables
_ALL Conatains multi org data before using this table you need to set client_into to specific org , Org_id is common column.
_V view created on base table
_VL view created on multi language tables.
always use the condition LANGUAGE = USERENV(’LANG’).
_TL Tables support multi language.
_B These Main base tables
_F these date tracked tables for only in HRMS and these table contain 2 common columns effective_start_date and effective_end_date
_S sequence related tables
_AVN Audit view shadow tables contains data track information

OM Flow and table level Information

OM Flow and table level Information

Steps in Order Cycle:

1) Order Entry
2) Booking
3) Pick release :
For this we have to go to
Shipping Responsibilty Release sales order
Here In this form , In the ORDER tab, we have to enter ORDER Number
And delete the Scheduled shipped Dates To & Requested Dates To.
In SHIPPING tab, set AUTO CREATE DELIVERY to YES. In INVENTORY tab enter WAREHOUSE, set AUTO ALLOCATE to YES and AUTO PICK CONFIRM to YES. IF we set AUTO PICK CONFIRM to NO, then We have to go for the following steps

1. go to Inventory Resp
Move order à Transact Move Order then it will ask for
warehouse information. Give the same name as before [M2]
In this form, In the HEADER tab, enter the BATCH
NUMBER of the order that is picked .Then Click FIND
Button. Click on VIEW/UPDATE Allocation, then
Click TRANSACT button. Then Transact button will be
deactivated then just close it and go to next step.

4) Shipping :
For this we need to go to Shipping Transaction Give the order Number, and click find
Then we can see the order status.
Then we have to click DELIVERY Tab Button, in the Action LOV
We have to choose, SHIP CONFIRM.
Then four concurrent program will run in the background.
Such As::
1.) INTERFACE TRIP Stop
2.) Commercial Invoice
3.) Packing Slip Report
4.) Bill of Lading

After this concurrent program will complete successfully, we have to run
One more WORKFLOW BACKGROUND PROGRAM.
· If we don’t want to ship all the items, that are PICKED, then we have to click LINE/LPN tab , then click DETAIL button .
Now, in that form , in the SHIPPING field, we have to enter how Much quantity of items, we want to ship . The rest remain quantity, that are Ordered will become backorder quantity .

5) Interfacing with AR :

After WORKFLOW BACKGROUND PROGRAM
Concurrent program will complete successfully, we have to run
AUTO INVOICE MASTER PROGRAM from
RECEIVABLE RESPONSIBILTY. After this program
will complete successfully , we can the invoice details in
RECEIVALE à TRANSACTIONS à TRANSACTIONS. Here in
This Form, we have to give our order number in reference field
And query for the invoice details .Then we can see the invoice details.




Table Level Information:
==========================
Order Entry
• At the header level a record gets inserted into the header table
OE_ORDER_HEADERS_ALL.
• At the line level, record(s) get inserted into the Line table
OE_ORDER_LINES_ALL.

Order Booking
• This will update FLOW_STATUS_CODE value in the table
OE_ORDER_HEADERS_ALL to “BOOKED”
• The FLOW_STATUS_CODE in OE_ORDER_LINES_ALL will change to
AWAITING_SHIPPING.
• Record(s) will be created into the table WSH_DELIVERY_DETAILS with
RELEASED_STATUS=’R’ (Ready to Release)
OE_INTERFACED_FLAG=’N’ (Not interfaced to OM)
INV_INTERFACED_FLAG=’N’ (Not interfaced to Inv)
• Record(s) will be created into WSH_DELIVERY_ASSIGNMENTS but with
DELIVERY_ID null.

Pick Release
------------------
IF “Autocreate Delivery” option = “Yes” THEN
• ) Create a record into the table WSH_NEW_DELIVERIES
• ) Update WSH_DELIVERY_ASSIGNMENTS with DELIVERY_ID, thus
• ) Update WSH_DELIVERY_DETAILS with RELEASED_STATUS=’Y

Auto Invoicing
----------------------
Before running “Autoinvoice Program”, record(s) will exist into the table
RA_INTERFACE_LINES_ALL with

INTERFACE_LINE_CONTEXT = ’ORDER ENTRY’
INTERFACE_LINE_ATTRIBUTE1 = &Order_number
INTERFACE_LINE_ATTRIBUTE3 = &Delivery_id
SALES_ORDER = &Order_number

After running the “Auto invoice Program” for the order:
Records will be deleted from the table RA_INTERFACE_LINES_ALL and new details will be created into the following RA transaction tables.
>RA_CUSTOMER_TRX_ALL with
INTERFACE_HEADER_ATTRIBUTE1=&Order_number
RA_CUSTOMER_TRX_LINES_ALL with
INTERFACE_LINE_ATTRIBUTE1 = &Order_number
SALES_ORDER = &Order_number

Oracle Purchasing Terminology

Oracle Purchasing Terminology

Terms used in the conventional purchasing system and as referred in Oracle Purchasing may be different. A brief explanation of the ‘Oracle Purchasing’ terms vis-à-vis the existing terminology is provided the following paragraphs. These terms are extensively used in documenting the ‘Purchasing - To Be’ flows and it is recommended that the various users of this system get acquainted with the same.

Requestor: Any Employee who requires specific items to meet his operational needs. Requestor may or may not have the system access to enter the on-line requisitions. Requestor with no computer access will give their requisitions manually on pre-printed requisition form to the requisition ‘Preparer’ within the concerned department.


Preparer: Employee in a department with the responsibility of entering Purchase Requisitions in the system.


Approver: Employee with the responsibility and authority of approving the requisition and / or the Quotation Analysis Document and / or the Purchase Orders.


Buyer: Employee in the Purchase Department with the responsibility of entering the Requests for Quotation, the Quotations received from the Supplier and the Purchase Orders in the new system.


Request For Quotation (RFQ): Synonym for ‘Inquiry’. RFQs are sent to the vendors, requesting them for their quotations for the items / services required to be purchased.

Quotation: Quotations are the ‘Vendor Offers’ for the required items / services.

Quotation Analysis: It is a ‘Comparative Statement of Quotations’.

Standard Purchase Order: Standard Purchase Orders are created for purchase of various items / services where details such as the quantity to be purchased and the negotiated costs.

Blanket Purchase Agreement: Blanket purchase agreements are signed with the vendor for the supply of goods / services over a period. Such agreements can be used when details of the goods / services you plan to buy from a specific supplier in a period are known, but you do not yet know the details of your delivery schedules. They can also be used to specify negotiated prices for your items before actually buying them.

Blanket Release: You can issue a Blanket Release against a Blanket Purchase Agreement to place the actual order with the vendor. The Releases should be within the Blanket Agreement effectivity dates.

Planned Purchase Order: It is a long term agreement committing to buy items / services from a single source. The tentative delivery schedule is given to the vendor along with other details like quantities and estimated costs.

Schedule Release: This document is issued to the vendor against a Planned Purchase Order to place the actual order. This document will confirm the specific quantity and delivery date to the vendor.

Contract Purchase Agreements: Contract Purchase Agreements may be entered into with suppliers to agree on specific terms and conditions without indicating the goods or services that will actually be purchased. Standard Purchase Orders can be issued at a later date referencing such Contracts.


Purchasing Cycle:

Requisitions: Requisitions generated by various departments of your organization. They basically say that ‘I WANT THIS ITEM’ mentioning the item quantity and required date

Request for Quotation: The purchasing person sends the requirement to various suppliers giving details of the item and can also specify own terms and conditions such as payment terms, price etc.

Quotations: The Supplier responds to the RFQ and sends their quotations mentioning details of the item and all their terms and conditions regarding payment terms, discount, delivery schedules, etc.

Purchase Orders: The quotations received from various suppliers are compared and PO made for them in which all the terms and conditions of the firm are mentioned as regards to Payment, price, etc.

Receiving Goods: Suppliers ship the goods, which are received in your organization

Payments: After clearance from the receiving department about the receipt of goods, payments are made to the suppliers.

Close the PO: After the items are received, payments made you can close the PO.


Purchasing Requirements
· Item
· Quantity
· Ship to Address
· Bill to Address
· Delivery Schedules
· Terms and Conditions
· PO Numbering
· Approval Authority
· Supplier
· Accounts

Wednesday, April 22, 2009

How to find Descriptive FlexFileds Segments defined for paticular Application

How to find Descriptive FlexFileds Segments defined for paticular Application

For Example if you want to know the Descriptive Flexfields defined for your Purchase Requisition Header level form,

Go to System Adminstrator Responsibility--->Application--->Flexfield--->Descriptive--->Segments--->
Here you can give F11 and query for Application 'Purchasing' and Title as 'Requisition Headers'
and here you can see how the segments attributes are defined.

AR Query to get open invoices for single/All customers

AR Query to get open invoice for single customer /for all customer from the table ar_payment_schedules_all , you can modify the query how you want to get the details

select aps.*
FROM ra_customer_trx_all ra,
ra_customer_trx_lines_all rl,
ar_payment_schedules_all aps,
ra_cust_trx_types_all rt,
hz_cust_accounts hc,
hz_parties hp,
hz_cust_acct_sites_all hcasa_bill,
hz_cust_site_uses_all hcsua_bill,
hz_party_sites hps_bill,
ra_cust_trx_line_gl_dist_all rct
WHERE 1 = 1
AND ra.customer_trx_id = rl.customer_trx_id
AND ra.customer_trx_id = aps.customer_trx_id
AND ra.org_id = aps.org_id
AND rct.customer_trx_id = aps.customer_trx_id
AND rct.customer_trx_id = ra.customer_trx_id
AND rct.customer_trx_id = rl.customer_trx_id
AND rct.customer_trx_line_id = rl.customer_trx_line_id
AND ra.complete_flag = 'Y'
AND rl.line_type IN ('FREIGHT', 'LINE')
AND ra.cust_trx_type_id = rt.cust_trx_type_id
AND ra.bill_to_customer_id = hc.cust_account_id
AND hc.status = 'A'
AND hp.party_id = hc.party_id
AND hcasa_bill.cust_account_id = ra.bill_to_customer_id
AND hcasa_bill.cust_acct_site_id = hcsua_bill.cust_acct_site_id
AND hcsua_bill.site_use_code = 'BILL_TO'
AND hcsua_bill.site_use_id = ra.bill_to_site_use_id
AND hps_bill.party_site_id = hcasa_bill.party_site_id
AND hcasa_bill.status = 'A'
AND hcsua_bill.status = 'A'
AND aps.amount_due_remaining <> 0
AND aps.status = 'OP'
and hc.cust_account_id=21924 --- Here you can give ths customer for whom you want open invoices to be retrieved

How to Cancel PO Requisition created

Cancellation of PO Requisition which is created

Go to PO Super User responsibility --->Reqisition Summary ---> Here open the Requisition Number which you want to cancel and Go to Menu Bar TOOLS Option--->Control and Mention Proper reason and Cancel the Requisition.

Once the Requisition is cancelled it will also Cancel the workflow and the status of workflow will be in Canclled mode.

Tuesday, April 21, 2009

How To Identify All Requisitions And Purchase Orders With Errored Activities

The following scripts have been provided to return requisitions and purchase orders with erroredactivities:

SELECT prh.segment1, prh.org_id, prh.authorization_status,
ac.display_name activity, ias.activity_result_code RESULT,
ias.error_name error_name, ias.error_message error_message,
ias.error_stack error_stack
FROM po_requisition_headers_all prh,
wf_item_activity_statuses ias,
wf_process_activities pa,
wf_activities_vl ac,
wf_activities_vl ap,
wf_items i
WHERE ias.item_type = 'REQAPPRV'
AND ias.item_key = prh.wf_item_key
AND ias.item_type = prh.wf_item_type
AND ias.activity_status = 'ERROR'
AND ias.process_activity = pa.instance_id
AND pa.activity_name = ac.NAME
AND pa.activity_item_type = ac.item_type
AND pa.process_name = ap.NAME
AND pa.process_item_type = ap.item_type
AND pa.process_version = ap.VERSION
AND i.item_type = 'REQAPPRV'
AND i.item_key = ias.item_key
AND i.begin_date >= ac.begin_date
AND i.begin_date
ORDER BY prh.segment1, ias.execution_time;

--- Purchase Orders

SELECT pha.segment1, pha.org_id, pha.authorization_status,
ac.display_name activity, ias.activity_result_code RESULT,
ias.error_name error_name, ias.error_message error_message,
ias.error_stack error_stackfrom
FROM po_headers_all pha,
wf_item_activity_statuses ias,
wf_process_activities pa,
wf_activities_vl ac,
wf_activities_vl ap,
wf_items i
WHERE ias.item_type = 'POAPPRV'
AND ias.item_key = pha.wf_item_key
AND ias.item_type = pha.wf_item_type
AND pha.authorization_status IN ('IN PROCESS', 'PRE-APPROVED')
AND ias.activity_status = 'ERROR'
AND ias.process_activity = pa.instance_id
AND pa.activity_name = ac.NAME
AND pa.activity_item_type = ac.item_type
AND pa.process_name = ap.NAME
AND pa.process_item_type = ap.item_type
AND pa.process_version = ap.VERSION
AND i.item_type = 'POAPPRV'
AND i.item_key = ias.item_key
AND i.begin_date >= ac.begin_date
AND i.begin_date
ORDER BY pha.segment1, ias.execution_time;

Monday, April 20, 2009

Auto Invoice Script

--Just replace the constant values with variables and call this procedure in a valid cursor loop

CREATE OR REPLACE PROCEDURE inv_proc_v (
asqlcode OUT NUMBER,
asqlerrm OUT VARCHAR2
)
IS
v_batch_source_name VARCHAR2 (100);
v_currency_code VARCHAR2 (10);
v_cust_trx_type_id NUMBER;
v_term_id NUMBER;
BEGIN
BEGIN
SELECT NAME
INTO v_batch_source_name
FROM ra_batch_sources_all
WHERE batch_source_id = 1228 AND org_id = 204;
END;

BEGIN
SELECT currency_code
INTO v_currency_code
FROM fnd_currencies
WHERE issuing_territory_code = 'US' AND enabled_flag = 'Y';
END;

BEGIN
SELECT cust_trx_type_id
INTO v_cust_trx_type_id
FROM ra_cust_trx_types_all
WHERE NAME = 'Invoice' AND org_id = 204;
END;

BEGIN
SELECT term_id
INTO v_term_id
FROM ra_terms_tl
WHERE NAME = '30 Net';
END;

BEGIN
SELECT set_of_books_id
INTO v_sob_id
FROM gl.gl_sets_of_books
WHERE short_name = 'Vision Operations';
END;

BEGIN
INSERT INTO ra_interface_lines_all
(interface_line_id, interface_line_context,
--ra_batch_sources_all
interface_line_attribute1, interface_line_attribute2,
batch_source_name, --ra_batch_sources_all
set_of_books_id, --gl.gl_setsof_books
line_type, tax_code,
--FND_lookups.tax_type
description, --mtl_system_items
currency_code, --fnd_currencies
amount, cust_trx_type_id,
--ra_cust_trx_types_all
term_id, --ar_terms
conversion_type,
--GL_DAILY_CONVERSION_TYPES.CONVERSION_TYPE
conversion_rate, trx_date,
gl_date, quantity, quantity_ordered, unit_selling_price,
unit_standard_price, inventory_item_id, --MTL_SYSTEM_ITEMS
territory_id,
--ra_territories
uom_code, --MTL_UNITS_OF_MEASURE
created_by, --fnd_global.user_id
creation_date, last_update_date,
last_updated_by, org_id, --fnd_global.org_id
tax_exempt_flag,
--FND_lookups.tax_control_flag
orig_system_bill_customer_id, --hz_customer_accounts
orig_system_bill_address_id, --hz_cust_sites_USES_all
orig_system_sold_customer_id
) --hz_customer_accounts
VALUES (ra_customer_trx_lines_s.NEXTVAL, 'LEGACY',
'1101233', '11045',
'LEGACY', 1, 'LINE', 'Exempt',
'Paper Carrier', 'USD', '1000.00', 1,
1060, 'User', 1, SYSDATE,
SYSDATE, 12, 12, 50.00,
50.00, 6074, 1003,
'Ea', 1318, SYSDATE, SYSDATE,
1318, 204, 'S',
5789,
5808, 5789
);
END;
END inv_proc_v;
/

Importing Blanket Purchase Aggrements(BPA)

Importing Blanket Purchase Aggrements(BPA)
In this article we will see what a Blanket Purchase Agreement is and how we can import them along with the price breaks.

Overview of Blanket Purchase Agreements:You create blanket purchase agreements when you know the detail of the goods or services you plan to buy from a specific supplier in a period, but you do not yet know the detail of your delivery schedules. You can use blanket purchase agreements to specify negotiated prices for your items before actually purchasing them.

Blanket Releases: You can issue a blanket release against a blanket purchase agreement to place the actual order (as long as the release is within the blanket agreement effectivity dates. If your purchase agreement has price breaks, the quantity entered on the release determines what break price is defaulted into the Price field.

Import Process: The Purchasing Document Open Interface concurrent program was replaced by two new concurrent programs Import Price Catalogs and Import Standard Purchase Orders.Import Price Catalogs concurrent program is used to import Catalog Quotations, Standard Quotations, and Blanket Purchase Agreements. Import Standard Purchase Orders concurrent program is used to import Unapproved or Approved Standard Purchase Orders.

You need to populate PO_HEADERS_INTERFACE and PO_LINES_INTERFACE to import header and line information into Purchasing. PO_LINES_INTERFACE table contains both line and shipment information, and imports data into both the PO_LINES and PO_LINE_LOCATIONS. The below are the additional columns that are required in PO_LINES_INTERFACE if you want to import price break information:
LINE_NUM
SHIPMENT_NUM

QUANTITY

UNIT_PRIC



If you are importing price break information through catalog quotations, you can also, optionally, populate the following columns in the PO_LINES_INTERFACE table: MIN_ORDER_QUANTITY
MAX_ORDER_QUANTITY
Lets take an example to better understand.Suppose you want to create a blanket with one line and two price breaks and the details for the price break are as below:
1)quantity = 500, price = 10, effective date from '01-JAN-2006' to '31-JUN-2006'
2)quantity = 500, price = 11, effective date from '01-JUL-2006' to '01-JAN-2007'

To create the above the BPA, you would create ONE record in PO_HEADERS_INTERFACE and THREE records in PO_LINES_INTERFACE

LINE1: It will have only the line information. LINE NUM would be 1.
LINE2: For the first Price Break details but the LINE NUM will be the same as above i.e 1. SHIPMENT_NUM would be 1 and SHIPMENT_TYPE would be ‘PRICE BREAK’
LINE3: For the second Price Break details but the LINE NUM will be the same as above i.e 1. SHIPMENT_NUM would be 2 and SHIPMENT_TYPE would be ‘PRICE BREAK’ All the line-level records above must have the same INTERFACE_HEADER_ID.
--Inserting Header Information
insert into po_headers_interface
(interface_header_id,
action,
org_id,
document_type_code,
vendor_id,
vendor_site_id,
effective_date,
expiration_date,
Vendor_doc_num)
values
(po_headers_interface_s.nextval,
'ORIGINAL',
204,
'BLANKET',
21,
41,
'01-JAN-2006',
'01-JAN-2007',
'VENDOR04302006');

--Inserting Line Information
insert into po_lines_interface
(interface_line_id,
interface_header_id,
action,
item,
line_num,
unit_price,
unit_of_measure,
effective_date,
expiration_date,
ship_to_organization_id,
ship_to_location_id,
PRICE_BREAK_LOOKUP_CODE)
values
(po_lines_interface_s.nextval,
po_headers_interface_s.currval,
'ORIGINAL',
'AS54888',
1,
20,
'Each',
'01-JAN-2006',
'01-JAN-2007',
207,
207,
'NON CUMULATIVE');

Note: Cumulative: Price breaks apply to the cumulative quantity on all release shipments for the item. Non–cumulative: Price breaks apply to quantities on individual release shipments for the item.

--Inserting First Price Break
insert into po_lines_interface
(interface_line_id,
interface_header_id,
action,
item,
line_num,
shipment_num,
shipment_type,
quantity,
unit_price,
unit_of_measure,
ship_to_organization_id,
ship_to_location_id,
effective_date,
expiration_date)
values
(po_lines_interface_s.nextval,
po_headers_interface_s.currval,
'ORIGINAL',
'AS54888',
1,
1,
'PRICE BREAK',
500,
10,
'Each',
207,
207,
'01-JAN-2006',
'30-JUN-2006');

--Inserting Second Price Break
insert into po_lines_interface
(interface_line_id,
interface_header_id,
action,
item,
line_num,
shipment_num,
shipment_type,
quantity,
unit_price,
unit_of_measure,
ship_to_organization_id,
ship_to_location_id,
effective_date,
expiration_date)
values
(po_lines_interface_s.nextval,
po_headers_interface_s.currval,
'ORIGINAL',
'AS54888',
1,
2,
'PRICE BREAK',
500,
11,
'Each',
207,
207,
'01-JUL-2006',
'01-JAN-2007');

Final Step:
Run Import Price Catalog Concurrent Program to create this Blanket Purchase Agreement.

Friday, April 17, 2009

How to assign Approval Limits to user

How to assign Approval Limits to user

PO Super User
Setup > Approvals > Approval Assignments
Select Job = .GCSM Delivery Manager. (User job title)
Document Type = Approve Purchase Requisitions
Approval Group = APPROVAL 5000


Once the above process is done then we should run the process 'i2 AP Maintain Web Signing Limits'. after this process the AP Signing Limits table was automatically updated.

Wednesday, April 8, 2009

Useful Shell Script for Oracle Apps

Shell Script Tutorial for Oracle Apps

Steps to Register Shell Script as a concurrent program
Sample Shell Script to copy the file from source to destination
Basic Shell Script Commands
Steps to Register Shell Script as a concurrent program

step 1:
=======
Place the .prog script under the bin directory for your
applications top directory.

For example, call the script ERPS_DEMO.prog and place it under
$CUSTOM_TOP/bin

step 2:
=======
Make a symbolic link from your script to $FND_TOP/bin/fndcpesr
For example, if the script is called ERPS_DEMO.prog use this:

ln -s $FND_TOP/bin/fndcpesr ERPS_DEMO

This link should be named the same as your script without the
.prog extension.

Put the link for your script in the same directory where the
script is located.

step 3:
=======
Register the concurrent program, using an execution method of
'Host'. Use the name of your script without the .prog extension
as the name of the executable.

For the example above:
Use ERPS_DEMO

step 4:
=======
Your script will be passed at least 4 parameters, from $1 to $4.

$1 = orauser/pwd
$2 = userid(apps)
$3 = username,
$4 = request_id

Any other parameters you define will be passed in as $5 and higher.
Make sure your script returns an exit status also.

Sample Shell Script to copy the file from source to destination

#Note: If you see # in front of any line it means that its a comment line not the actual code
#** ********************************************************************
# Created By :
# Creation Date :
# Script Name :
# Description : This Script accepts three parameters
# 1)Data File Name 2)Source Directory Path 3)Target Directory Path
# Then copy the file from source location to target location.
# If copy fails send the error status/message to concurrent program so that user can see status.
#
#
# ========
# History
# ========
#
#
#** ********************************************************************
#Parameters from 1 to 4 i.e $1 $2 $3 $4 are standard parameters
# $1 : username/password of the database
# $2 : userid
# $3 : USERNAME
# $4 : Concurrent Request ID
DataFileName=$5
SourceDirectory=$6
TargetDirectory=$7
echo "--------------------------------------------------"
echo "Parameters received from concurrent program .."
echo " Time : "`date`
echo "--------------------------------------------------"
echo "Arguments : "
echo " Data File Name : "${DataFileName}
echo " SourceDirectory : "${SourceDirectory}
echo " TargetDirectory : "${TargetDirectory}
echo "--------------------------------------------------"
echo " Copying the file from source directory to target directory..."
cp ${SourceDirectory}/${DataFileName} ${TargetDirectory}
if [ $? -ne 0 ]
# the $? will contain the result of previously executed statement.
#It will be 0 if success and 1 if fail in many cases
# -ne represents not "equal to"
then
echo "Entered Exception"
exit 1
# exit 1 represents concurrent program status. 1 for error, 2 for warning 0 for success
else
echo "File Successfully copied from source to destination"
exit 0
fi
echo "****************************************************************"


Basic Shell Script Commands

# Create Directory
mkdir

# Remove Directory
rmdir

#remove folder with files
rm -r -f

# Change Directory
cd

# Create new file
vi

#insert data into file
vi
esc i

#Save file
esc :wq enter

# exit with out saving changes
esc :q! enter

# open existing file
vi

#remove file
rm

# copy file with same name
cp /

# copy file with new name
cp / /

# Move file with same name
mv /

# move file with data appended to filename in the front
mv / /`date+%H%M%d%m%y`

#print line
echo "your text here to print"

#print date
echo `date`

query gives all function names under a menu considering submenus's also.

-- Below query gives all function names under a menu considering submenus's also.
SELECT DISTINCT fmep.menu_id,
DECODE (fmep.function_id,
NULL, DECODE (fmec.function_id,
NULL, DECODE (fmec1.function_id,
NULL, 'No Func',
fmec1.function_id
),
fmec.function_id
),
fmep.function_id
) funcid,
fff.user_function_name, fff.description
FROM fnd_form_functions_tl fff,
fnd_menu_entries fmec1,
fnd_menu_entries fmec,
fnd_menu_entries fmep
WHERE fmep.menu_id =
(SELECT menu_id
FROM fnd_menus
WHERE menu_name =
'INV_NAVIGATE'
--Change the menu according to your requirement
AND ROWNUM = 1)
AND fmep.sub_menu_id = fmec.menu_id(+)
AND fmec.sub_menu_id = fmec1.menu_id(+)
AND fff.function_id =
DECODE (fmep.function_id,
NULL, DECODE (fmec.function_id,
NULL, DECODE (fmec1.function_id,
NULL, -999,
fmec1.function_id
),
fmec.function_id
),
fmep.function_id
)
ORDER BY DECODE (fmep.function_id,
NULL, DECODE (fmec.function_id,
NULL, DECODE (fmec1.function_id,
NULL, 'No Func',
fmec1.function_id
),
fmec.function_id
),
fmep.function_id
)

Few Oracle Apps Technical Terms

Oracle Apps Technical Terms

Invoice
Receipt
Customer
Vendor
Buyer
Supplier
Purchase Order
Requisition
ACH: Account Clearance House


Sales Order
Pack Slip
Pick Slip
Drop Ship
Back Order
ASN: Advance Shipping Notice
ASBN: Advance Shipping Billing Notice
ATP: Available to Promise
Lot/Serial Number


DFF: Descriptive Flex Fields
KFF: Key Flex Fields
Value Sets
Organization
Business Unit
Multi Org
Folders
WHO Columns


Oracle Reports
Oracle Forms
Workflow Builder
Toad
SQL Developer
SQL Navigator
Discoverer Reports
XML/BI Publisher
ADI: Application Desktop Integrator
Winscp
Putty

How to RETRY , REWIND and UPDATE ATTRIBUTES for Expense Report Workflows

How to RETRY , REWIND and UPDATE ATTRIBUTES for Expense Report Workflows

RETRY Demo:

Log into Workflow Admin responsibility
Go to Administrator Workflow > Status Monitor
Key in the following values:
Type Internal Name: APEXP
User Key: Expense Report Number

Click Go
Select the Radio button and click on Activity History.


Select the Activity you want to RETRY say “Request Approval from APPROVER” and click on the Retry button on the top.

Click on Submit button in the next screen.

Confirm the details in the next page by clicking the OK button.


REWIND Demo:

Log into Workflow Admin responsibility
Go to Administrator Workflow > Status Monitor
Key in the following values:
Type Internal Name: APEXP
User Key: Expense Report Number

Click Go
Select the Radio button and click on Activity History.

Select the Activity which you want to REWIND for example say “Request Approval from APPROVER” and click on the Rewind button on the bottom.


Choose the activity to which you want the workflow to return in the next screen and select the "Apply" button. This would REWIND the activity.




UPDATE ATTRIBUTES Demo:

In the “Activity History” screen, click on the “Update Attributes” Button at the bottom. This opens up a page with all the attributes where you could update the necessary and hit “Apply” button to save the changes.

Expense Report Workflow Notifications

Expense Report Workflow Notifications

The mail status of the notification can be SENT, CANCELED, MAIL, UNAVAIL, ERROR, NULL. Let us see in detail about these and the actions required to get the notification to SENT status..

SENT: The notification has been successfully sent to the APPROVER.

CANCELED: The system is setup to send the notifications n times (n can be set in the workflow attributes) with a timeout after 5 days. If the Approver does not approve or reject within the time frame, the workflow will cancel the notification automatically and then the notification will end up in the status CANCELED.

Action: In such cases, RETRY would not work instead ask the preparer to withdraw and re-
submit the expense report.

MAIL: If the notification is not SENT to the approver, the status would be MAIL.

Action: Ask the DBA to bounce the workflow. This would solve the problem most times. But if it doesn’t i.e if the status is still MAIL, then RETRY the activity ‘Request Approval from APPROVER’ using the Workflow Administrator responsibility (demo below). If yet not sent, check the Attributes like Approver’s email etc.

BLANK: Sometimes the value of the status would be NULL.

Action: Sometimes even if the status is BLANK, the notification is sent to the approver. First check with the Approver to see if the notification is sent. If not sent, RETRY the activity.

UNAVAIL: This would happen usually when there is problem with the Approver’s preferences or Email address.

Action: Check the notification preference of the Approver using the below:

SELECT WFU.NAME, WFU.display_name,WFU.notification_preference, email_address ,wfu.status
FROM WF_USERS WFU
WHERE WFU.name in (‘NAME’) (NAME would be the user_name in FND_USER table)

The notification_preference can be set to one of the below
MAILTEXT
QUERY
DISABLED
MAILHTM2
MAILHTML
MAILATTH
Make sure that it is set to MAILHTML
Also check if the email address returned in the above query is a valid one and matches with the one in HR Employee record (hr_employee table), fnd_user table and the outlook email address.
Also check if the status is ACTIVE in the above query, if the APPROVER is an existing employee and his FND_USER account is ACTIVE.



FAILED:

Action RETRY would solve this case.

ERROR:
Action: Check the ERROR and act accordingly. Some sample Errors:

--Failed Activity AP Validate Expense Report
Activity Type Function
Error Name -20001
Error Message ORA-20001: APP-SQLAP-10000: ORA-00984: column not allowed here occurred in AddDistributionLine with parameters (&PARAMETERS) while performing the following operation: parse cursor
Error Stack AP_WEB_EXPENSE_WF.APValidateExpenseReport(APEXP, 142459, 0, Call DoAPValidationORA-00984: column not allowed here occurred in AddDistributionLine with parameters (&PARAMETERS) while performing the following operation: parse cursor) Wf_Engine_Util.Function_Call(AP_WEB_EXPENSE_WF.APVALIDATEEXPENSEREPORT, APEXP, 142459, 175587, RUN)

Check if the code combinations are all passed in correct and if it exists. There is something wrong in the data which results in this error. If the expense report errors out in this Stage i.e it has not passed the validation, Status in expense report header would not be WEBEXPENSE and hence cannot see this in AP.



--. No Approver/Performer ERROR:
Check to see if there is any supervisor assigned in HR
Check to see if Supervisor exists in USERS list and in HR.
If everything is fine, In the status monitor, query for the Item key
Click on Active History
Check Request approval from APPROVER, hit Update attributes.
Fill in the appropriate Manager Id (Employee ID), Manager name(WF_USER.NAME), Manager Display Name(WF_user.display_name), approver ID, approver name ,Approver display name and hit Apply.
Go back to Active history, Check Request approval from APPROVER, hit Rewind.

--DISCARD folder error:
Failed Activity Request Approval from APPROVER
Activity Type Notice
Error Name WFRSPPR_BOUNCE
Error Message 2405: Notification '1251131' has bounced. Check mailer log and discard folder. STATUS=ERROR ROLE=ABHI



Ask the DBA to resend the notification from Workflow mailer. This is due to Mail Format or OUTLOOK version issues.

--Environment context Error:
Failed Activity Request Approval from APPROVER

Activity Type Notice

Error Name WF_ERROR
Error Message [WF_ERROR] ERROR_MESSAGE=3835: Error '-20001 - ORA-20001: Oracle error -20001: ORA-20001: APP-FND-02500: Error occurred during product initialization for MO when executing 'begin MO_GLOBAL.INIT; end;'. SQLCODE = -20001 SQLERROR = ORA-20001: APP-FND-02902: Multi-Org profile option is required. Please set either MO: Security Profile or MO: Operating Unit profile option. has been detected in FND_GLOBAL.INITIALIZE.' encountered during execution of Generate function 'WF_XML.Generate' for event 'oracle.apps.wf.notification.send'. ERROR_STACK= Wf_Engine_Util.Function_Call(AP_WEB_EXPENSE_WF.CALLBACKFUNCTION, APEXP, 144392, SET_CTX) Wf_Engine_Util.Execute_Selector_Function(APEXP, 144392, SET_CTX) Wf_Engine_Util.Function_Call(AP_WEB_EXPENSE_WF.CALLBACKFUNCTION, APEXP, 144392, TEST_CTX) Wf_Engine_Util.Execute_Selector_Function(APEXP, 144392, TEST_CTX) Wf_Engine.CB(TESTCTX, APEXP:144392:175390, ::::) Wf_Engine.oldCB(TESTCTX, APEXP:144392:175390, ::::) WF_MAIL.SetContext(1252292) WF_XML.GenerateDoc(oracle.apps.wf.notification.send, 1252292) WF_XML.Generate(oracle.apps.wf.notification.send, 1252292) WF_XML.Generate(oracle.apps.wf.notification.send, 1252292) Wf_Event.setMessage(oracle.apps.wf.notification.send, 1252292, WF_XML.Generate) Wf_Event.dispatch_internal()
Error Stack

RETRY would resolve the problem.

If all the attempts were futile in sending the notification to the Approver, the last action to resolve would be to ask the approver to go to IExpense responsibility and approve manually.

Expense report Workflow Notifications Error Handling

In this section we will mainly focus on the notifications that are sent to the APPROVER for the approval as it is very important to see that such notifications reach the APPROVER on time so that there is no delay in the processing of the expense report to avoid late fee enforced by the Credit Card company. These notifications will have the message_name as 'OIE_REQ_EXPENSE_REPORT_APPRVL' in wf_notifications table. The mail status of the notification can be SENT, CANCELED, MAIL, UNAVAIL, ERROR, NULL. Let us see in detail about these and the actions required to get the notification to SENT status..

The below is the script to check the notification status:


SELECT wn.notification_id, aerh.invoice_num,
TO_CHAR (wn.begin_date, 'DD-MON-YYYY hh:mi:ss') begin_date, wn.to_user,
wn.from_user, wr2.display_name preparer, wr3.display_name reported_for,
wn.status, wn.mail_status mail_status, aerh.expense_status_code,
wr.email_address, aerh.total, aerh.report_submitted_date,
aerh.description
FROM wf_notifications wn,
wf_item_activity_statuses was,
wf_items wi,
ap_expense_report_headers_all aerh,
wf_roles wr,
wf_roles wr2,
fnd_user fu,
wf_roles wr3
WHERE 1 = 1
AND wn.notification_id = was.notification_id
AND was.item_type = wi.item_type
AND was.item_key = wi.item_key
AND wn.status IN ('OPEN', 'CANCELED')
AND wn.message_name = 'OIE_REQ_EXPENSE_REPORT_APPRVL'
AND aerh.invoice_num = wi.user_key
AND aerh.expense_status_code IN ('PENDMGR', 'RESOLUTN')
AND wn.recipient_role = wr.NAME(+)
AND wi.owner_role = wr2.NAME
AND aerh.employee_id = fu.employee_id
AND fu.user_name = wr3.NAME(+)

Script for bouncing the Apache

Script for bouncing the Apache

Stop$COMMON_TOP/admin/scripts/$TWO_TASK*/adapcctl.sh stop

Start
$COMMON_TOP/admin/scripts/$TWO_TASK*/adapcctl.sh start

Thursday, March 5, 2009

How to remove new line characters and Tab's in the SQL output

How to remove new line characters and Tab's in your SQL output


select comment from emp

Result (Comment column value is )

John M.
This was a
Fine piece of
work.

select REPLACE(REPLACE(REPLACE(comment, CHR(10)), CHR(13)), CHR(9)) comment from emp

Result (Comment column value is )

John M.This was a Fine piece of work.