Protected by Copyscape Web Copyright Protection Software

Pages

Search This Blog

Thursday, September 13, 2012

P2P(Procure-to-Pay) Cycle Tables with Joins



Pre Requisites for Purchase Order:

1.Item Creation:

2.Supplier Creation:

3.Buyer Creation:

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

1.Item Creation:

1)Attach the Responsibility called "Inventory Vision Operations (USA)"
2)Open the Items form
  Items=>Master Item
3)Select the Organization name - Vision Operations
4)Enter the Item Name , Item Description 
  goto Inventory tab check the checkbox called Inventory 
  goto purchasing tab check the check box called Purchasing
5)Save
6)Goto  Tools Menu => Organization Assignment option to assign for the multiple
  organizations.

SELECT * FROM MTL_SYSTEM_ITEMS_B WHERE SEGMENT1='APACHE'  --INVENTORY_ITEM_ID=20817


2.Supplier Creation:

1)Attach the Responsibility called "Purchasing Vision Operations (USA)"
2)Goto the Supplier Form
  Supply Base=>Suppliers
3)Enter the Supplier Name . Save supplier number will be created automatically.
4)Select the Sites button enter the supplier site address and other details
5)Goto the Contacts tab enter the Contact details 
    Name
    Phno
    Postion and so on.....





SELECT * FROM PO_VENDORS WHERE SEGMENT1='20067' --VENDOR_ID=7930

SELECT * FROM PO_VENDOR_SITES_ALL WHERE VENDOR_ID=7930 --VENDOR_SITE_ID IN (4638,4639)

SELECT * FROM PO_VENDOR_CONTACTS WHERE VENDOR_SITE_ID IN (4638,4639)


3.Buyer Creation:


Buyer Creation:
==================

1)attach the Responsibility called "US HRMS Manager"
2)Create Employee  
  People => Enter and Maintain=>Select New button
3)Enter Emp name 
  select action option select "create Employement" select the optiona s "Buyer"
4)enter Data of Birth 
  save => Ok  = > Empoyee number will be generated.
5)Goto  System Administrator open the User form create or query user
  select the Person field attach the emp name (Which we have created)
6)Save.
7)Goto Purchasing Responsibility 
  open the Buyers form 
  enter the employee name and save the transactions.
 Setup => Personnal =>Buyers


SELECT * FROM PER_ALL_PEOPLE_F --WHERE --PERSON_ID='25'--EMPLOYEE_NUMBER='1289' --PERSON_ID=13496


Purchase Order Flow:

1.Requisition
2.RFQ(Request for Quatation)

1.REQUISITION:

Requisition: is one of the purchasing document will be prepared by the employee when
   ever he required the materials or Services or Training and so on.
we have two types of Requisitions 1)Internal
                    2)Purchase

Internal requisition will be created if materials are receiving from another Inventory
inside of the organization.
Purchase requisition will be created while purchasing the materials from the Suppliers.

Requisitions=>Requisitions

We will enter the Requisition at three level 1)Header
                        2)Line
                        3)Distributions.

Open the Requisition form enter the Reqno and select the type at Header level
 Enter the Items information at line level like Item name,qty,unitprice,tax and so on
select Distributions button enter the Distributions details.
Save
Select the Button called Approve button to go for approving the Requisition Document
Open the Requisition summary form.
Enter the Reqno select find button we can find the Requisition status wether it is
approved or not.
select Tools menu => View Action History to find the history details
Select Tools Menu  =>Control option to Cancel the requisition.


SELECT * FROM PO_REQUISITION_HEADERS_ALL WHERE SEGMENT1='5716' --REQUISITION_HEADER_ID=56885

SELECT * FROM PO_REQUISITION_LINES_ALL WHERE REQUISITION_HEADER_ID=56885  --REQUISITION_LINE_ID=60797

SELECT * FROM PO_REQ_DISTRIBUTIONS_ALL WHERE REQUISITION_LINE_ID=60797

2.RFQ(REQUEST FOR QUOTATION)



Once the Requisition is Approved Buyer will prepare thre RFQ document which will be
delivered to the supplier. Supplier will respond for that with quotation.
we have Three types of RFQ documents

BID RFQ:This will be prepared for the secific fixed quantity and there won't be any
        PriceBraeaks(Discounts).

catalog RFQ: This will be create for te materials which we will purchase from the
        suppliers regularley , and large number of quantity. Here we can specify the
        Price Breaks.

Standard RFQ:  This will be prepared for the Items which we will purchase only once
        not very often,Here we can include the Discounts information at different
        auantity levels.
