Approval Query for AP Invoices Containing Budget Related GL Account

Hi Experts,
I would like to create a approval template for all AP invoices that include a GL account that is related to the budget. Can you please help me with the approval query?
Thank you!
Jane

Hello Gordon Du,
"B1 approval will only apply to document level. If you want to check line level, only the first line can be subjected to."
I was thinking to trigger the approval process based on a document (AP invoice) containing relevant cost centres on a line by line basis as entered via one of the enabled dim fields.
Writing a trigger query for each cost centre effected? This does not appear to be a good solution, what is a better direction. Is there another way? (PO are not yet used via SAPB1)
Currently my invoices add, but do not trigger the approval process based on my attempts thus far.
Can the originator manually choose an approval pathway?
If this is against posting etiquette delete and advise.
I am a relative newbie to SAP B1, so am happy to be pointed to relevant help files. I arrived via  google searching and arrived here.
Thankyou.

Similar Messages

  • Query for multiple invoice numbers.

    Hi,
    My question is if I can add multiple invoice numbers in the search field "invice number"?
    For example when I receive a balance confirmation request from a supplier and their list contains 10 invoices. Can I do a search for all 10 at the same time or I can olny do a search one by one?
    Thank you!
    Angie

    Hi,
    there's no direct possibility to query for multiple Invoice number in terms of entering e.g. 5 number for a query.
    But you can work with placeholders '_' and '%' to find multiple invoices at one time. Underscore sign stands
    for exactly one character which can have multiple value, percentage sign for multiple ones.
    Example (assuming you are using letters and numbers for invoice numbering):
    When entering 'A12_' as search String, invoices from 'A120' to 'A12z' would be found.
    When using 'A12_01_' all invoices from 'A120010' to 'A12z01z' would be found.
    When using 'A12%' all invoices starting with 'A12' - no matter about the rest would be found.
    These are only a few examples but i think when using a clever combination of wildcards and parts of the
    invoices - which often share a common component, if the invoices come from the same vendor - you'll get
    at least a small step farther.
    Regards

  • Approval Query for Invoices with Items Onhand below zero.

    Dear Experts,
    I would like to make an approval procedure applicable on A/R Invoice. 
    When ever one of the Invoice items OnHand amount is below ZERO - I need the Approval Procedure to Popup and this way the Produce of the Invoice will be blocked.
    Is there any way to write a query on Approval Template for that?
    Thanks! 
    Regards,
    D.Medalion

    Hi D.Medalion
    Please Follow some step
    First Create Approval Stages in Administration ->Approval Procedures->Approval Stages
    First -
    Administration ->Approval Procedures->Approval Templates->Documents-> Click On A/R Invoice .
    Second-   Administration ->Approval Procedures- Approval Templates->Terms->When the Following Applies->Click Tick On Deviation from Commitment  and ration Drop Down Choose Greater or Equal
    Thanks & Regard
    Khan Imran

  • Approval Query for a specific customer group

    Dear Experts,
                 Following is the scenario, customer deals with whole sale and retail customers group. The client wishes to ensure that If the whole sales customer group account balance greater than zero then while making a sales order or invoice it should trigger approval.
    Saravanan

    Hi Saravnan......
    Thy this Approval Query and just put the Group Code for your customer in this group code's inverted comma....
    SELECT Distinct 'TRUE' From OCRD T0 Where T0.Balance>0 and GroupCode=' '
    And T0.CardCode=$[ORDR.CardCode.0]
    If above does not work then use below...
    SELECT Distinct 'TRUE' From OCRD T0 Where T0.Balance>0 and GroupCode=' '
    And T0.CardCode=$[$4.0.0]
    Regards,
    Rahul

  • Formatted search query for displaying invoice items details

    hi all,
    i need to display all the items in AP invoice.kindly suggest me a query for that.
    in AP invoice
    Ex. row items
    code--descqtyprice--
    total
    I0001--XXXXXXX5--
    100 -
    500
    query should display this row as
    code--desc--
    price
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    I0001--XXXXXXX--
    100
    =================================
    the query should display as the qty is 5 so it will display the same item 5 times
    kindly suggest me some query for formatted search
    its very urgent
    regards
    sandip

    Hi Sandip,
    DoQuery("Select b.ItemCode from OINV a,INV1 b Where a.DocEntry=b.DocEntry")
    Hope its help for you
    Give me reward points,
    Regards,
    G.Suresh.

  • Approval Query For A/R Delivery

    Hi
    I have made a query for Approval Procedure, only those Delivery documents will go for approval for which A/R Down payment Request has not been made. But it is not working properly Kindly Correct the query.
    SELECT Distinct 'True'  where dln1 t0 inner join odln t1 on t0.docentry = t1.docentry inner join ordr t2 on t0.baseentry = t2.docentry and t2.docentry not in (Select distinct t4.baseentry from dpi1 t4) and
    t2. docentry = $[DLN1.Baseentry]
    Thanks
    Rashid

    Hi Rashid,
    B1 does not support approval queries on document lines. you can query only document header.
    you can either try to workaround it with all sorts of aggregate UDFs in the header, or alternatively take a look at:
    [http://www.beonesolutions.com/ip/Solutions/ap.html|http://www.beonesolutions.com/ip/Solutions/ap.html]
    all details, including the ability to query all document tables, are in:
    [http://www.beonesolutions.com/files/Approval_Pro_Brochure.pdf|http://www.beonesolutions.com/files/Approval_Pro_Brochure.pdf]
    Gilan

  • Approval Query for Receipt from production

    Hi experts,
    I want to define an approval process for receipt from production.
    The condition is below:
    Only if it is " Receipt from production" then the goods receipt document should go to approval of quality.
    If is any unplanned direct goods receipt then system should allow to add it straightly.
    To do so, Please provide me the required query.
    regards
    Ravindran Srinivasan

    Hi Ravindran,
    I once encounter same problem like this. And I found out that, unfortunately, approval procedure can't work on receipt from production document.
    Yes, we all know that receipt from production and inventory goods receipt are actually same object type in SAP B1 and stored in same table. But, try it by yourself in your testing database, even if you apply the approval templates for goods receipt document, and you apply the condition as "always", you won't get prompted for approval if you try to add the receipt from production document.
    However, I said this based on my experience with version prior to 8.81 and 8.82. But somehow I have a strong feeling that this issue still not yet realized by SAP.
    Best Regards,
    Hendry Wijaya

  • Non Budget related GL accounts

    Hye Experts
    I have some Gl accounts which are not relevant for budget. I dont want this GL accounts to be checked for budget. What shall I do.
    Shall i create a committment item with not relevant for budget or any statistical committment can be created which will not check the budget controll.
    Thanks and Regards
    Suresh

    If the non budget related accounts you can create a derivation strategy to derive a tolerance profile that that has a usage rate of 999% .For example our accounts that end with a "1" derives a different tolerance profile that the accounts which we budget very strictly (100% usage rate).
    http://help.sap.com/saphelp_47x200/helpdata/en/3a/19f53be2145d48e10000000a11402f/frameset.htm

  • Approval Query for Outgoing Payment

    Hi All Experts,
    I have to Create Approval for Outgoing Payment where payment means is Cash,Cheque or Bank Transfer but not Credit Card.
    In other words approval should be raised for all payment means other than Credit card payment means.
    For which I have Created Query as follows
    select Distinct 'true' FROM dbo.OVPM T0
    Left join dbo.VPM3 T1 on T0.DocEntry=T1.Docnum
    WHERE  T0.CreditSum=0 And T1.CreditAcct is null
    payments goes for approval but Credit Card payment also goes for Approval which is not required.
    Please Help me to Correct the Query.
    Regards,
    Gayatri Shukla.

    Hi,
    Little modification to your query. Try this.
    select Distinct 'true' FROM dbo.OVPM T0
    Left join dbo.VPM3 T1 on T0.DocEntry=T1.Docnum
    WHERE  T0.CreditSum = 0
    Regards,
    Amrut Sabnis.

  • Approval Query for Prepaid customers

    Hi, I need help with a query. I want an approval screen to pop up when a user tries to add a delivery for a prepaid customer and the customer has not paid. The following query get me a "Could not commit transaction" error.
    In our system, customers with prepaid terms have -1 in the GroupNum field.
    SELECT Distinct 'TRUE' From OCRD T0 INNER JOIN ODLN T1 ON T0.CardCode = T1.CardCode WHERE $[OCRD.GroupNum] LIKE '-%' AND $[OCRD.Balance] + $[ODLN.DocTotal] <= 0
    Any help would be appreciated. Thanks

    Hi,
    Try this:
    SELECT Distinct 'TRUE'
    From OCRD T0
    WHERE T0.CardCode = $[ODLN.CardCode] AND T0.GroupNum <0
    AND T0.Balance + $[ODLN.DocTotal] <= 0
    Thanks,
    Gordon

  • Query for Open Invoices

    Hi 2 all
    Anybody know that how to fetch open invoices in 11i and these invoices balances should be match with Supplier Statement of Account Report.
    Thanks,
    Zulqarnain

    Hi,
    I use this one:
    SELECT HEADER.*,
    HEADER.END_BALANCE - HEADER.BEGIN_BALANCE NET_BALANCE,
    HEADER.BEGIN_BALANCE BEGIN_BALANCE_2,
    LINE.*,
    NVL(LINE.DEBE, 0) - NVL(LINE.HABER, 0) NETO_LINEA
    FROM (SELECT TP.THIRD_PARTY_ID,
    TP.THIRD_PARTY_NAME,
    TP.THIRD_PARTY_NUMBER,
    S.SUB_ID,
    S.SUB_NAME,
    AB_START.ACCOUNT_SEGMENT,
    AB_START.PERIOD_NAME BEGIN_BALANCE_PERIOD,
    AB_END.PERIOD_NAME END_BALANCE_PERIOD,
    AB_START.END_BALANCE_DR - AB_START.PERIOD_NET_DR +
    AB_START.PERIOD_NET_CR - AB_START.END_BALANCE_CR BEGIN_BALANCE,
    AB_END.END_BALANCE_DR - AB_END.END_BALANCE_CR END_BALANCE
    FROM AX_THIRD_PARTIES_V TP,
    AX_SUBS_V S,
    AX_BALANCES AB_START,
    GL_PERIOD_STATUSES GPS_START,
    AX_BALANCES AB_END,
    GL_PERIOD_STATUSES GPS_END
    WHERE TP.APPLICATION_ID = 200
    AND TP.APPLICATION_ID = S.APPLICATION_ID
    AND TP.APPLICATION_ID = AB_START.APPLICATION_ID
    AND TP.APPLICATION_ID = GPS_START.APPLICATION_ID
    AND TP.APPLICATION_ID = AB_END.APPLICATION_ID
    AND TP.APPLICATION_ID = GPS_END.APPLICATION_ID
    AND TP.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
    AND S.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
    AND S.SUB_ID = AB_START.SUB_ID
    AND AB_START.SET_OF_BOOKS_ID = GPS_START.SET_OF_BOOKS_ID
    AND AB_START.PERIOD_NAME = GPS_START.PERIOD_NAME
    AND TP.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
    AND S.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
    AND S.SUB_ID = AB_END.SUB_ID
    AND AB_END.SET_OF_BOOKS_ID = GPS_END.SET_OF_BOOKS_ID
    AND AB_END.PERIOD_NAME = GPS_END.PERIOD_NAME
    AND AB_START.SET_OF_BOOKS_ID = :P_SOB
    AND TP.THIRD_PARTY_NUMBER =
    NVL(:P_VENDOR_NUMBER, TP.THIRD_PARTY_NUMBER)
    AND TP.THIRD_PARTY_NAME = NVL(:P_PARTY_NAME, TP.THIRD_PARTY_NAME)
    AND S.SUB_NAME = NVL(:P_SUB_NAME, S.SUB_NAME)
    AND AB_END.ACCOUNT_SEGMENT = AB_START.ACCOUNT_SEGMENT
    AND GPS_START.EFFECTIVE_PERIOD_NUM =
    (SELECT MIN(P_BALANCE.EFFECTIVE_PERIOD_NUM)
    FROM AX_BALANCES BALANCE,
    GL_PERIOD_STATUSES P_BALANCE,
    GL_PERIOD_STATUSES P_DATE
    WHERE BALANCE.APPLICATION_ID = AB_START.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_BALANCE.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_DATE.APPLICATION_ID
    AND BALANCE.THIRD_PARTY_ID = AB_START.THIRD_PARTY_ID
    AND BALANCE.SUB_ID = AB_START.SUB_ID
    AND BALANCE.SET_OF_BOOKS_ID = AB_START.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_BALANCE.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_DATE.SET_OF_BOOKS_ID
    AND P_DATE.PERIOD_NAME = :P_PERIOD_START
    AND P_BALANCE.EFFECTIVE_PERIOD_NUM >=
    P_DATE.EFFECTIVE_PERIOD_NUM
    AND P_BALANCE.PERIOD_NAME = BALANCE.PERIOD_NAME
    AND BALANCE.CODE_COMBINATION_ID =
    AB_START.CODE_COMBINATION_ID)
    AND GPS_END.EFFECTIVE_PERIOD_NUM =
    (SELECT MAX(P_BALANCE.EFFECTIVE_PERIOD_NUM)
    FROM AX_BALANCES BALANCE,
    GL_PERIOD_STATUSES P_BALANCE,
    GL_PERIOD_STATUSES P_DATE
    WHERE BALANCE.APPLICATION_ID = AB_END.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_BALANCE.APPLICATION_ID
    AND BALANCE.APPLICATION_ID = P_DATE.APPLICATION_ID
    AND BALANCE.THIRD_PARTY_ID = AB_END.THIRD_PARTY_ID
    AND BALANCE.SUB_ID = AB_END.SUB_ID
    AND BALANCE.SET_OF_BOOKS_ID = AB_END.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_BALANCE.SET_OF_BOOKS_ID
    AND BALANCE.SET_OF_BOOKS_ID = P_DATE.SET_OF_BOOKS_ID
    AND P_DATE.PERIOD_NAME = :P_PERIOD_END
    AND P_BALANCE.EFFECTIVE_PERIOD_NUM <=
    P_DATE.EFFECTIVE_PERIOD_NUM
    AND P_BALANCE.PERIOD_NAME = BALANCE.PERIOD_NAME
    AND BALANCE.CODE_COMBINATION_ID =
    AB_END.CODE_COMBINATION_ID)) HEADER,
    ((SELECT LINE.THIRD_PARTY_ID VENDOR_ID,
    HEAD.EFFECTIVE_DATE FECHA_CONTABLE,
    INV.INVOICE_DATE FECHA_TRANSACCION,
    LOOK.DESCRIPTION TIPO_TRANSACCION,
    LINE.REFERENCE_25 NUM_TRANSACCION,
    INV.DOC_SEQUENCE_VALUE SECUENCIA,
    LINE.ACCOUNTED_DR DEBE,
    LINE.ACCOUNTED_CR HABER,
    CODE.SEGMENT3 CUENTA
    FROM AX_SLE_LINES LINE,
    AX_SLE_HEADERS HEAD,
    GL_CODE_COMBINATIONS CODE,
    AP_INVOICES_ALL INV,
    FND_LOOKUP_VALUES LOOK
    WHERE HEAD.EFFECTIVE_DATE BETWEEN
    (SELECT START_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_START
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND (SELECT END_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_END
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND HEAD.SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND HEAD.SET_OF_BOOKS_ID = INV.SET_OF_BOOKS_ID
    AND HEAD.JOURNAL_SEQUENCE_ID = LINE.JOURNAL_SEQUENCE_ID
    AND HEAD.SET_OF_BOOKS_ID = :P_SOB
    AND LINE.REFERENCE_7 = INV.INVOICE_ID
    AND CODE.CODE_COMBINATION_ID = LINE.CODE_COMBINATION_ID
    AND LINE.SLE_HEADER_ID = HEAD.SLE_HEADER_ID
    AND LINE.SOURCE_TABLE != 'AP_INVOICE_PAYMENTS'
    AND LOOK.LOOKUP_TYPE = 'INVOICE TYPE'
    AND LOOK.LANGUAGE = 'E'
    AND LOOK.LOOKUP_CODE = INV.INVOICE_TYPE_LOOKUP_CODE
    AND LINE.CODE_COMBINATION_ID IN
    (SELECT CODE_COMBINATION_ID
    FROM GL_CODE_COMBINATIONS
    WHERE SEGMENT3 LIKE '40%' -- Segment3 is our natural account, 40, 04, 41 are the natural accounts for suppliers
    OR SEGMENT3 LIKE '04%'
    OR SEGMENT3 LIKE '41%')) UNION ALL
    (SELECT LINE.THIRD_PARTY_ID VENDOR_ID,
    HEAD.EFFECTIVE_DATE FECHA_CONTABLE,
    INV.CHECK_DATE FECHA_TRANSACCION,
    'Pago' TIPO_TRANSACCION,
    LINE.REFERENCE_25 NUM_TRANSACCION,
    INV.DOC_SEQUENCE_VALUE SECUENCIA,
    LINE.ACCOUNTED_DR DEBE,
    LINE.ACCOUNTED_CR HABER,
    CODE.SEGMENT3 CUENTA
    FROM AX_SLE_LINES LINE,
    AX_SLE_HEADERS HEAD,
    GL_CODE_COMBINATIONS CODE,
    AP_CHECKS_ALL INV
    WHERE HEAD.EFFECTIVE_DATE BETWEEN
    (SELECT START_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_START
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND (SELECT END_DATE
    FROM GL_PERIOD_STATUSES_V
    WHERE PERIOD_NAME = :P_PERIOD_END
    AND SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND APPLICATION_ID = 101)
    AND HEAD.SET_OF_BOOKS_ID = LINE.SET_OF_BOOKS_ID
    AND HEAD.JOURNAL_SEQUENCE_ID = LINE.JOURNAL_SEQUENCE_ID
    AND HEAD.SET_OF_BOOKS_ID = :P_SOB
    AND LINE.REFERENCE_7 = INV.CHECK_ID
    AND CODE.CODE_COMBINATION_ID = LINE.CODE_COMBINATION_ID
    AND LINE.SLE_HEADER_ID = HEAD.SLE_HEADER_ID
    AND LINE.SOURCE_TABLE = 'AP_INVOICE_PAYMENTS'
    AND LINE.CODE_COMBINATION_ID IN
    (SELECT CODE_COMBINATION_ID
    FROM GL_CODE_COMBINATIONS
    WHERE SEGMENT3 LIKE '40%' --Segment3 is our natural account, 40, 04, 41 are the natural accounts for suppliers
    OR SEGMENT3 LIKE '04%'
    OR SEGMENT3 LIKE '41%'))) LINE
    WHERE HEADER.THIRD_PARTY_ID = LINE.VENDOR_ID(+)
    AND HEADER.ACCOUNT_SEGMENT = LINE.CUENTA(+)
    ORDER BY LINE.FECHA_CONTABLE
    :P_VENDOR_NUMBER -> Supplier Num
    :P_PARTY_NAME -> Supplier Name
    :P_SUB_NAME -> Supplier Address
    :P_SOB -> set_of_books_id
    :P_PERIOD_START -> Period Start
    :P_PERIOD_END -> Period End

  • Approval Management for Receivable Invoice Adjustments

    How can we create a new transaction type in AME and link it with AR Adjustments ?
    AR Adjustments already have inbuit approval flow..do we need to tweak the AR Adjustments workflow

    I have installed the patch 5679736 and still got the same error. :(
    I seems that the AME engine and the AP WORKFLOW are not link with each other...coz everytime we setup a transaction in AP workflow there is no matching applicable role at the AME, but is it existing on AME.
    One more thing I noticed...
    On our linux 11i test server where the WORKFLOW CONFIGURATION works fine, we selected the following tables
    because the drop down list for NOTIFICATION STYLE (e.g. thru email) has value:
    select count(*) from wf_gbx_roles; 16
    select count(*) from wf_gbx_ur; 70
    But on the AIX 11i PROD server where we got problem the tables has no rows; hence the the WORKFLOW CONFIGURATION window has no selected list of values for NOTIFICATION STYLE.
    How can this tables be populated? :(
    Why is that 11i on Linux is better than 11i in AIX
    On the AIX side,
    ======================
    select patch_level
    from fnd_product_installations
    where patch_level like '%AP%';
    no rows selected;
    =======================
    select distinct patch_level from fnd_product_installations;
    11i.AD.I.4
    11i.FV.F
    11i.GM.I
    11i.OKE.H
    11i.PSA.F
    ========================
    So I think I need to apply patch 3653484 ?
    The following patches are required prior to applying Oracle Financials Family Pack G and are available through OracleMetaLink. (Required)
    1. AD patch 4038964 (11i.AD.I.1 Mini-pack)
    2. FND patch 3262159 (11i.FND.H Mini-pack)
    3. XDO patch 3263588 (11i.XDO.H)
    4. BNE patch 3218526 (11i.BNE.D)
    5. FUN patch 3706130 FUN splice patch (required for 11i.OIE.J which is included in 11i.FIN_PF.G)
    6. XML patch 3822219 XDO/ORACLE XML PUBLISHER OA ROLLUP PATCH 5.0.0
    7. XML patch 3435480 Publishing Concurrent Requests with XML Publisher
    8. EGO patch 3931732 EGO ADSPLICE ARU CHECKIN
    Goodness so plenty of pre-requisites, do I have to install all of these?
    Thanks a lot

  • Approval Query  for Sale Delivery Problem

    Hello,
    I have to set approval procedure of Sale Delivery in following condition
    If i add sale order for Specific item for 10 Qty for example C01 customer & after that i add sale order for same item qty 10 for another customer ie C02 & i have stock for that item 50 but user give delivery first to C02 in staid of C01 but C01 give me first order
    on this condition i have to set approval user can't deliver second sale order first he have to take approval from manager to do this & he deliver first order first then then don't have to need approval.
    Can any one help me?

    Hi,
    Row level approval is not possible in SBO.
    You may check this for your reference: http://www.beonesolutions.com/ip/Solutions/ap.html
    Thanks,
    Joseph

  • Is it possible to query for all marketing doc hits to one account?

    We have been struggling to create one single query that pulls all entries made to a particular revenue account by all marketing documents (in 2007A, PL42).
    For example, an item may be used on an A/R invoice, A/R, credit memo, A/P invoice, or A/P credit memo in any given month.  We've been using four different queries to pull basic data from each one, then blending them together in Excel.  This seems silly, and I'm hoping we can blend the code in one query instead of running four different ones.  Thoughts?
    One of the four queries we've been using:
    SELECT T0.[DocNum], T0.[DocDate], T1.[ItemCode], T1.[Dscription], T1.[FreeTxt], T1.[Quantity], T1.[Price], T1.[LineTotal], T1.[AcctCode], T2.[Segment_0], T2.[AcctName]
    FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
         INNER JOIN OACT T2 ON T1.AcctCode = T2.AcctCode
    WHERE T2.[Segment_0] ='319000' AND T0.[DocDate] BETWEEN '[%0]' AND '[%1]'
    ORDER BY T1.[ItemCode]
    It would be even cooler if we could choose two segments to review (i.e. also '318000').
    Kind Regards,
    Russell Clayton

    When trying to link AP docs as well, I am only retrieving AR.  Any suggestions on this, and how to properly order by T2.Segment_0 would be greatly appreciated.  Thanks!
    SELECT T2.Segment_0, T2.AcctName, T1.[ObjType], T0.DocNum, T0.DocDate, T0.CardName, T1.ItemCode, T1.Dscription, T1.FreeTxt, T1.Quantity, T1.Price, T1.LineTotal
    FROM dbo.OINV T0 INNER JOIN dbo.INV1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN dbo.OACT T2 ON T1.AcctCode = T2.AcctCode
    WHERE T0.DocDate BETWEEN '[%0]'
    AND '[%1]'
    UNION ALL
    SELECT T2.Segment_0, T2.AcctName, T1.[ObjType], T0.DocNum, T0.DocDate, T0.CardName, T1.ItemCode, T1.Dscription, T1.FreeTxt, T1.Quantity, T1.Price, T1.LineTotal
    FROM dbo.ORIN T0 INNER JOIN dbo.RIN1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN dbo.OACT T2 ON T1.AcctCode = T2.AcctCode
    WHERE T0.DocDate BETWEEN '[%0]'
    AND '[%1]'
    SELECT T2.Segment_0, T2.AcctName, T1.[ObjType], T0.DocNum, T0.DocDate, T0.CardName, T1.ItemCode, T1.Dscription, T1.FreeTxt, T1.Quantity, T1.Price, T1.LineTotal
    FROM dbo.OPCH T0 INNER JOIN dbo.PCH1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN dbo.OACT T2 ON T1.AcctCode = T2.AcctCode
    WHERE T0.DocDate BETWEEN '[%0]'
    AND '[%1]'
    SELECT T2.Segment_0, T2.AcctName, T1.[ObjType], T0.DocNum, T0.DocDate, T0.CardName, T1.ItemCode, T1.Dscription, T1.FreeTxt, T1.Quantity, T1.Price, T1.LineTotal
    FROM dbo.ORPC T0 INNER JOIN dbo.OPC1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN dbo.OACT T2 ON T1.AcctCode = T2.AcctCode
    WHERE T0.DocDate BETWEEN '[%0]'
    AND '[%1]'
    ORDER BY  T2.Segment_0 ASC

  • Oracle APPS Query for Natural Accoun in the Chart of account

    Hello Guys,
    I am working on a query to display the natural account listing in a report, I have made the below query
    select  application_id ,SEGMENT_NAME, flex_value ACCOUNT_CODE , DESCRIPTION ACCOUNT_DESCRIPTION
    from FND_FLEX_VALUES,FND_ID_FLEX_SEGMENTS ,fnd_flex_values_tl
    where
    FND_ID_FLEX_SEGMENTS.APPLICATION_ID='101'
    AND SEGMENT_NAME='Natural Accounts'
    and FND_FLEX_VALUES.FLEX_VALUE_SET_ID=FND_ID_FLEX_SEGMENTS.FLEX_VALUE_SET_ID
    AND FND_FLEX_VALUES.FLEX_VALUE_ID=fnd_flex_values_tl.FLEX_VALUE_ID
    Its showing me the correct values but there is repetition of record each row is displayed 4 times, I have checked the joins and fields but still cant find any idea what could be causing this duplication,
    Any help will be appreciated
    Regards              

    Refer this query, you can get
    select FIS.SEGMENT_NAME, FFV.FLEX_VALUE, FIF.ID_FLEX_STRUCTURE_CODE , FSA.*
    from FND_SEGMENT_ATTRIBUTE_VALUES FSA, FND_ID_FLEX_SEGMENTS_VL FIS, FND_FLEX_VALUES_VL FFV, FND_ID_FLEX_STRUCTURES FIF
    where FSA.attribute_value='Y'
    and FSA.ID_FLEX_CODE = 'GL#'
    and FSA.SEGMENT_ATTRIBUTE_TYPE = 'GL_ACCOUNT' --Natural Account Segment
    and FIF.ID_FLEX_STRUCTURE_CODE='ACCOUNTING_FLEXFIELD'
    and FSA.APPLICATION_COLUMN_NAME = FIS.APPLICATION_COLUMN_NAME
    and FIS.FLEX_VALUE_SET_ID = FFV.FLEX_VALUE_SET_ID
    and FIS.ID_FLEX_NUM=FIF.ID_FLEX_NUM
    and FIS.ID_FLEX_CODE=FIF.ID_FLEX_CODE
    AND FSA.ID_FLEX_CODE= FIF.ID_FLEX_CODE
    and FSA.ID_FLEX_NUM=FIF.ID_FLEX_NUM
    thanks

Maybe you are looking for