SQL to get  Accounted PO (Encumbered) and AP (encumbr liquidated) in R12

Hi,
Can anyone help with the query that can be used to get the PO amt and the AP (invoice) amt that have been posted in GL.
For 11i, I used the below query. Since the line for PO had the invoice against which it was matched things were simple. Not sure how to achieve the same in R12.
11i query for reference
SELECT gl.reference_4 po_number,
gl.code_combination_id ccid,
gl.creation_date,
gl.effective_date je_date,
DECODE (je_source,'Payables',gl.reference_5,'') invoice_number,
DECODE (je_source,'Purchasing',NVL(gl.accounted_dr,0)- NVL(gl.accounted_cr,0)) po_amt,
DECODE (je_source,'Payables', NVL(gl.accounted_dr,0) - NVL(gl.accounted_cr,0)) liq_amt,
NVL(gl.accounted_dr,0) - NVL(gl.accounted_cr,0) po_balance,
FROM gl_je_lines gl,
gl_je_headers je,
po_headers_all poh
WHERE gl.je_header_id = je.je_header_id
AND gl.reference_4 = poh.segment1
AND je.actual_flag = 'E'
AND je.encumbrance_type_id = '1001'
AND gl.status = 'P'
AND poh.type_lookup_code IN ('STANDARD', 'BLANKET', 'PLANNED')
) A, ap.ap_suppliers aps,
per_all_people_f hr,
gl_code_combinations cc,
gl_periods per
WHERE a.code_combination_id = cc.code_combination_id
AND a.period_name = per.period_name
AND a.agent_id = hr.person_id
AND sysdate between hr.effective_start_date and hr.effective_end_date
AND a.vendor_id = aps.vendor_idSELECT gl.reference_4 po_number,
gl.code_combination_id ccid,
gl.creation_date,
gl.effective_date je_date,
poh.comments,
DECODE (je_source,'Payables',gl.reference_5,'') invoice_number,
DECODE (je_source,'Purchasing',NVL(gl.accounted_dr,0)- NVL(gl.accounted_cr,0)) po_amt,
DECODE (je_source,'Payables', NVL(gl.accounted_dr,0) - NVL(gl.accounted_cr,0)) liq_amt,
NVL(gl.accounted_dr,0) - NVL(gl.accounted_cr,0) po_balance,
'N' carryfwd_code,
poh.agent_id,
poh.vendor_id,
gl.period_name,
gl.code_combination_id
FROM gl_je_lines gl,
gl_je_headers je,
po_headers_all poh
WHERE gl.je_header_id = je.je_header_id
AND gl.reference_4 = poh.segment1
AND je.actual_flag = 'E'
AND je.encumbrance_type_id = '1001'
AND gl.status = 'P'
AND poh.type_lookup_code IN ('STANDARD', 'BLANKET', 'PLANNED')
) A, ap.ap_suppliers aps,
per_all_people_f hr,
gl_code_combinations cc,
gl_periods per
WHERE a.code_combination_id = cc.code_combination_id
AND a.period_name = per.period_name
AND a.agent_id = hr.person_id
AND sysdate between hr.effective_start_date and hr.effective_end_date
AND a.vendor_id = aps.vendor_id

I've read the docs thanks they are very good at helping me understand MOAC but they do not really answer the question.
I am thinking that now that a responsibility can access more than one org that org it is very likely to be a parameter on the report to give users the choice of what org data to report on. If there is a parameter is there a point of using the secure views? Because the report can look at the all table and then be restricted by org_id = &org_id. If this holds then it would be best to report from the all tables rather than the secure views.
So if I was asked to develop a report to show self billing invoices for example - what should I use ap_invoices_all with org_id as a parameter or ap_invoices without the parameter?
Thanks for the help in advance - I'm new in r12 and think this is a bit of fundamental point and it appears to me that both ways can be used but there is probably reasons to adopt one approach over another.

