Tuesday, 19 April 2011

SUPPLIER PHONE DETAILS QUERY


SUPPLIER PHONE DETAILS QUERY
SELECT hp.party_id,
  hp.person_first_name,
  hp.person_last_name,
  hp.party_name,
  APS.VENDOR_NAME,
  hcpp.email_address,
  hcpp.phone_number
FROM hz_parties hp,
  hz_contact_points hcpp,
  AP_SUPPLIERS APS
WHERE HP.PARTY_ID=APS.PARTY_ID AND hcpp.owner_table_name(+) = 'HZ_PARTIES'

INVENTORY QUERY


INVENTORY QUERY
SELECT msi.segment1 AS item_code
, mp.organization_code AS org_code
, decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.subinventory_code,sinv.secondary_inventory_name) AS subinv_code
, sum(decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.transaction_quantity,sinv.secondary_inventory_name,moq.transaction_quantity,0))AS ohq
FROM
apps.mtl_system_items_b msi
, apps.mtl_onhand_quantities moq
, apps.mtl_parameters mp
, (SELECT msec.secondary_inventory_name,
msec.organization_id
FROM mtl_secondary_inventories msec
WHERE msec.secondary_inventory_name IN ('Sub_INVA','Sub_INVB')) sinv
WHERE AND msi.inventory_item_status_code = 'Active'
AND msi.inventory_item_id = moq.inventory_item_id(+) 
AND msi.organization_id = moq.organization_id(+)
AND (moq.subinventory_code IN ('Sub_INVA','Sub_INVB') OR (moq.subinventory_code IS NULL AND sinv.secondary_inventory_name IN ('Sub_INVA','Sub_INVB')))
AND msi.organization_id = mp.organization_id
AND msi.organization_id = sinv.organization_id
GROUP BY msi.segment1, 
mp.organization_code, 
decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.subinventory_code,sinv.secondary_inventory_name)
ORDER BY msi.segment1, 
decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.subinventory_code,sinv.secondary_inventory_name), 
msi.segment1;


--------------------------------------------------------------------------------------------------------