RFQ Information will be entered at 3 Level
  1)Headers
  2)Lines
  3)Price Breaks(CATALOG,STANDARD) or Shippments (Only for Bid RFQ)

Terms And Conditions:
While creation of the RFQ documents we will select the Terms button and we will enter
the terms abd condition details.

Payment Terms: When Organization is going to make the payment and Interest rates
Fright  Terms: Who is going to Bear the Tansportation chargers wether Buyer or Supplier
FOB(FreeOnBoard): If any materials damage or any missing quantity is there then the
             the responsiboility of those materials.
Carrier     : In which Transportation Company Organization Required Materials
              Transportation company Name.

Open the RFQ Form

RFQ and Quotations=>RFQ's
select TYpe and Dates and so on
enter the Items details at line level
select terms button enter the Terms and Condition Details
Select the Price Braks button enter the Price break details
Save
Select the suppliers button enter the suplier details (Who are receiving this Document)
Select the Button called Add from List to Include the supplier list automatically.


SELECT * FROM PO_HEADERS_ALL WHERE SEGMENT1='347' AND TYPE_LOOKUP_CODE='RFQ' --PO_HEADER_ID=32876

SELECT * FROM PO_LINES_ALL WHERE PO_HEADER_ID=32876 -- PO_LINE_ID=38063

SELECT * FROM PO_LINE_LOCATIONS_ALL WHERE PO_LINE_ID=38063 --LINE_LOCATION_ID=72425

3.QUOTATION:



Quotation is another purchasing document we will receive from the Supplier which
contains the supplier quote details , Price, Payment terms and so on.

Whatever the quotations we have received from the supplier we will enter in the system
through form.

We have three types of Quotations 1)Bid 2)Catalog 3)Standard

For Bid RFQ      we will  receive Bid      quotation from the Supplier
For Catalog RFQ  we will  receive Catalog  quotation from the Supplier
For Standard RFQ we will  receive Standard quotation from the Supplier.

After enter all the quotations in the system management will do quote analysis as per
that one best quotation will be elected as Purchase Order.

Quotation Report

Item Name   (Table Value set MTL_SYSTEM_ITEMS_B   Segment1)

QuoteNo Type  Cdate Supplier Site ContactPerson Buyer   Created(UserName)

4.PURCHASE ORDER:

PO is one of the Main document which will be prepared and approved by the buyer and
send it to the supplier. which contains the following information
terms and Conditions
Items deails
Qty,Price
Distiribution and Shipment Details and so on.

We have four types of Purchase Order       1)STANDARD
     2)PLANNED
     3)BLANKET
     4)CONTRACT

Purchase Orders=> Purchase Orders
Open the PO form enter the Inforamtion at header level select line level inforamtion
enter the items and quantity,price details
select shippments button enter the shippment details select the Distributions button
enter the Distribution Detauils.
Save
Select the Button called Approve (Uncheck Email Check Box) , Document will be submitted
for approval.
open the Purchase Order summary form  enter PO number Select Find button we can find
the status of the Purchase order.
Goto Tools menu
Action History => We can find who hs submitted for Approve /Reject /Cancel details
Copy Document  => To Create Another PO based on this PO
Control        => To Close the Purchase Order or to cancel the Purchase Order.


Types of Purchase Order: -


Standard P.O
Planned P.O
Blanket P.O
ContractP.O
Terms and Conditions
Goods or Service Known
Pricing Known
Quantity known
Account Distributions Known
Delivery Schedule Known
Can be Encumbered
Can Encumber releases
Yes
Yes
Yes
Yes
Yes
Yes
Yes
N/A

Yes
Yes
Yes
Yes
Yes
May be
Yes
Yes

Yes
Yes
May be
No
No
No
No
Yes

Yes
No
No
No
No
No
No
N/A





SELECT * FROM PO_HEADERS_ALL WHERE SEGMENT1='4514' AND TYPE_LOOKUP_CODE='STANDARD' --PO_HEADER_ID =32878
 --TYPE_LOOKUP_CODE

SELECT * FROM PO_LINES_ALL WHERE PO_HEADER_ID =32879 --PO_LINE_ID=38065

SELECT * FROM PO_LINE_LOCATIONS_ALL WHERE PO_LINE_ID=38066 --LINE_LOCATION_ID=72427

SELECT * FROM PO_DISTRIBUTIONS_ALL WHERE LINE_LOCATION_ID=72428

SELECT * FROM PO_LOOKUP_CODES --LOOKUP_CODE

AUTO CREATE:


It is one of the Purchasing feature to create the RFQ and  PO documents automatically
by using requisition lines.

