Thursday, July 28, 2022

Query to get Supplier Site Details(Payment Method, Term) details in Oracle APPS

SELECT assa.vendor_id
      ,asa.vendor_name 
      ,assa.vendor_site_code
      ,asa.segment1 vendor_number
      ,assa.vendor_site_id
      ,assa.address_line1
      ,assa.address_line2
      ,assa.city
      ,assa.state
      ,assa.zip postal_code
      ,assa.country
      ,asa.vat_registration_num
      ,asa.vendor_type_lookup_code vendor_type
      ,decode(nvl(assa.hold_unmatched_invoices_flag, 'N'), 'Y', 'PO', 'NONPO') invoice_type
      ,asa.invoice_currency_code currency_code
      ,assa.org_id
      ,hou.name operating_unit
      ,assa.vendor_site_code 
      ,gcc.segment1 || '.' || gcc.segment2 || '.' || gcc.segment3 || '.' || gcc.segment4 || '.' || gcc.segment5 || '.' || gcc.segment6 liability_account
      ,apt.name term_name
      ,ipmb.payment_method_code
  FROM fnd_lookup_values       lv
      ,iby_payment_methods_b   ipmb
      ,iby_ext_party_pmt_mthds epm
      ,hr_organization_units   hou
      ,iby_external_payees_all iepa
      ,ap_terms                apt
      ,gl_code_combinations    gcc
      ,ap_supplier_sites_all   assa
      ,ap_suppliers            asa
 WHERE lv.attribute2(+) = 'Y'
   AND lv.lookup_code(+) = assa.pay_group_lookup_code
   AND ipmb.payment_method_code(+) = epm.payment_method_code
   AND NVL(epm.primary_flag, 'Y') = 'Y' -- this is the current/active version.  when you make a change, object_version_number changes and old record primary_flag will change to N
   AND iepa.supplier_site_id = assa.vendor_site_id
   AND epm.ext_pmt_party_id (+) = iepa.ext_payee_id
   AND iepa.payee_party_id = asa.party_id
   AND apt.term_id = assa.terms_id
   AND gcc.code_combination_id = assa.accts_pay_code_combination_id
   AND assa.vendor_id = asa.vendor_id
   AND assa.org_id = hou.organization_id
   -- Supplier and Site Validations
   AND nvl(assa.inactive_date, SYSDATE + 1) >= TRUNC(SYSDATE)  -- site must be active
   AND nvl(asa.end_date_active, SYSDATE + 1) >= TRUNC(SYSDATE) -- supplier must be active
   AND asa.vendor_type_lookup_code = 'VENDOR'

Query to get Element Advance Salary in Oracle APPS HRMS

SELECT papf.employee_number
      ,prrv.result_value
  FROM pay_run_results prr
  ,pay_element_types_f petf
  ,pay_run_result_values prrv
  ,pay_input_values_f piv
  ,pay_assignment_actions paa
  ,pay_payroll_actions ppa
  ,per_all_assignments_f paaf
  ,per_all_people_f papf
 WHERE prr.element_type_id = petf.element_type_id
   AND prr.run_result_id = prrv.run_result_id
   AND prrv.input_value_id = piv.input_value_id
   AND prr.assignment_action_id = paa.assignment_action_id
   AND paaf.assignment_id = paa.assignment_id
   AND paaf.business_group_id = fnd_profile.value('PER_BUSINESS_GROUP_ID')
   and paaf.person_id= papf.person_id
   AND papf.business_group_id = fnd_profile.value('PER_BUSINESS_GROUP_ID')
   AND upper(petf.element_name) = 'ADVANCE SALARY'
   AND piv.name = 'Pay Value' 
   AND SYSDATE BETWEEN piv.effective_start_date AND  piv.effective_end_date
   AND SYSDATE BETWEEN petf.effective_start_date AND  petf.effective_end_date
   AND SYSDATE BETWEEN paaf.effective_start_date AND  paaf.effective_end_date
   AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
   AND ppa.payroll_action_id = paa.payroll_action_id                         
   AND ppa.action_type IN ('Q', 'R')
   AND ppa.effective_date = '31-JUL-2022'
   AND prrv.result_value > '0'

Friday, July 22, 2022