SELECT   hou.NAME org, mp.organization_code AS org_code,
            decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.subinventory_code,sinv.secondary_inventory_name) AS subinventory,
            mil.concatenated_segments LOCATOR, mil.segment1 warehouse_id,
            mil.segment2 product_type, mil.segment3 container,
            mil.segment4 aisle, mil.segment5 bay, mil.segment6 shelf,
            mil.segment7 project, msi.segment1 AS item_code,
            msi.description description, msi.primary_uom_code primary_uom,
            sum(decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.transaction_quantity,sinv.secondary_inventory_name,moq.transaction_quantity,0)) AS ohq,
            moq.lot_number lot_number, mln.expiration_date expire_date,
            cic.item_cost standard_cost, msi.list_price_per_unit,
            mil.attribute1 container_seal, fu1.user_name qty_created_by,
            fu2.user_name qty_last_updated_by, msi.attribute1 rotatable,
            msi.attribute2 slep_eligible, msi.attribute3 categoryi_v,
            TO_NUMBER (msi.attribute4) "Case To Bottle",
            TO_NUMBER (msi.attribute5) "Case To Each",
            TO_NUMBER (msi.attribute6) "Pallet QTY",
            mcst.category_set_name category_name,
            mc.concatenated_segments item_category,
            TO_DATE (SUBSTR (mil.attribute2, 1, 10), 'YYYY/MM/DD') seal_date,
            mil.attribute4 seal_color, mil.attribute3 seal_by,
            element10.element_value "Indications",
            element20.element_value "Dose",
            element30.element_value "Customer",
            element40.element_value "Adult/Ped",
            element50.element_value "Pregnancy Class",
            element60.element_value "Product Identifier",
            element70.element_value "Conv UOM", mln.attribute1 slep_status,
            mc.segment1 agent_type, mc.segment2 administrator,
            mc.segment3 drug_type, mc.segment4 drug_strength,
            mcr1.cross_reference, mcr2.cross_reference, mcr3.cross_reference,
            mcr4.cross_reference, misi.min_minmax_quantity,
            misi.max_minmax_quantity, msi.min_minmax_quantity,
            msi.max_minmax_quantity, mln.attribute2 original_expiration_date,
            mln.attribute3 first_extension_project,
            mln.attribute4 first_extension_date,
            mln.attribute5 second_extension_project,
            mln.attribute6 second_extension_date,
            mln.attribute7 third_extension_project,
            mln.attribute8 third_extension_date,
            mln.attribute9 fourth_extension_project,
            mln.attribute10 fourth_extension_date, msi.organization_id,
            msi.inventory_item_id
       FROM apps.mtl_system_items_b msi,
            apps.mtl_onhand_quantities moq,
            apps.mtl_parameters mp,
            apps.hr_organization_units hou,
            apps.mtl_item_locations_kfv mil,
            apps.mtl_lot_numbers mln,
            apps.cst_item_costs cic,
            apps.fnd_user fu1,
            apps.fnd_user fu2,
            apps.mtl_category_sets_tl mcst,
            apps.mtl_category_sets_b mcs,
            apps.mtl_categories_kfv mc,
            apps.mtl_item_categories mic,
            apps.mtl_descr_element_values element10,
            apps.mtl_descr_element_values element20,
            apps.mtl_descr_element_values element30,
            apps.mtl_descr_element_values element40,
            apps.mtl_descr_element_values element50,
            apps.mtl_descr_element_values element60,
            apps.mtl_descr_element_values element70,
            apps.mtl_cross_references mcr1,
            apps.mtl_cross_references mcr2,
            apps.mtl_cross_references mcr3,
            apps.mtl_cross_references mcr4,
            apps.mtl_item_sub_inventories misi,
            (SELECT msec.secondary_inventory_name, msec.organization_id
               FROM apps.mtl_secondary_inventories msec
              WHERE msec.secondary_inventory_name IN ('SUBIN_A','SUBINV_B')) sinv
      WHERE 1 = 1
        AND hou.organization_id = mp.organization_id
        AND moq.locator_id = mil.inventory_location_id(+)
        AND moq.subinventory_code = mil.subinventory_code(+)
        AND moq.organization_id = mil.organization_id(+)
        AND mil.enabled_flag(+) = 'Y'
        AND msi.inventory_item_status_code = 'Active'
        AND msi.inventory_item_id = moq.inventory_item_id(+)
        AND msi.organization_id = moq.organization_id(+)
        AND mln.lot_number(+) = moq.lot_number
        AND mln.organization_id(+) = moq.organization_id
        AND mln.inventory_item_id(+) = moq.inventory_item_id
        AND msi.inventory_item_id = cic.inventory_item_id(+)
        AND msi.organization_id = cic.organization_id(+)
        AND fu2.user_id(+) = moq.last_updated_by
        AND fu1.user_id(+) = moq.created_by
        AND mc.structure_id = mcs.structure_id
        AND mc.category_id = mic.category_id
        AND mic.inventory_item_id(+) = msi.inventory_item_id
        AND mic.organization_id = msi.organization_id
        AND mic.category_set_id = mcs.category_set_id
        AND mcs.category_set_id = mcst.category_set_id
        AND mcst.category_set_name = 'Inventory'
        AND element10.element_name(+) = 'Indications'
        AND element10.inventory_item_id(+) = msi.inventory_item_id
        AND element20.element_name(+) = 'Dose'
        AND element20.inventory_item_id(+) = msi.inventory_item_id
        AND element30.element_name(+) = 'Customer'
        AND element30.inventory_item_id(+) = msi.inventory_item_id
        AND element40.element_name(+) = 'Adult/Ped'
        AND element40.inventory_item_id(+) = msi.inventory_item_id
        AND element50.element_name(+) = 'Pregnancy Class'
        AND element50.inventory_item_id(+) = msi.inventory_item_id
        AND element60.element_name(+) = 'Product Identifier'
        AND element60.inventory_item_id(+) = msi.inventory_item_id
        AND element70.element_name(+) = 'Conv UOM'
        AND element70.inventory_item_id(+) = msi.inventory_item_id
        AND msi.inventory_item_id = mcr1.inventory_item_id(+)
        AND mcr1.cross_reference_type(+) = 'NDC'
        AND msi.inventory_item_id = mcr2.inventory_item_id(+)
        AND mcr2.cross_reference_type(+) = 'NSN'
        AND msi.inventory_item_id = mcr3.inventory_item_id(+)
        AND mcr3.cross_reference_type(+) = 'NDA'
        AND msi.inventory_item_id = mcr4.inventory_item_id(+)
        AND mcr4.cross_reference_type(+) = 'FMCS'
        AND moq.organization_id = misi.organization_id(+)
        AND moq.inventory_item_id = misi.inventory_item_id(+)
        AND moq.subinventory_code = misi.secondary_inventory(+)
        AND (moq.subinventory_code IN ('SUBIN_A','SUBINV_B') OR (moq.subinventory_code IS NULL AND sinv.secondary_inventory_name IN ('SUBIN_A','SUBINV_B')))
        AND msi.organization_id = mp.organization_id
        AND msi.organization_id = sinv.organization_id
   GROUP BY hou.NAME,
            msi.segment1,
            mp.organization_code,
            decode(moq.subinventory_code,sinv.secondary_inventory_name,moq.subinventory_code,sinv.secondary_inventory_name),
            mil.concatenated_segments,
            mil.segment1,
            mil.segment2,
            mil.segment3,
            mil.segment4,
            mil.segment5,
            mil.segment6,
            mil.segment7,
            msi.description,
            msi.primary_uom_code,
            moq.lot_number,
            mln.expiration_date,
            cic.item_cost,
            msi.list_price_per_unit,
            mil.attribute1,
            fu1.user_name,
            fu2.user_name,
            msi.attribute1,
            msi.attribute2,
            msi.attribute3,
            TO_NUMBER (msi.attribute4),
            TO_NUMBER (msi.attribute5),
            TO_NUMBER (msi.attribute6),
            mcst.category_set_name,
            mc.concatenated_segments,
            mil.attribute2,
            mil.attribute3,
            mil.attribute4,
            element10.element_value,
            element20.element_value,
            element30.element_value,
            element40.element_value,
            element50.element_value,
            element60.element_value,
            element70.element_value,
            mln.attribute1,
            mc.segment1,
            mc.segment2,
            mc.segment3,
            mc.segment4,
            mcr1.cross_reference,
            mcr2.cross_reference,
            mcr3.cross_reference,
            mcr4.cross_reference,
            misi.min_minmax_quantity,
            misi.max_minmax_quantity,
            msi.min_minmax_quantity,
            msi.max_minmax_quantity,
            mln.attribute2,
            mln.attribute3,
            mln.attribute4,
            mln.attribute5,
            mln.attribute6,
            mln.attribute7,
            mln.attribute8,
            mln.attribute9,
            mln.attribute10,
            msi.organization_id,
            msi.inventory_item_id
   ORDER BY 4;