1)Create Requisition and approve
2)Open the AutoCreate form
3)Select Clear button enter the RequisitionNO
4)Select find button which will shows all the requisition lines
  select the lines whatever we want to include into the RFQ
5)select Action = Create to create new RFQ
  AddTo  to add lines to exisiting to RFQ
6)Select DocumentType = RFQ  
7)select Automatic button which will create RFQ document automatically .

5.RECEIPTS:



           Receipts are one of the documents it will be used to find out how much quantity Supplier has supplied. We will find out Purchase Order status if it is successfully approved then we will create the Receipt. We will give the PO Number select Findbutton check the PO lines right mark and save. It will create the Receipt number select Header button it will shows the receipt number and date.           
                                                                                                                                                               SELECT * FROM RCV_SHIPMENT_HEADERS WHERE RECEIPT_NUM=7472 --SHIPMENT_HEADER_ID=61421


SELECT * FROM RCV_SHIPMENT_LINES WHERE SHIPMENT_HEADER_ID=61421 -- SHIPMENT_LINE_ID=68368

SELECT * FROM RCV_TRANSACTIONS WHERE SHIPMENT_HEADER_ID=61421

Once Receipt will created go Inventory module and check whether the requested items are received or not by using these tables.

SELECT * FROM MTL_SYSTEM_ITEMS_B WHERE SEGMENT1='APACHE'

SELECT * FROM MTL_ONHAND_QUANTITIES WHERE INVENTORY_ITEM_ID=20817 AND ORGANIZATION_ID=204

SELECT SEGMENT1 FROM PO_HEADERS_ALL WHERE PO_HEADER_ID=32881 AND TYPE_LOOKUP_CODE='STANDARD'


Match Approval Level :- While creating the Purchase Order we will mention the Match Approval Level at Shipments we will have 3 types they are

2-way:- Purchase Order and Invoice Quantities must match within tolerance before the corresponding invoice can be paid.
3-way:- Purchase Order, Receipts and Invoice Quantities must match with in tolerance before the corresponding invoice can be paid.
4-way:- Purchase Order, Receipts, Inspection and Invoice Quantities must match with in tolerance before the corresponding invoice can be paid.



Account Payables (A.P) Module:-
           Account payables will be used to do the payment transactions. A.P Module is integrated with both P.O and G.L Modules. In Account Payables we will create the invoices and we will approve once invoice is approved successfully we will make the payment. Once payment is over we will move the transactions from A.P to G.l.

1.  Without supplier we cannot create Invoice.
2.  Without invoice we cannot make Payment.                                      

From the company point of view a person or Organization who is going to receive amount we will call as Supplier.

Types of Invoices:-

1.     Standard
2.     Credit Memo
3.     Debit Memo
4.     With Holding Tax                                                                                   
5.     Po Default
6.     Mixed
7.     Pre Payment
8.     Expense Report
9.     Recurring Invoices
10.  Quick Match                                                                                

Standard Invoice:-    We will create the Standard Invoice to particular Supplier and Supplier site we will enter the invoice amount, invoice date and soon……..

Credit Memo & Debit Memo Invoices:- Both Invoices has got negative (-ve) amount and adjusted against Standard Invoice. Credit Memo will be created whenever Supplier is giving discount. Debit Memo will be created if buyer is going to deduct the amount.

With Holding Tax Invoice:-      If supplier is not registered supplier then buyer will make the Income Tax to the government on behalf of supplier.

Po Default Invoice:-    Here we will create the Invoice as per Purchase Order amount. We will give the Po number system will retrieve PO amount and Invoice will be created as per PO details.

Prepayment Invoice:-    When ever we want make payment to supplier in advance that tome we will create this Prepayment Invoice and we make the Payment.

Expense Reports Invoice:-     It will be created for employee expenses as per the employee grade, position this Invoices will be calculated.

Recurring Invoice:-      For some of the Invoices we will not be having supplier invoice that time we will create Recurring Invoices.

Ex:-  For rent account we will be creating Invoice which has got fixed amount and fixed rate (duration).
 Quick Match Invoice:- While creating Purchase Order we will be giving the match approval option as per that match approval we will create the Invoice and the Invoice type is Quick Match Invoice.

Mixed Invoice:- Mixed Invoices will be created for miscellaneous expenses. Once we create the invoice you have to do following 3 activities.
1.     Validate Invoice
2.     Approve the Invoice
3.     Create Accounting entries for Invoice 
 INVOICES
Here we will select the Invoice type and we will give the Supplier number, name, site invoice date, invoice number, invoice currencies, and amount. Select Distributions button to distribute the Invoice amount into different accounts.

