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;

    


No comments:

Post a Comment

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...