SUPPLIER QUERY


SUPPLIER QUERY
SELECT 
  aps.segment1 SUPPLIER_NUMBER,
  aps.vendor_name SUPPLIER_NAME,
  apss.city,apsc.first_name||' '||apsc.last_name AS
"ContactName",
  apsc.PHONE,
  apsc.FAX_AREA_CODE||'-'||apsc.FAX as "FAX NUMBER",
  APSC.EMAIL_ADDRESS EMAIL_ID
  FROM ap_suppliers aps,
  ap_supplier_sites_all apss,
  ap_supplier_contacts apsc
WHERE 1 = 1 AND aps.vendor_id = apss.vendor_id
 AND apss.vendor_site_id = apsc.vendor_site_id


*********************************************************
select
pov.vendor_id,
pov.vendor_name supplier,
pov.vendor_type_lookup_code,
sl.location_code shipto_location,
bl.location_code billto_location,
pov.customer_num,
pov.ship_via_lookup_code,
pov.fob_lookup_code,
rt.name terms,
pov.set_of_books_id,
pov.credit_status_lookup_code,
pov.credit_limit
from ra_terms rt,
hr_locations bl,
hr_locations sl,
po_vendors pov
where pov.vendor_name like ‘Abb%’
and   pov.ship_to_location_id=sl.location_id(+)
and   pov.bill_to_location_id=bl.location_id(+)
and   pov.terms_id=rt.term_id(+)
order by 1
/
select
pov.vendor_name Supplier,
povs.vendor_site_id,
povs.vendor_site_code Site,
povs.address_line1 A1ddress,
povs.address_line2 A2ddress,
povs.address_line3 A3ddress,
povs.city||’, ‘||
povs.state||’ ‘||
povs.zip A4ddress,
povs.ship_to_location_id,
povs.bill_to_location_id,
povs.ship_via_lookup_code,
povs.freight_terms_lookup_code,
povs.fob_lookup_code
from po_vendors pov,
po_vendor_sites povs
where pov.vendor_id=601
and   pov.vendor_id=povs.vendor_id
order by 1
/
Query to find Supplier contacts :
select
vc.vendor_contact_id,
vc.vendor_site_id,
vc.first_name,
vc.middle_name,
vc.last_name,
vc.prefix,
vc.title,
vc.mail_stop,
vc.area_code,
vc.phone,
vc.department,
vc.email_address,
vc.url,
vc.alt_area_code,
vc.alt_phone,
vc.fax_area_code,
vc.inactive_date,
vc.fax
from po_vendor_contacts vc
where vc.vendor_site_id=4556
order by 1