1.     Invoice total should be equal to the distributions total then we will call it as Invoice validated successfully.
2.     Select Actions…1 button chooses approve check box press OK then system will approve the Invoice.
3.     Select Actions…1 button choose create accounting check box press OK button it will create the accounting entries we can see all this accounting transactions from tools view accounting option.



SELECT * FROM AP_INVOICES_ALL WHERE INVOICE_NUM='INV4516'  --INVOICE_ID=63379 ,--VENDOR_ID(LINK B/WAP INVOICE AND PO_VENDORS
)
SELECT * FROM AP_INVOICE_DISTRIBUTIONS_ALL WHERE INVOICE_ID=63379


Invoice Holds:-    If invoice is not approved then that invoice will be keeping under hold status. By selecting holds button in invoice form we can see the holds details.

For view Invoice holds details:
           Select * from ap_holds_all
For view release the Invoice holds names:
           Select * from ap_holds_release_name_v;

PAYMENTS:
Payments:-     Once the Invoice is approved then we can go for payments. The Payments are or 3 types. They were

1.     Manual
2.     Quick
3.     Refund

Manual:-    Here we will issue the checks manually to the supplier and we will capture that information in the payment scheme by using manual payment option.

Quick:-     Through the Quick Payment type we can generate checks through the system and we can have the transactions directly in the system.

Refund:-   When ever company is going to give advance back to the customer that time we will select payment type as Refund.
Navigation steps for Payments:-
                 payments  ==> payments
For view list of payments:
           Select * from ap_invoice_payments_all;
           Select * from ap_payment_schedules_all;
For check’s information:
           Select * from ap_checks_all;
For check format:
           Select * from ap_check_formats;
           Select * from ap_checkrun_conc_processes_all;


Distribution Set:-     It is one of the option is available in Invoices Screen. While creating the Invoice we will attach distribution set. System will automatically create the transactions in distributions forms as per the distribution set.
 Navigation:




 set-up =>invoice=> distribution set

To view Distribution sets at header level:
           Select * from ap_distribution_sets_all;
To view Distribution sets at lines level:
           Select * from ap_distribution_set_lines_all;

Transferring Transactions from AP to GL:-
           We will execute the concurrent program from SRS Window. This program will transfer all the payment transactions into the G.L Module. It will take following parameters.

Program Name:-   Payables Transfer to General Ledger
Parameters:-
           Set of Books Name
           Transfer Reporting Book(s)
           From Date
           To Date
           Journal Category
Validate Accounts
Transfer To GL Interface
Submit Journal Import :  yes  (It should be always YES)
To view from AP to GL:

           Select * from gl_interface;

To view journal import details:

           Select * from gl_je_headers  à       for Headers
           Select * from gl_je_lines      à       for Lines
           Select * from gl_je_batches  à       for Batches

To view posting:
          
           Select * from gl_balances;
          
           After submitting the request select viewà output button. It will shows number of transactions has been transferred to G.L. then select G.L Module (General Ledger, Vision Operations (USA)).




SELECT * FROM GL_JE_HEADERS

SELECT * FROM GL_JE_LINES

SELECT * FROM GL_JE_BATCHES

SELECT * FROM GL_BALANCES

FlexSQL,FlexID Code in Reports


QUERY:-

SELECT AI.INVOICE_NUM,
               AID.DISTRIBUTION_LINE_NUMBER,
               &SELECT_ALL    FLEX_DATA
  FROM AP_INVOICES_ALL AI,
              AP_INVOICE_DISTRIBUTIONS_ALL AID,
              GL_CODE_COMBINATIONS  GCC
 WHERE AI.INVOICE_ID=AID.INVOICE_ID
     AND  GCC.CODE_COMBINATION_ID=AID.DIST_CODE_COMBINATION_ID
     AND AI.ORG_ID=:P_ORG_ID

WE HAD WRITTEN ONE LEXICAL PARAMETER AS &SELECT_ALL (IT IS NOTHING BUT PLACE HOLDER COLUMN(REPORT LEVEL)  AND IT CONTAINS SEGMENTS STRUCTURE AND DATATYPE AS CHAR AND  INITIAL VALUE AS -->VALUE IF NULL-->GCC.SEGMENT1) ).

NOW PLACE TWO FORMULA COLUMNS .... ONE FOR FLEX DATA AND ONE FOR FLEX DESC WHICH SHUD BE IN GROUP LEVEL BY USING FLEXIDVAL USEREXITS....

NOW WE WANT TO DISPLAY STRUCTURE  BY USING FNDFLEXSQL ... FOR DISPLAYING THE STRUCTURE WE SHUD WRITE CODE IN " BEFORE REPORT TRIGGER" WHICH IS SHOWN BELOW..................

