Monday, 28 September 2015

Query for to find table name by using DFF name

SELECT ffv.descriptive_flexfield_name "DFF Name",
ffv.application_table_name "Table Name",
ffv.title "Title",
ap.application_name "Application",
ffc.descriptive_flex_context_code "Context Code",
ffc.descriptive_flex_context_name "Context Name",
ffc.description "Context Desc",
ffc.enabled_flag "Context Enable Flag",
att.column_seq_num "Segment Number",
att.form_left_prompt "Segment Name",
att.application_column_name "Column",
fvs.flex_value_set_name "Value Set",
att.display_flag "Displayed",
att.enabled_flag "Enabled",
att.required_flag "Required"
FROM apps.fnd_descriptive_flexs_vl ffv,
apps.fnd_descr_flex_contexts_vl ffc,
apps.fnd_descr_flex_col_usage_vl att,
apps.fnd_flex_value_sets fvs,
apps.fnd_application_vl ap
WHERE ffv.descriptive_flexfield_name = att.descriptive_flexfield_name
AND ap.application_id=ffv.application_id
AND ffv.descriptive_flexfield_name = ffc.descriptive_flexfield_name
AND ffv.application_id = ffc.application_id
AND ffc.descriptive_flex_context_code=att.descriptive_flex_context_code
AND fvs.flex_value_set_id=att.flex_value_set_id
AND ffv.title like 'PO Line Locations'
AND ffc.descriptive_flex_context_code like 'Central % Local Purchase'

Saturday, 26 September 2015

Query for supplier detials

SELECT   asp.vendor_id ,
asp.segment1 "Supplier Num" ,
asp.vendor_name "Supplier Name" ,
ass.vendor_site_code "site name" ,
hou.name "Operating Unit Name" ,
ass.address_line1 ,
ass.address_line2,
ass.city ,
ass.state ,
ass.zip ,
decode(ass.country,
              'IN',
              'India',
              ass.country) COUNTRY,
ass.phone ,
person.person_first_name ,
person.person_last_name ,
pty_rel.primary_phone_number,
jat.PAN_NO,
pty_rel.email_address,
hcp1.phone_country_code fax_country_code,
hcp1.phone_area_code fax_areacode, hcp1.phone_number fax
From
ap_suppliers asp   --5515
,ap_supplier_sites_all ass,
ap_supplier_contacts apsc
,hz_parties person
,hz_parties pty_rel
,hz_contact_points hcp1
,hr_operating_units hou
,JAI_AP_TDS_VENDOR_HDRS jat
Where
ass.vendor_id = asp.vendor_id
AND apsc.org_party_site_id(+) = ass.party_site_id
AND apsc.per_party_id = person.party_id(+)
AND apsc.rel_party_id = pty_rel.party_id(+)
AND ass.org_id = hou.organization_id
And ass.VENDOR_ID = jat.VENDOR_ID
AND ass.VENDOR_SITE_ID = jat.VENDOR_SITE_ID(+)
------------------------------------------
AND person.party_id = hcp1.owner_table_id(+)
AND hcp1.owner_table_name(+) = 'HZ_PARTIES'
AND hcp1.contact_point_type(+) = 'PHONE'
AND hcp1.phone_line_type(+) = 'FAX'
------------------------------------------------
AND asp.VENDOR_ID = nvl(:P_SUPPLIER_ID,asp.VENDOR_ID)
And asp.segment1  = nvl(:P_SUPLIER_NUM,asp.segment1)
And UPPER(ass.CITY)  = UPPER(nvl(:P_SULIER_SIT_NAME, ass.CITY))
And jat.PAN_NO   = nvl(:P_PAN_NUM,jat.PAN_NO)
Order by asp.segment1 desc

How to get password based on USER Name in oracle apps with databas.