PO_AP LINK QUERIES (2-WAY, 3-WAY,4-WAY)


                                                                     
                                             
AP-PO Link Queries

-- VENDOR, PO AND INVOICE DETAILS (2 WAY MATCH)

SELECT DISTINCT
a.org_id "ORG ID", e.segment1 "VENDOR NUM",
e.vendor_name "SUPPLIER NAME",
UPPER (e.vendor_type_lookup_code) "VENDOR TYPE",
f.vendor_site_code "VENDOR SITE CODE", f.address_line1 "ADDRESS",
f.city "CITY", f.country "COUNTRY",
TO_CHAR (TRUNC (d.creation_date)) "PO DATE", d.segment1 "PO NUM",
d.type_lookup_code "PO TYPE", c.quantity_ordered "QTY ORDERED",
c.quantity_cancelled "QTY CANCELLED", g1.quantity_received, g1.quantity_rejected, g1.quantity_billed,
g.item_id "ITEM ID",
g.item_description "ITEM DESCRIPTION", g.unit_price "UNIT PRICE",
(NVL (c.quantity_ordered, 0) - NVL (c.quantity_cancelled, 0)
)
* NVL (g.unit_price, 0) "PO LINE AMOUNT",
(SELECT DECODE (ph.approved_flag, 'Y', 'Approved')
FROM po.po_headers_all ph
WHERE ph.po_header_id = d.po_header_id) "PO APPROVED?",
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT",
TO_CHAR (TRUNC (a.invoice_date)) "INVOICE DATE",
a.invoice_num "INVOICE NUMBER",
(SELECT DECODE (x.match_status_flag,
'A', 'Approved'
)
FROM ap.ap_invoice_distributions_all x
WHERE x.invoice_distribution_id = b.invoice_distribution_id)
"INVOICE APPROVED?",
a.amount_paid
FROM ap.ap_invoices_all a,
ap.ap_invoice_distributions_all b,
po.po_distributions_all c,
po.po_headers_all d,
ap.ap_suppliers e,
ap.ap_supplier_sites_all f,
po.po_lines_all g,
po.po_line_locations_all g1
WHERE a.invoice_id = b.invoice_id
AND b.po_distribution_id = c.po_distribution_id(+)
AND c.po_header_id = d.po_header_id(+)
AND e.vendor_id(+) = d.vendor_id
AND f.vendor_site_id(+) = d.vendor_site_id
AND d.po_header_id = g.po_header_id
AND g1.po_header_id = c.po_header_id
AND g1.po_line_id = g.po_line_id
AND c.po_line_id = g.po_line_id
AND c.line_location_id = g1.line_location_id
AND g1.inspection_required_flag = 'N'
AND g1.receipt_required_flag = 'N'

