Total Pageviews

Tuesday, 6 July 2021

Oracle APPS: AP : Query to get Document sequence Name and generate value

How to get document Sequence name


1) Write query to get db sequence name

SELECT seq.db_sequence_name

       -- INTO l_sequence_name

        FROM fnd_document_sequences seq, fnd_doc_sequence_assignments sa

       WHERE seq.doc_sequence_id = sa.doc_sequence_id

         AND sa.application_id = 200

         AND sa.category_code ='AP Invoice'-- :l_document_name

         AND (sa.method_code = 'A' )

         

2)  get sequence value using below query

    BEGIN

      l_query :=

           'select ' || l_sequence_name || '.nextval into :next_val from sys.dual';


      EXECUTE IMMEDIATE l_query

                   INTO l_doc_sequence_value;

    END;       

    

    return l_doc_sequence_value;

    


Friday, 2 July 2021

Oracle APPS : AP : Due Date Derivation Logic based on Payment Terms

 



1) Payment Terms


2) Special Calendars


Navigation:-  Below Screenshot

Table Name :-  AP_OTHER_PERIOD_TYPES, AP_OTHER_PERIODS


-------------------------------------Query--------------------------------------------

SELECT apt.NAME,atl.calendar, atl.fixed_date, atl.due_day_of_month, atl.due_days

  FROM ap_terms apt, ap_terms_lines atl

 WHERE apt.term_id = atl.term_id  

 AND apt.NAME in ('RTEST')



select * from  AP_OTHER_PERIOD_TYPES

where MODULE ='PAYMENT TERMS'

and period_type =:lv_payment_term



select due_date from  AP_OTHER_PERIODS

where MODULE ='PAYMENT TERMS'

and period_type =:lv_payment_term

and :p_invoice_date between start_date and end_date

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


Logic Explained to derive Due date based on Invoice Date and Payment Term






FUSION: Purchasing Query

  1) ---------CPA to PO Amount---------- select poh.segment1, (select sum(nvl(cpol.quantity,1)* cpol.unit_price) from po_headers_all cpoh,po...