AP_INVOICE_LINES_ALL.LINE_SOURCE in Oracle APPS

LINE_SOURCE --> Source of the invoice line. Validated against AP_LOOKUP_CODES.LOOKUP_CODE for LOOKUP_TYPE as LINE SOURCE
 
SELECT *
  FROM ap_lookup_codes
 WHERE lookup_type = 'LINE SOURCE'

AP_INVOICE_LINES_ALL.LINE_TYPE_LOOKUP_CODE(INVOICE LINE TYPE) in Oracle APPS

LINE_TYPE_LOOKUP_CODE --> Type of invoice line. Possible values for this column are derived from FND_LOOKUP_VALUES for lookup_type 'INVOICE LINE TYPE'.
 
SELECT *
  FROM fnd_lookup_values
 WHERE lookup_type = 'INVOICE LINE TYPE'
    AND language = USERENV('LANG')

Sunday, July 10, 2022

Balance Type (Year to Date, Project to Date, Period to Date and Quarter to Date)in Oracle General Ledger

SELECT lookup_code, meaning, description, REPLACE(description, '-', ' ') balance_type
  FROM fnd_lookup_values
 WHERE 1 = 1 
    AND lookup_type = 'PTD_YTD'
    AND language = USERENV('LANG')


Thursday, July 7, 2022

API to get the Segment Delimiter for the specified (KFF)Key Flex Field Structure using FND_FLEX_EXT.GET_DELIMITER in Oracle APPS

DECLARE
  l_application_short_name VARCHAR2(50);--fnd_application.application_short_name
  l_key_flex_code          VARCHAR2(200);
  l_structure_number       NUMBER; -- gl_ledgers.chart_of_accounts_id
  l_segment_delimiter      VARCHAR2(10);
BEGIN
l_application_short_name := 'SQLGL';
l_key_flex_code          := 'GL#';
l_structure_number       := 51234;

l_segment_delimiter := fnd_flex_ext.get_delimiter
                    (
                      application_short_name => l_application_short_name
                     ,key_flex_code          => l_key_flex_code
                     ,structure_number       => l_structure_number
                    ); 

DBMS_OUTPUT.PUT_LINE('l_segment_delimiter = ' || l_segment_delimiter);
END;

Tuesday, July 5, 2022

Set Oracle Report(rdf) Concurrent Program ends with Warning Status

Create a user parameter as P_CONC_REQUEST_ID as shown in below screenshot.


In before report trigger initialize using user exists as shown in below screenshot.


Below is our requirement:

We have two optional parameters Account and Parent Account. User has to select either of the one parameter. If user selects both Parameters then the report output will be blank. So we are completing program with Warning status so that user can go review the log file.



As shown in above screenshot write srw.message to see the message in log file.



Sunday, July 3, 2022

Query to get Legal Entity Name in Oracle Apps

SELECT hou.name operating_unit_name
      ,xep.name legal_entity_name
  FROM hr_operating_units hou
      ,xle_entity_profiles xep
 WHERE hou.default_legal_context_id = xep.legal_entity_id

Friday, July 1, 2022

AP_SUPPLIER_SITES_ALL.PAY_GROUP_LOOKUP_CODE or PO_VENDOR_SITES_ALL.PAY_GROUP_LOOKUP_CODE in Oracle APPS

SELECT *
  FROM apps.fnd_lookup_values flv
 WHERE     flv.lookup_type = 'PAY GROUP'
       AND flv.LANGUAGE = USERENV ('LANG')
       AND flv.enabled_flag = 'Y'
       AND SYSDATE BETWEEN NVL (flv.START_DATE_ACTIVE, SYSDATE)
                       AND NVL (flv.END_DATE_ACTIVE, SYSDATE)

LOOKUP_CODE will be AP_SUPPLIER_SITES_ALL.PAY_GROUP_LOOKUP_CODE or PO_VENDOR_SITES_ALL.PAY_GROUP_LOOKUP_CODE

Query To Fetch AP Invoice Details From SO Number(Doc ID 2949013.1)

SELECT dh.source_order_number       ,df.source_line_number as so_line_number   ,df.fulfill_line_number    ,ddr.doc_user_key as po_number...