-- VENDOR, PO AND INVOICE DETAILS (3 WAY MATCH)

SELECT DISTINCT
a.org_id "ORG ID", e.segment1 "VENDOR NUM",
e.vendor_name "SUPPLIER NAME",
UPPER (e.vendor_type_lookup_code) "VENDOR TYPE",
f.vendor_site_code "VENDOR SITE CODE", f.address_line1 "ADDRESS",
f.city "CITY", f.country "COUNTRY",
TO_CHAR (TRUNC (d.creation_date)) "PO DATE", d.segment1 "PO NUM",
d.type_lookup_code "PO TYPE", c.quantity_ordered "QTY ORDERED",
c.quantity_cancelled "QTY CANCELLED", g1.quantity_received, g1.quantity_rejected, g1.quantity_billed,
g.item_id "ITEM ID",
g.item_description "ITEM DESCRIPTION", g.unit_price "UNIT PRICE",
(NVL (c.quantity_ordered, 0) - NVL (c.quantity_cancelled, 0)
)
* NVL (g.unit_price, 0) "PO LINE AMOUNT",
(SELECT DECODE (ph.approved_flag, 'Y', 'Approved')
FROM po.po_headers_all ph
WHERE ph.po_header_id = d.po_header_id) "PO APPROVED?",
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT",
TO_CHAR (TRUNC (a.invoice_date)) "INVOICE DATE",
a.invoice_num "INVOICE NUMBER",
(SELECT DECODE (x.match_status_flag,
'A', 'Approved'
)
FROM ap.ap_invoice_distributions_all x
WHERE x.invoice_distribution_id = b.invoice_distribution_id)
"INVOICE APPROVED?",
a.amount_paid
FROM ap.ap_invoices_all a,
ap.ap_invoice_distributions_all b,
po.po_distributions_all c,
po.po_headers_all d,
ap.ap_suppliers e,
ap.ap_supplier_sites_all f,
po.po_lines_all g,
po.po_line_locations_all g1
WHERE a.invoice_id = b.invoice_id
AND b.po_distribution_id = c.po_distribution_id(+)
AND c.po_header_id = d.po_header_id(+)
AND e.vendor_id(+) = d.vendor_id
AND f.vendor_site_id(+) = d.vendor_site_id
AND d.po_header_id = g.po_header_id
AND g1.po_header_id = c.po_header_id
AND g1.po_line_id = g.po_line_id
AND c.po_line_id = g.po_line_id
AND c.line_location_id = g1.line_location_id
AND g1.inspection_required_flag = 'N'
AND g1.receipt_required_flag = 'Y'

-- VENDOR, PO AND INVOICE DETAILS (4 WAY MATCH)