SELECT usr.user_name,
       get_pwd.decrypt
          ((SELECT (SELECT get_pwd.decrypt
                              (fnd_web_sec.get_guest_username_pwd,
                               usertable.encrypted_foundation_password
                              )
                      FROM DUAL) AS apps_password
              FROM apps.fnd_user usertable
             WHERE usertable.user_name =
                      (SELECT SUBSTR
                                  (fnd_web_sec.get_guest_username_pwd,
                                   1,
                                     INSTR
                                          (fnd_web_sec.get_guest_username_pwd,
                                           '/'
                                          )
                                   - 1
                                  )
                         FROM DUAL)),
           usr.encrypted_user_password
          ) PASSWORD
  FROM apps.fnd_user usr
 WHERE usr.user_name ='M_REDDY';

Friday, 4 September 2015

concurrent program style for excel output in oracle apps

concurrent program out put Style : Landscape

Available to On hand/Transact/Reserve quantity API in oracle apps technical

Available to Transact/Reserve quantity API
Api  inv_quantity_tree_pub.query_quantities can be used in oracle applications to find Available to transact and reserve quantity. You can even find the available quantity by lots / subinventory.

Finding quantities by lots can be only achieved by setting the p_is_lot_control flag to TRUE along with lot_number else set it to FALSE.

DECLARE
   x_return_status         VARCHAR2 (50);
   x_msg_count             VARCHAR2 (50);
   x_msg_data              VARCHAR2 (50);
   l_item_id               NUMBER;
   l_organization_id       NUMBER;
   l_qty_on_hand           NUMBER;
   l_res_qty_on_hand       NUMBER;
   l_avail_to_tnsct        NUMBER;
   l_avail_to_reserve      NUMBER;
   l_qty_reserved          NUMBER;
   l_qty_suggested         NUMBER;
   l_lot_control_code      BOOLEAN;
   l_serial_control_code   BOOLEAN;
BEGIN
   -- Set the org context
    FND_GLOBAL.apps_initialize ( user_id => 1, resp_id => 64521, resp_appl_id => 401,security_group_id => 0);
   inv_quantity_tree_grp.clear_quantity_cache; -- Clear Quantity cache  
   -- Set the variable values
   l_item_id := 15141562;
   l_organization_id := 96;
   l_lot_control_code := FALSE;  --Only When Lot number is passed  TRUE else FALSE
   l_serial_control_code := FALSE;
   -- Call API
   inv_quantity_tree_pub.query_quantities
               (p_api_version_number       => 1.0
               ,p_init_msg_lst             => NULL
               ,x_return_status            => x_return_status
               ,x_msg_count                => x_msg_count
               ,x_msg_data                 => x_msg_data
               ,p_organization_id          => l_organization_id
               ,p_inventory_item_id        => l_item_id
               ,p_tree_mode                => apps.inv_quantity_tree_pub.g_transaction_mode
               ,p_is_revision_control      => FALSE
               ,p_is_lot_control           => l_lot_control_code-- is_lot_control,
               ,p_is_serial_control        => l_serial_control_code
               ,p_revision                 => NULL              -- p_revision,
               ,p_lot_number               => NULL              -- p_lot_number,
               ,p_lot_expiration_date      => SYSDATE
               ,p_subinventory_code        => NULL              -- p_subinventory_code,
               ,p_locator_id               => NULL              -- p_locator_id,
               --,p_cost_group_id            => NULL          
               --,p_onhand_source            => NULL
               ,x_qoh                      => l_qty_on_hand     -- Quantity on-hand
               ,x_rqoh                     => l_res_qty_on_hand --reservable quantity on-hand
               ,x_qr                       => l_qty_reserved
               ,x_qs                       => l_qty_suggested
               ,x_att                      => l_avail_to_tnsct  -- available to transact
               ,x_atr                      => l_avail_to_reserve-- available to reserve
               );
   DBMS_OUTPUT.put_line ('On-Hand Quantity: ' || l_qty_on_hand);
   DBMS_OUTPUT.put_line ('Quantity Reserved: ' || l_qty_reserved);
   DBMS_OUTPUT.put_line ('Quantity Suggested: ' || l_qty_suggested);
   DBMS_OUTPUT.put_line ('Available to Transact: ' || l_avail_to_tnsct);
   DBMS_OUTPUT.put_line ('Available to Reserve: ' || l_avail_to_reserve);
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line ('ERROR: ' || SQLERRM);
END;