Similar Messages

  • Insertin Data useing SQL Procedure Getting Error ORA-00942 and ORA-06512

    I have two Schemas ISYS and ISYSTWO
    I had created a Stored Procedure RECINC2 in Schema ISYS
    as
    procedure recinc2(cName IN CHAR,cWhere IN CHAR,cTable in CHAR)
    AS
    cQry VARCHAR2(1000);
    BEGIN
    cQry := 'INSERT INTO '||cName||'.'||cTable||' SELECT * FROM '||cTable|| ' WHERE ||cWhere;
    dbms_output.put_line(cqry);
    EXECUTE IMMEDIATE cQry;
    end;
    NOW WHEN in Run it gives error
    SQL> begin
    2 recinc2('ISYSTWO','CODE=4','AGENTS');
    3 end;
    4 /
    INSERT INTO ISYSTWO.AGENTS SELECT * FROM AGENTS WHERE CODE=4
    begin
    ERROR at line 1:
    ORA-00942: table or view does not exist
    ORA-06512: at "ISYS.RECINC2", line 8
    ORA-06512: at line 2
    BUT IF I EXECUTE
    the DBMS output
    INSERT INTO ISYSTWO.AGENTS SELECT * FROM AGENTS WHERE CODE=4
    it executes and gives fine result
    Please help
    Thanks
    Chaand kackria

    SQL> conn ISYSTWO/ISYSTWO
    Connected.
    SQL> grant all on agents to isys;
    Grant succeeded.
    SQL> conn isys/isys
    Connected.
    SQL> exec recinc2('ISYSTWO','CODE=4','AGENTS');
    INSERT INTO ISYSTWO.AGENTS SELECT * FROM AGENTS WHERE CODE=4
    PL/SQL procedure successfully completed.

  • My itunes wont let me download podcast to my ipod, and i have a podcast account for bob and tom,  i have them download to itunes but cannot get them to the ipod.

    My itunes wont let me download podcast to my ipod, and i have a podcast account for bob and tom,  i have them download to itunes but cannot get them to the ipod. I dont know if its my my computer or my ipod.

    From a Kappy  post
    The Three Best Alternatives for Security Questions and Rescue Mail
       1. Use Apple's Express Lane.
    Go to https://expresslane.apple.com ; click 'See all products and services' at the
    bottom of the page. In the next page click 'More Products and Services, then
    'Apple ID'. In the next page select 'Other Apple ID Topics' then 'Forgotten Apple
    ID security questions' and click 'Continue'. Please be patient waiting for the return
    phone call. It will come in time depending on how heavily the servers are being hit.
    2.  Call Apple Support in your country: Customer Service: Contact Apple support.
    3.  Rescue email address and how to reset Apple ID security questions.
    A substitute for using the security questions is to use 2-step verification:
    Two-step verification FAQ Get answers to frequently asked questions about two-step verification for Apple ID.

  • My daughter accidentally purchased something from an in app purchase, I haven't got the £2.99 in my account until tuesday, and do not want the in app purchase, my account wont log in now even to download free apps. How do I get my account back?

    My daughter accidentally purchased something from an in app purchase, I haven't got the £2.99 in my account until tuesday, and do not want the in app purchase, my account wont log in now even to download free apps. How do I get my account to log in again and function properly, I shouldn't have to wait until I have a meagre £2.99 in my account again do I because I need the app store for other apps etc and updating, even if it is only 3 days I want my account back, I do not want nor did I give permission for the in-app purchase and would be happy for it to be returned/credited back so I can have MY account available for my IPhone.
    Please can someone give me more information or let me know how else I can get my account working again, before pay day on tuesday.
    Much appreciated, Paddy.
    <Email Edited by Host>

    Hello paddyliverpool,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBookstore purchase
    http://support.apple.com/kb/ht1933
    Refund is an option.
    Best of luck,
    Mario

  • One of my blackberry playbook email accounts quit working and I have done everything in my power to get it back up and going to no avail. I finally deleted it and tried to put it back on. Forget that. What is up with this? I have had playbook from the sta

    now i am really frustrated with it. Every single update has robbed me of battery power which began with about 8-10 hours of usage and now I am lucky if I get 2 hours. It isn't the battery. It has something to do with the updates to the OS. It was fine until the first one and it has only gotten worse each time. I have had three email accounts on here since they started with the message app and now it has gone crazy. It gives me a server error message each time. I put in the same settings for it as the ones on my laptop to no avail. I am ready to scream. I have worked for days trying to get this email account back on my BB playbook, NOT!  And also I want another reader on here. Kobo is great, but I would love to have another option as well. I tried to put some pdf books on it a few days ago and they wouldn't show up when I put them on. Some did and some didn't. I am so frustrated with playbook. I have loved it till the last 2 weeks. Now, I am extremely frustrated to say the least. Well I have been upset about the battery thing almost from the get go. Can anyone help with the email thing. My email is a bellsouth account. I have 2 yahoo accounts on it and they seem to be fine, but afraid to take them off and re-put them all back on lest they should do the same thing.

    There is nothing wrong with the OS update.
    Delete ALL your email accounts.
    Restart Playbook
    Put the accounts back and ensure they are all set with PUSH ON.  Manual (push off) will burn battery.
    Similarly delete your wifi connections and add back when required. 
    Turn off wifi is not connected to wifi. 
    Any "hunting for connection" in email or wifi will burn up battery.

  • How do I unlink my Apple ID from another persons I tunes account? I keep getting their security questions and one of my emails can't be used

    How do I unlink my Apple ID from another persons I tunes account? I keep getting their security questions and one of my emails can't be used. It keeps telling me I its linked to another account but it shouldn't anymore. Plus my security questions belong to the other person and it has no reset option

    depend on the version of itunes and if it's OS X or windows i suppose
    in itunes on ny computer in the upper right corner left of the search bar there is a circle with a black siloet  and my name beside it
    if I click on the v beside it I can a menu with logout as an option

  • How can I get my iPhone 4s and my computer to sync an msn email account?

    I had a Blackberry before my IPhone.  On the BB, when I read an email received using my Windows Live account (@msn.com), which I also use as my default email on my Mac, I was asked if I wanted to delete the message from my phone only, my computer only, or from both.  The msn is a pop account.  Now that I have my IPhone, I can not get my phone email and my computer email to sync the same way.  I understand, from an hour on the phone with Apple support, that an imap account will work that way--ex., my yahoo acount.  When I delete a message from my IPhone it also deletes from my yahoo account.  However, I don't often check that account because we use the msn account for the majority of emails and the msn is set up in the computer's mail account.   I was told that because it is a pop account there is possibly no way to make them sync that way.  I wonder if anyone else has run across this issue and if there is any solution at all?  Is it possible to set up an msn.com account using imap on my computer?

    Perhaps you should try using "shared photo stream", if the other phone can view the stream?
    http://support.apple.com/kb/TI104
    HTH

  • My dad and I shared an iTunes account for years and now I'm getting my own, how can I keep my music and apps?

    My dad and I shared an iTunes account for years and now I'm getting my own, how can I keep my music and apps? I'm worried that I won't have any ability to access my apps and music. We have our itunes separated on different computers, so I have all of my stuff separated from his, but I don't know how to put them in my new account.

    Well... there really isn't any fully legal way to do this.
    The simplest solution is to continue sharing the same iTunes purchasing acct, but create different ones for iCloud (assuming that's why you needed to do the split).
    Slightly less kosher: Burn AUDIO CD's, of the music then copy them back to your new account.
    BE sure to do this from original acount, To keep the music info, you'll  copy over the CDDB file (in prefs somewhere) - since this maintains the data of CDs that you've had in library.... (it isn't carried over onto a user created CD.)
    There's also

  • My wife and I have a family account at Verizon and are thinking of getting the IPhone 4S.  My question is can we both use the functions of Icloud on the same account at Verizon or do we have to have separate accounts to be able to use all the features

    My wife and I have a family account at Verizon and are thinking of both getting the IPhone 4S.  My question is can we both use all of the features of Icloud with one account at Verizon or do we need to have separate accounts?

    If Mail in Mavericks is the same as earlier versions you can select accounts in the sidebar, so that you can either display the inboxes for individual accounts, or the contents of all the account inboxes. (If the accounts don't show click the disclosure triangle next to 'INBOX'). The layout may have changed since the version I have - Snow Leopard - but you should be able to do the same thing.

  • I deleted my email account of my iPad buy mistake now I've put it bk on I've only got a few emails come back on not my old ones from before there still in my in box if I going my hotmail account on pc and on my phone, how do I get them bk on my iPad thank

    I deleted my email account of my iPad buy mistake now I've put it bk on I've only got a few emails come back on not my old ones from before there still in my in box if I going my hotmail account on pc and on my phone, how do I get them bk on my iPad thank

    What type of account did you set-up on the iPad, POP, IMAP, the items on your iPad could have downloaded off the server or you will need wait awhile for the message to update to the iPad. 

  • Anybody had an issues with mail since upgrading to mountain lion? Can't get emails from one account, tried deleting and recreating but to no avail. Set up a new user and it works fine. Macbook pro 13" mid 2010 model.

    Anybody had an issues with mail since upgrading to mountain lion? Can't get emails from one account, tried deleting and recreating but to no avail. Set up a new user and it works fine. Macbook pro 13" mid 2010 model.

    Anybody had an issues with mail since upgrading to mountain lion? Can't get emails from one account, tried deleting and recreating but to no avail. Set up a new user and it works fine. Macbook pro 13" mid 2010 model.

  • HT1203 Can I share one iTunes account for my iPad and two I phones? If so, how can I get the purchased apps and music on all three devices? Do I need a home computer,

    Can I share one iTunes account for my iPad and two I phones? If so, how can I get the purchased apps and music on all three devices? How do I sync all the devices to have the same music and apps?

    You can set up an iCloud account on each one (the SAME iCloud account using the same AppleID on each) and then sync via iCloud.
    http://support.apple.com/kb/HT5262\
    However, an iCloud backup nor sync contains purchased content - that is available for redownload from the iTunes and App stores (so no need to waste iCloud space storing it for you).
    So, for purchased content, you will have to download it on each device - just use the same AppleID and download each item on each device.
    Without a computer to aid the sync'ing, downloading the purchased content on each device is the only way.
    P.S  audiobooks cannot be re-downloaded once purchased (all other content can be), so without a computer to save, store and move the audiobook files around, you will only be able to put those on one device - the one you first purchase it on.

  • My dad and I have shared an iTunes account for years and I just created a new apple id but I have no Idea how to get all those purchases to this new account. Help please?

    My dad and I have shared an iTunes account for years and I just created a new apple id but I have no Idea how to get all those purchases to this new account. Help please?

    The old Apple ID (presumably your dads) owns those songs and your new Apple ID does not.  However, your dad can authorize your iD to use the songs by going to Store > Authorize This Computer from your iTunes menu and entering his Apple ID and password.

  • HT1911 Someone else set up my itunes account for me and I cant remember the Apple ID, the Password, or the name he put under it all. How do I get back into my iTunes account???

    Someone else set up my iTunes account for me and I can't remember the Apple ID, the Password, or the name he put under it all. How do I get back into my iTunes account???? Or at least a number to call to get back???

    Go to Settings>Store>Apple ID, tap the ID shown, sign out, sign back in using the alternate ID.

  • I am concerned about the health of my current computer but have not yet made the commitment to a new one, but: 1) How can I transfer my iTunes account to a new computer when I get one... and 2) What can I do if my current computer suddenly implodes and I

    I am a bit of a computer/Internet/iTunes dummy....
    I am concerned about the health of my current computer but have not yet made the commitment to a new one, but:
    1) How can I transfer my iTunes account to a new computer when I get one...
    and
    2) What can I do if my current computer suddenly implodes and I have not yet 'copied/'saved'/otherwise protected my account, as is? -- I have already had my computer crash once and had one of your people help me restore all of the paid for songs (none of the uploaded from my own collection of CD songs, of course, so I had to spend a long time rebuilding that) -- and I believe I was told you could only help me recover that material one or two times altogether, no?
    WithOUT purchasing a Mach or iCloud (I actually think I have one of the later, but rarely have checked it) account, is there anything I can do to responsibly protect my account?
    Thanks for any time taken on this!!!

    These are two possible approaches that will normally work to move an existing library to a new computer.
    Method 1
    Backup the library with this User Tip.
    Deauthorize the old computer if you no longer want to access protected content on it.
    Restore the backup to your new computer using the same tool used to back it up.
    Keep your backup up-to-date in future.
    Method 2
    Connect the two computers to the same network. Share your <User's Music> folder from the old computer and copy the entire iTunes library folder into the <User's Music> folder on the new one. Again, deauthorize the old computer if no longer required.
    Both methods should give the new computer a working clone of the library that was on the old one. As far as iTunes is concerned this is still the "home" library for your devices so you shouldn't have any issues with iTunes wanting to erase and reload.
    I'd recommend method 1 since it establishes an ongoing backup for your library.
    Note if you have iOS devices and haven't moved your contacts and calendar items across then you should create one dummy entry of each in your new profile and iTunes should  merge the existing data from the device.
    If your media folder has been split out from the main iTunes folder you may need to do some preparatory work to make it easier to move. See make a split library portable.
    Should you be in the unfortunate position where you are no longer able to access your original library or a backup then then see Recover your iTunes library from your iPod or iOS device for advice on how to set up your devices with a new library with the maximum preservation of data.
    tt2