SELECT DISTINCT
a.org_id "ORG ID", e.segment1 "VENDOR NUM",
e.vendor_name "SUPPLIER NAME",
UPPER (e.vendor_type_lookup_code) "VENDOR TYPE",
f.vendor_site_code "VENDOR SITE CODE", f.address_line1 "ADDRESS",
f.city "CITY", f.country "COUNTRY",
TO_CHAR (TRUNC (d.creation_date)) "PO DATE", d.segment1 "PO NUM",
d.type_lookup_code "PO TYPE", c.quantity_ordered "QTY ORDERED",
c.quantity_cancelled "QTY CANCELLED", g1.quantity_received, g1.quantity_rejected, g1.quantity_billed,
g.item_id "ITEM ID",
g.item_description "ITEM DESCRIPTION", g.unit_price "UNIT PRICE",
(NVL (c.quantity_ordered, 0) - NVL (c.quantity_cancelled, 0)
)
* NVL (g.unit_price, 0) "PO LINE AMOUNT",
(SELECT DECODE (ph.approved_flag, 'Y', 'Approved')
FROM po.po_headers_all ph
WHERE ph.po_header_id = d.po_header_id) "PO APPROVED?",
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT",
TO_CHAR (TRUNC (a.invoice_date)) "INVOICE DATE",
a.invoice_num "INVOICE NUMBER",
(SELECT DECODE (x.match_status_flag,
'A', 'Approved'
)
FROM ap.ap_invoice_distributions_all x
WHERE x.invoice_distribution_id = b.invoice_distribution_id)
"INVOICE APPROVED?",
a.amount_paid
FROM ap.ap_invoices_all a,
ap.ap_invoice_distributions_all b,
po.po_distributions_all c,
po.po_headers_all d,
ap.ap_suppliers e,
ap.ap_supplier_sites_all f,
po.po_lines_all g,
po.po_line_locations_all g1
WHERE a.invoice_id = b.invoice_id
AND b.po_distribution_id = c.po_distribution_id(+)
AND c.po_header_id = d.po_header_id(+)
AND e.vendor_id(+) = d.vendor_id
AND f.vendor_site_id(+) = d.vendor_site_id
AND d.po_header_id = g.po_header_id
AND g1.po_header_id = c.po_header_id
AND g1.po_line_id = g.po_line_id
AND c.po_line_id = g.po_line_id
AND c.line_location_id = g1.line_location_id
AND g1.inspection_required_flag = 'Y'
AND g1.receipt_required_flag = 'Y'

-- VENDOR, PO, INVOICE AND PAYMENT DETAILS

SELECT DISTINCT a.org_id "ORG ID", e.segment1 "VENDOR NUMBER",
e.vendor_name "VENDOR NAME",
UPPER (e.vendor_type_lookup_code) "VENDOR TYPE",
f.vendor_site_code "VENDOR SITE CODE",
TO_CHAR (TRUNC (d.creation_date)) "PO DATE",
d.segment1 "PO NUM", d.type_lookup_code "PO TYPE",
c.quantity_ordered "QTY ORDERED",
c.quantity_cancelled "QTY CANCELLED",
g.item_description "ITEM DESCRIPTION",
g.unit_price "UNIT PRICE",
(NVL (c.quantity_ordered, 0) - NVL (c.quantity_cancelled, 0)
)
* NVL (g.unit_price, 0) "PO LINE AMOUNT",
(SELECT DECODE (ph.approved_flag,
'Y', 'Approved'
)
FROM po.po_headers_all ph
WHERE ph.po_header_id = d.po_header_id) "PO APPROVED?",
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT",
TO_CHAR (TRUNC (a.invoice_date)) "INVOICE DATE",
a.invoice_num "INVOICE NUMBER",
(SELECT DECODE (x.match_status_flag,
'A', 'Approved'
)
FROM ap.ap_invoice_distributions_all x
WHERE x.invoice_distribution_id = b.invoice_distribution_id)
"INVOICE APPROVED?",
a.amount_paid, h.check_id, i.check_number,
h.invoice_payment_id,
TO_CHAR (TRUNC (i.check_date)) "PAYMENT DATE"
FROM ap.ap_invoices_all a,
ap.ap_invoice_distributions_all b,
po.po_distributions_all c,
po.po_headers_all d,
ap.ap_suppliers e,
ap.ap_supplier_sites_all f,
po.po_lines_all g,
ap.ap_invoice_payments_all h,
ap.ap_checks_all i
WHERE a.invoice_id = b.invoice_id
AND b.po_distribution_id = c.po_distribution_id(+)
AND c.po_header_id = d.po_header_id(+)
AND e.vendor_id(+) = d.vendor_id
AND f.vendor_site_id(+) = d.vendor_site_id
AND d.po_header_id = g.po_header_id
AND c.po_line_id = g.po_line_id
AND a.invoice_id = h.invoice_id
AND h.check_id = i.check_id
AND c.po_header_id IS NOT NULL
AND a.payment_status_flag = 'Y'
AND d.type_lookup_code != 'BLANKET'
ORDER BY E.VENDOR_NAME