BEFORE THIS WE SHUD CREATE TWO USER PARAMETERS i.e P_COA_ID AND P_CONC_REQUEST_ID...............

--FND FLEXSQL
--------------
BEGIN
SRW.USER_EXIT('FND SRWINIT');                               }
SRW.USER_EXIT('FND FLEXSQL                                  }
                             CODE="GL#"                              }-- THIS WE SHUD WRITE IN " BEFORE
                                                                                                  REPORT TRIGGER                      
                             NUM=":P_COA_ID"                      }-- THIS IS FOR DISPLAYING STRUCTURE AND RETRIVE THE DATA FROM DATABASE
         APPL_SHORT_NAME="SQLGL"
                       OUTPUT=":SELECT_ALL"
                TABLE_ALIAS="GCC"
                          MODE="SELECT"
                       DISPLAY="ALL" ');
RETURN(TRUE);
END;
------------------------------------------------------------------------------------------------------------
NOW WE WANT TO DISPLAY THE DATA WHICH IS PRESENT IN THE STRUCTURE .... FOR THAT WE USE  " FLEXID"

FOR THAT  PLACE TWO FORMULA COLUMNS IN GROUP LEVEL AND NAME IT  AS "CF_FLEXDATA" AND  "CF_FLEXDESC"

DATATYPE -- CHAR
WIDTH --1000
--FND FLEXID
-------------
"CF_FLEXDATA--->"

  SRW.USER_EXIT('FND FLEXIDVAL                                                    ---OBUL
                 CODE="GL#"
                 NUM=":P_COA_ID"
                 APPL_SHORT_NAME="SQLGL"
                 DATA=":FLEXDATA"
                 VALUE=":CF_DATA"
                 DISPLAY="ALL"
                 IDISPLAY="ALL" ');
              RETURN(:CF_DATA);                }
                                                         }    -- THIS WE SHUD WRITE IN FORMAULA COLUMN WHICH NAMED AS :CF_FLEXDATA
                                                         }
                                                         }
                       
                                          -- THESE TWO FOR DISPLAY DATA WICH IS PRESENT IN DAT FLEXSQL

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

"CF_FLEXDESC"--->

    SRW.USER_EXIT('FND FLEXIDVAL                                              ---OBUL
                 CODE="GL#"
                 NUM=":P_COA_ID"
                 APPL_SHORT_NAME="SQLGL"
                 DATA=":FLEXDATA"
                 DESCRIPTION=":CF_DESC"
                 DISPLAY="ALL"
                 IDISPLAY="ALL" ');                                       }
                                                                                 }
                                                                                 }-- THIS IS ALSO WE SHUD WRITE IN FORMULA COLUMN WHICH NAMED AS :CF_FLEXDESC
                                                                               
               
         
                               

------ THESE 2 FORMULA COLUMNS WE SHUD TAKE IN GROUP LEVEL

for finding the CODE="GL#" -- GO TO APPLICATION DEVELOPER RESP---> FLEXFIELD-->REGISTER-->QUERY-->General Ledger



NOW AS USUAL WE REGISTER IT IN APPS.......

FOR DISPLAYING CHART_OF_ACCOUNTS_ID DYNAMICALLY WE SHUD USE DEFAULT TYPE AS SQL FRO P_COA_ID PARAMETER AND IN DEFAULT VALUE WRITE BELOW CODE...

SELECT CHART_OF_ACCOUNTS_ID FROM GL_SETS_OF_BO0OKS WHERE SET_OF_BOOKS_ID=:$PROFILES$.GL_SET_OF_BKS_ID

Nested Sub-Queries


A query with in a Sub-Query is nothing but Nested Sub Query.
Syntax:-
SQL>Select ,  … from  where  (select  from 
where
(select from
where
));
Example:-
Display the Manager of ‘TURNER’ and display the ‘MANAGER’ of ‘TURNER’ manager.
SQL> select *from EMP where empno in (select mgr from EMP where empno in (select mgr from EMP where ename ='TURNER'));
 

Query for display the total no.of employees and year wise total no.of employees joined in to company

select count(*),count(decode(to_char(hiredate,'yyyy'),'1981',ename))"1981"
                ,count(decode(to_char(hiredate,'yyyy'),'1982',empno)) "1982"
                ,count(decode(to_char(hiredate,'yyyy'),'1983',empno)) "1983" from jagan;

Query for display the first two highest salaries in dept wise

select  deptno,sal,ename from emp e
where 2>(select count(d.sal) from emp d where e.deptno=d.deptno and e.sal<d.sal) order by 1,3 desc