Maybe you are looking for

  • Error message while closing mobile sales on a vpn-connected notebook

    Hi! We're working with Mobile Sales 4.0 on laptops with WinXP ... When our field service stay connect via vpn with the central server sometimes it happens that an error-message pop up if Mobile Sales shall be closed. The text is "this program is used

  • Getting the variable name

    Hi May be a simple question, but I can't figure out how actually. When I'm doing this var obj:Object = new Object(); obj.test = "My Test"; for(var i:* in obj)      trace(i + " : " + obj[i]);     The output is -> test : My Test My problem comes when I

  • Soft edges filter - not rendering correctly?

    Hey, When I put the soft edges effect (under matte in video filters) over some text, it says it needs to render. However, once I render and the red line is gone, it just plays in the sequence as it did before, without the soft edges. Strangely, when

  • Where do I find the VISA installation drivers to add to my application builder for my LabVIEW app?

    I need to add the VISA installation drivers to my LabVIEW application builder, but I don't know where to locate them. (I found the instructions on adding the drivers, but it didn't tell how to find them: http://digital.ni.com/public.nsf/3efedde4322fe

  • Determining the last time an appointment was modified

    Does any one know how to determine the date and time an appointment was modified. I do not see any thing for this in the iCal format. I have looked in the CAPI documentation but must be missing it. Thanks