SQL * Loader


SQL * Loader :
==================
It is one of the Oracle Tool  will be used to transfer the data from Flat files into 
Oracle Base tables.
When we are developing the Interfaces or Conversion program in Oracle Applications 
then we will be using the SQL Loader Programs.

while working with SQL * Loader we will come across 5 Files.

1)Flat File OR data File:

Data file contains the data in the specific format which we will receive from the 
client. this file will be generated by the legacy system(Other Systems) program.
It may be either .txt format
   .dat
   .csv(Comma Separated View) Excell sheet.
Most of the times we will receive in the (.csv) format  

2)Control File : 
-----------------
Is nothing but a SQL*Loader Program will be used to load the data from file into table.
we will develop the control File
        Execute the Control File.
While developing the Control file we will specify follwoing things.
1)Data File path
2)Database Table Name
3)Column Mapping.
Control file Extension is (.ctl)

3)Bad File:
-----------
when we execute the COntrol file if any records are rejected by SQL *Loader then we
will find those rejecteds record in the Bad file.
SQl loader recjects the records if there are any datatype mismatch
              Internal Errors
       Data file Format problem
Bad File Extension is (.bad)

4)Discard File:
---------------
when we execute the COntrol file if any records are rejected by Control File then we
will find those rejecteds record in the Discard file.
Control file Recjects the record when the record is not satisfying the record which
are not satisfied the condition specified in the Control file.
Discard File Extension is (.dis)

5)Log File :
-------------

It contains the Log information like Program start time,End Time
No of succesfully records upload
Rejected Records into the Bad file
Rejected records into the Discard file
Any errors are there in the Control file those error message  details we will find.
Log file Extension is (.log)


Control File Syntax:
----------------------

LOAD DATA
INFILE 'Data File Path'
Insert into table <Table Name>
FIELDS TERMINATED by ',' OPTIONALLY ENCLOSED BY'"'
TRAILING NULLCOLS
(Column1    ,
 column2    ,
 column3    ,......)


Execution of Control File :
-----------------------------

Goto Command Prompt where the SQl loader is Installed.

D:Oracle\Proddb\8.1.7\bin\  SQLLDR  Username/Password@PROD
Control = Control file Path.

Request Set , Incompatibility and :$FLEX$ and :$PROFILES


Request Set:
============

Colection of Concurrent Programs which will be used to submit the Cnocurrent Programs
either sequentially or Paraalley multiple programs

It is also like Request group but in Requuest group we can submit only one program at
a time from SRS Window.
where as in Request set we can submit multiple programs at a time.

1)Select the Programs which we would like to group in the set
Ex:
Active Responsibilities
Active Users
Compile Reports
2)Open the Request Set form Select the button called Request set wizard and 
  enter the concurrent Program list.
Concurrent =>Set
3)Open the Request group Form attach the Request set by selecting the Type = Set
  and attach the Request set.
4)Goto the SRS Window select the Option called Request set instead of Single Request.

Incompatibility:
================
Incompatibility is nothing but not compatible with the current concurrent program
For Ex
If we have three program A B C 
If A program is running  in the server system should  not run the B and C programs
that time we wii define the Incompatibility 
While createion of the A Program 
Select the button called Incompatibility and enter the B and C Programs.

Run Alone Check box :if we would like to make the Program is not compatible with all
 other concurrent Program then we will check this check box.

Use in SRS Window: Be default this check box will be enabled we uncheck this we can
  find the Program at SRS window we have to submit from backend by using fnd_request 
  API.

Copy To button: While customizing the Concurrent Programs(Reports,Package.....) 
  we are suppose to create new concurrent Program with diff name then we will
  go for using the Copy To button.

note:  By default every concurrent Program will be executed in the CBO(Cost Based
    Optimizer) if we would like to execute in the RBO(Rule Bases Optimizer)mode then
    we will use the Session control buttion we will set the Rule Option.


:$FLEX$
:$PROFILES$

These two are Oracle apps reserved words will be used in the Value set creation 

:$FLEX$: This will be used to Retrieve the Previous parameter value whatever we have
   selected.

Syntax : :$FLEX$.Previous Parameter VAlue set Name.


For Ex:  We have two Parameters


      Supplier Name      :  Table Value set 
      Supplier Site Code :  Table VAlue set

based on the Suplier name we are suppose to get the Site codes in the Second parameter

SELECT VENDOR_NAME FROM PO_VENDORS  - First VAlue set

SELECT VENDOR_SITE_CODE FROM PO_vendor_sites_All   -Second Value Set
where  vendor_name = Whatever user has selected in the First PArameter
       (To get this value we will use :$FLEX$.Previous Value set name).

23SUPPLIER  - First Value set Name

23SITE
WHERE VENDOR_ID  IN(SELECT VENDOR_ID 
                    FROM    PO_VENDORS
                    WHERE VENDOR_NAME = :$FLEX$.23SUPPLIER)

:$PROFILES$: This will be used to Get the Profile value in the Table Value set or
    from the front end.

To get Profile values from backend we are using Fnd_Profile.Value or Fnd_Profile.get()


Syntax : :$PROFILES$.Profile Name

SELECT SEGMENT1 
FROM   PO_HEADERS_ALL

22USER  : 204
23USER  : 887
24USER  : 911

SELECT SEGMENT1
FROM PO_HEADER_ALL
WHERE ORG_ID = :$PROFILES$.ORG_ID

Ex: Display the PO's which are created by the current User

If 22user ope the LOV it has to display the PO's which are created by 22 user

SELECT SEGMENT1
FROM   PO_HEADERS_ALL
WHERE  CREATED_BY = :$PROFILES$.USER_ID





































Report Registration Steps:


Report Registration Steps:
-------------------
1)Develop the report (.rdf)as per client Requirement by using reports 6i Builder

2)Move the report from Local mechine into Server
    CUS_TOP\11.5.0\Reports\US\ .rdf
     PO_TOP\11.5.0\Reports\US\ .rdf
  
3)Select System Administrator and create EXECUTABLE  
      1)Executable Name
     2)ApplicationName
     3)Execution Method
     4)Report(.rdf) file Name
          
4)Create Concurrent Program and attach  1)EXECUTABLE
      2)PARAMETERS
     3)INCOMPATIBILITIES          
5)Create Request Group and attach  Concurrent Program

6)Create Responsibility    1)Request Group
       2)Data    Group
      3)Menu
7)Create user, attach Responsibility to the user.

8)User will select the Responsibility and goto SRS(Standard Request Submission) Window
  submit the Request.








Navigations:
============

Executable           = Concurrent=>Program=>Executable
Concurrent Program   = Concurrent=>Program=>Define
Request Group      = Security=>Responsibility=>Request
Responsibility       = Security=>responsibility=>Define
User       = Security=>User=>Define
SRS Window      = View Menu=>Request =>Submit New request=>Ok=>Select Program
                       =>Submit=>No=>Find=>View Output