Query for Invoice price

What's query to check amount/invoice price for a particular transaction ?say for ex :I'ce created order and with a line item with unit price of $300 and tax :$11 so total amount is $311.once invoice is created I want to check invoice quantity and invoice price for the same order(1 each,$311).What's the query to get that?
Thanks,
Mahender.

I have not tested this code but from my knowledge this should work right
IF @transaction_type = 'A' AND @Object_type = '18'
BEGIN
IF EXISTS(SELECT T1.ItemCode FROM [dbo\].[POR1\] T0 INNER JOIN [dbo\].[PCH1\] T1 ON T1.BaseEntry = T0.DocEntry AND T1.BaseLine = T0.LineNum AND T1.ItemCode = T0.ItemCode
WHERE T1.Price > (T0.Price*1.05) AND T1.DocEntry = @list_of_cols_val_tab_del)
BEGIN
SELECT @Error = 1, @error_message = 'Item Invoice Price exceeds 5% of PO Price'
END
END
NOTE: You can change the @error_message text to want to want.  I have just shown an example. This will be displayed at the bottom
Suda

Similar Messages

  • Query for invoice and distribution detail

    hi 2 all
    anybody have the query for getting invoice with distribution detail in oracle payable r12.
    thanks
    zulqarnain

    select ass.SEGMENT1 vendor_number,
    ass.VENDOR_NAME,
    assa.VENDOR_SITE_CODE VENDOR_SITE,
    aia.INVOICE_NUM,
    aia.INVOICE_DATE,
    aia.INVOICE_AMOUNT,
    aia.INVOICE_TYPE_LOOKUP_CODE,
    gcc.CONCATENATED_SEGMENTS distribution_account ,
    gcc1.CONCATENATED_SEGMENTS liability_account,
    to_char(aia.GL_DATE) GL_DATE,
    AP_INVOICES_PKG.GET_APPROVAL_STATUS( AIa.INVOICE_ID,
    AIa.INVOICE_AMOUNT, AIa.PAYMENT_STATUS_FLAG,
    AIa.INVOICE_TYPE_LOOKUP_CODE) APPROVAL_STATUS_LOOKUP_CODE
    from ap_invoices_all aia,
    ap_suppliers ass,
    ap_supplier_sites_all assa,
    ap_invoice_distributions_all aid,
    gl_code_combinations_kfv gcc,
    gl_code_combinations_kfv gcc1
    where aia.VENDOR_ID = ass.VENDOR_ID
    and assa.VENDOR_SITE_ID = aia.VENDOR_SITE_ID
    and ass.VENDOR_ID = assa.VENDOR_ID
    and aid.INVOICE_ID = aia.INVOICE_ID
    and aid.DIST_CODE_COMBINATION_ID = gcc.CODE_COMBINATION_ID
    and assa.ACCTS_PAY_CODE_COMBINATION_ID = gcc1.CODE_COMBINATION_ID
    --and aia.INVOICE_ID =  81000
    and aia.GL_DATE between '01-JAN-12' and '31-MAR-12'
    order by aia.GL_DATE
    Thanks,
    Atul

  • Query for updating prices if product IDs same

    I have a large Windows SQL 2000 database of products that
    need to have
    2007 prices.
    I have another Windows SQL 2000 database that has the correct
    prices
    that I can import into Windows SQL 2000 as a new table.
    I want to be able to UPDATE the Prices where product IDs
    match.
    What would an SQL query look like that would run in Query
    analyzer?
    So, basically, I need a query that would compare the product
    IDs and
    update the price column with the new price.
    Neither database is in the same location. One that holds the
    correct
    pricing is basically inaccessible to me. I can get a
    delimited file
    though. I know how to get that in.

    I've a table called Track, which has three columns named Part1, Part2 and Part3. I want all values of Part1 to be separated by a comma (,);
    No, don't go there.
    This breaks a fundamental point for relational databases: no repeating groups. A cell should hold an atomic value. And this is not only a matter of purism. Relational databases are designed from this principle, and breaking this means that you will need
    to write complex and higly inefficient code.
    The values in Part1 should be in a separate table, with one value per row.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Doubt on SQl query for invoices

    Hi All,
    I have a query which pulls the payment proposal for the standard invoices and credit memo's
    being posted into the system from the table BKPF and BSIK.
    I just want to pull the payment proposal for standard invoices rather than credit memo's.
    I found that the only difference is the field SHKZG i.e Debit/Credit indicator.
    But i also want to see if it impacts subsequent Debit and Subsequent Credit since
    i see these value in Value range of the field.
    thanks,

    Hello ,
    if  Credit\ debit  info is required you have to use BSEG and VBSEGK for items details for the header
    BKPF ,
    Regards,
    Kiran Kumar

  • 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

  • Need query for Item - Price Change History

    I need help finding information around Price Change History by Price List. 
    Information of interest is Date of Update and By Whom.    Also, if a Datasource is 'N-Unknown', what does this generally mean?
    select
    i.itemcode,
    i.itemname,
    iphist.price,
    pl.listname,
    pl.datasource as 'ChangeSource',
    '' as 'PriceChangeUpdateDate',
    '' as 'UpdateByUser'
    from  ait1 iphist, oitm i, opln pl
    where 1=1
    and iphist.pricelist = pl.listnum
    and i.itemcode = iphist.itemcode
    and iphist.itemcode in ('1234')
    and pl.listnum in (6)
    thanks in advance...

    thanks for the quick response and i would love to spend time perusing the forum for this question but i didn't have time today.  i'll do that now though.
    what i'm mostly interested in is a chronological view (lastUpdateDate) of the change to pricing for an item in the system.  there is a lot of activity in our system around price changes for promotions and i want to keep track of when it's changed in the source system and pair that with our other downstream systems.
    i'm assuming we can add this functionality through a udf some way or maybe sp_TransNotification proc?

  • Invoice price variance

    Hi gurus,
    Can anybody please let me know where to look for the settings for invoice price variance. The PO was created for material A for 26.01 USD for 1EA for 6EA. Therefore the GR amount is 156.06 USD (26.016). We received the invoice for 48.41 USD for 1  EA, therefore the total is 290.46 for 6EA (48.416). accounting have blocked the invoice. Where can we check in the system for the invoice tolerances so that it explains why the invoice is  blocked. I also want to know whether the invoice was blocked manully or system atuomatically did it? Now how can accounting correct this anamoly?
    Thanks
    Anusha

    I guess your invoice has automatically been blocked for payment because either the upper absolute or the percentage limit has been exceeded by the amount specified in customizing for key PP
    Go to OMR6, key PP and check the settings
    Accounting can release the invoice for payment through Tcode MRBR
    See following wikis for some additional information:
    http://wiki.sdn.sap.com/wiki/display/ERPSCM/MM-IV-LIV-CRESetTolerancesforIncoming+Invoice
    http://wiki.sdn.sap.com/wiki/display/ERPSCM/MM-IV-LIV-MRBRInvoiceReleaseinLIVTransactionMRBR
    Regards
    Sidi

  • Query for Price difference account when item is not sold but not on stock

    Hi Experts!
    One of my clients accountant requires a report which will help for what to do with the balance of the price difference account.
    At the and of the year there are some postings on this account, but not every item that hadnt been on stock when A/P Invoice arrived were sold. Some item were waistrel and put into a waistrel warehouse, but not sold.Some item were sent back to the supplier, but not sold.
    Is it possibble to make a query for knowing where to post the balance of the price difference account? Not all should be post to the Cost of goods sold.
    Thank you in advance!

    Hi,
    The query is possible.  However, it is a complicated one. It is also need to involve detailed analysis to your transaction histories.  You may start from OINM table to check.
    Thanks,
    Gordon

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

  • Generate report for invoices where basic price is missing

    Dear Experts,
    Requirement is like to gererate the report or SAP Query for those invoices (specially like Plants abrod WIA) where VKP0 (basic price ) sales price is missing.  with respect to date range .
    How can i achieve this ???
    Regards

    HI,
    I dont not think that you can create a SAP query for pricing, as it does not hit any particular database table. You  have to devlop a program for that check with your ABAPER.
    Regards
    Aadesh Kamat
    Edited by: aadesh123 on Jun 1, 2011 3:01 PM
    Edited by: aadesh123 on Jun 1, 2011 3:02 PM

  • Query for details of  Sale order , Invoice and COGS

    I Need the report cointing following based on month & Business partner
    Sale order, Sale Amount, Due date, Invoice Amount, Last Invoice date, COGS amount

    Hi Anantha,
    Please check below link and modify according to your requirement.
    Sales Order Query for  in SAP B1
    Query - Sales Orders linked to Deliveries
    My Top SQL Queries for SAP Business One
    Hope this helps
    Regards::::
    Atul Chakraborty

  • Explanation about invoice reversal for standard price.

    Hi,
    Please see the excerpt from SAP help below. I extracted this example in sap help found at http://help.sap.com/saphelp_47x200/helpdata/en/fc/85c5371e5db25fe10000009b38f8cf/frameset.htm
    With regards to the example found below i dont understand why we cant do a simple reversal of the invoice 1 as follows :-
    debit vendor account by 500
    and credit GR/IR account by 500
    Instead of the above simple reversal, the sap help is saying that we need to use a different stock value of 550. Can someone explain the following 2 questions :-
    1) Why shd we use this 550 value instead of the 500?
    2) What will go wrong if we use the value 500 to do the reversal?
    Excerpt from SAP help :-
    Goods receipt
    =============
    The stock account is posted with the receipt value based on the standard price.
    Delivered qty X standard price
    50 pcs X $10/pc = $500
    The offsetting entry is posted to the GR/IR clearing account.
    Invoice 1
    =========
    The GR/IR clearing account is cleared on the basis of the invoice price.
    Invoiced qty X Invoice price
    50 pcs X 10/pc = $500
    The offsetting entry is posted to the vendor account.
    Invoice 2
    =========
    The GR/IR clearing account is cleared on the basis of the invoice price.
    Invoiced qty X Invoice price
    50 pcs X 11/pc = $550
    The offsetting entry is posted to the vendor account.
    Reversal of invoice 1
    =====================
    The invoice quantity is greater than the goods receipt quantity. The credit memo quantity is covered by the quantity of the invoice surplus. The GR/IR clearing account is posted as follows:
    qty X (Clearing value - goods receipt value / Invoice qty - Goods receipt qty) = 50 X (1050 - 500 / 100 - 50) = 550
    The credit memo amount is posted to the vendor account. The credit memo amount is different to the posting on the GR/IR clearing account, so the difference is posted to the price difference account.

    hi,
    THis is because while making the credit memo, in your stock you don't have the stock coverage so till the stock coverage its posted to the GR/IR account while after that ie. the rest amount is posted to the PRD account...
    If Credit memo is of 500 then, the system shd hit GR/IR account only..because there is a stoc kcoverage for the same...
    If credit memo is for 550, then both GR/IR account and PRD will be hit...
    Hope its clear...
    Regards
    Priyanka.P

  • SQL Query for full paid invoices and payed out credit notes

    Hi alltogether,
    I have some problems with a sql query.
    I want to export all closed (full paid) invoices and credit notes in a table with the paid date.
    The problem is that I have several internal reconciliations for one invoice or credit note.
    So with my current query I get all these dates in the result but only for invoices, not for credit notes.
    I only need the last internal reconciliation date as payment date for all invoices and credit notes where the open amount is 0.
    In SAP B1 the finance team has service invoices and credit notes imported out of an ERP system.
    These documents are marked with an 'Y" in the coloumn "U_I_Imported" in the table "OINV" or "ORIN".
    SELECT
    OINV.DocTotal - OINV.PaidToDate as Offen, OINV.NumAtCard, OINV.U_I_Imported, ORCT.DocDate as 'Zahlungsdatum'
    SELECT
    OINV.DocTotal - OINV.PaidToDate as Offen, OINV.NumAtCard, OINV.U_I_Imported, ORCT.DocDate as 'Zahlungsdatum'
    FROM
    OJDT inner join
    ORCT on OJDT.BaseRef = ORCT.DocNum inner join
    RCT2 on ORCT.DocNum = RCT2.DocNum inner join
    OINV on RCT2.BaseAbs = OINV.DocEntry
    where
    OINV.DocTotal - OINV.PaidToDate = 0 and  OINV.U_I_Imported = 'Y'
    group by
    OINV.NumatCard, OINV.DocTotal - OINV.PaidToDate, OINV.U_I_Imported, ORCT.DocDate
    order by
    ORCT.DocDate
    I hope you can help me.
    Kind regards,
    Max

    The solution for my problem:
    select
    OINV.DocTotal - OINV.PaidToDate as 'Offen', OINV.CardCode as 'Kundennummer', OINV.NumAtCard as 'DIAMOD Rechnungsnummer', OINV.DocNum as 'Dokumentennummer',  max(ORCT.DocDate) as 'Zahlungsdatum', case when ORCT.DocCurr = (select MainCurncy from OADM) then RCT2.DcntSum else RCT2.DcntSumFC end as 'SkontoRechnungswährung',
        RCT2.DcntSum as 'SkontoFirmenwährung'
    from
        JDT1 inner join
        OJDT on JDT1.TransId = OJDT.TransId inner join
        ORCT on OJDT.BaseRef = ORCT.DocNum inner join
        RCT2 on ORCT.DocNum = RCT2.DocNum inner join
        OINV on RCT2.BaseAbs = OINV.DocEntry
    where
    JDT1.TransType in ('24') and
    OINV.U_I_Imported = 'Y' and
    OINV.DocTotal - OINV.PaidToDate = 0
    group by
    OINV.NumAtCard, OINV.DocNum, OINV.CardCode, OINV.DocTotal - OINV.PaidToDate, ORCT.DocCurr, RCT2.DcntSum, RCT2.DcntSumFC
    union all
    select
    OINV.DocTotal - OINV.PaidToDate as Offen, OINV.CardCode as 'Kundennummer', OINV.NumAtCard as 'DIAMOD Rechnungsnummer', OINV.DocNum as 'Dokumentennummer',  max(OITR.ReconDate) as 'Zahlungsdatum',
        0.0 as 'SkontoRechnungswährung',
        0.0 as 'SkontoFirmenwährung'
    from
    OITR inner join
    ITR1 on OITR.ReconNum = ITR1.ReconNum inner join
    OINV on ITR1.SrcObjAbs = OINV.DocEntry
    where
    OINV.DocTotal - OINV.PaidToDate = 0 and ITR1.SrcObjTyp = 13 and OINV.U_I_Imported = 'Y'
    group by
    OINV.NumatCard, OINV.DocNum, OINV.CardCode, OINV.DocTotal - OINV.PaidToDate
    union all
    select
    ORIN.DocTotal - ORIN.PaidToDate as Offen, ORIN.CardCode as 'Kundennummer', ORIN.NumAtCard as 'DIAMOD Rechnungsnummer', ORIN.DocNum as 'Dokumentennummer',  max(OITR.ReconDate) as 'Zahlungsdatum',
        0.0 as 'SkontoRechnungswährung',
        0.0 as 'SkontoFirmenwährung'
    from
    OITR inner join
    ITR1 on OITR.ReconNum = ITR1.ReconNum inner join
    ORIN on ITR1.SrcObjAbs = ORIN.DocEntry
    where
    ORIN.DocTotal - ORIN.PaidToDate = 0 and ITR1.SrcObjTyp = 14 and ORIN.U_I_Imported = 'Y'
    group by
    ORIN.NumatCard, ORIN.DocNum, ORIN.CardCode, ORIN.DocTotal - ORIN.PaidToDate

  • Error in excise invoice creation for differncial price invoice

    Dear all,
    When i am going to create outgoing excise invoice for differncial price invoice
    i am having the error - "Reference document of 10006893 is not delivery document
    Message no. 8I681"
    Can somebody give me solution where to make settings in configration or else.
    Archana

    Kindly refer following SAP Note
    Note 1251126 - Excise Invoice created for Billing document wrt Sales order
    Symptom as suggested by the above SAP Note is:
    In the scenario where billing document is created with reference to the Sales order, the reference document for billing document is not delivery and it is possible to create multiple billing documents wrt the same Sales Order.
    In such a case, the excise invoice should not be allowed to be created with respect to such a billing document through the transaction J1IIN.
    However, current the system is allowing excise invoice to be created wrt the first billing document for the sales order and then for the subsequent billing documents, the following error message is displayed - Modvat utilization done message no 8I 446. This is incorrect.
    This note contains the corrections for not allowing the creation of the excise invoice for these billing documents.
    Hope it assist your cause.
    Thanks & Regards
    JP

  • Select Query for smart form-invoice

    Hi Folks,
    I have to fetch the following fields as per the requirement for desiging a invoice smartform.I had copied lb_bill_invoice smartform into z format.
    Can anyone here please give me the select query for the same.
    fields to fetched are as follows:-
    1.vbrp-arktx,
    2.vbrp-fkimg,
    3.konv-kbetr with respect to vbrk-knumv
    4.konv-kwert.
    And also what all I have to give in format interface and global definitions of the smartform.
    please help  me in this regard.
    Points will be given.
    K.Kiran.

    Hi,
    declare the variables V_arktx(40) and v_Qty like vbrp-fkimp  and other varaibles for Kbetr, kwert, knumv on the global definitions.
    select  single arktx fkimg into (v_arktx, v_qty) from vbrp
    where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
    select single knumv into v_knumv from vbrk where where vbeln = LBBIL_IT_REFPURORD-BIL_NUMBER.
    this select has to fire in the item level and in the loop.
    so have to write in the correct place.
    select kbetr kwert into (v_kbetr, v_kwert) from konv
    where where knumv = v_knumv and kposn = LBBIL_IT_REFPURORD-ITM_NUMBER.
    regards,
    anji

Maybe you are looking for

  • Business iCal sending out multiple calendar invites - one calendar and one account, 2 people using it for work

    First question: My boss has a Macbook Pro (iPad & iPhone), I have a Dell and iPad.  We use his iCal for our work calendar and my Outlook is logged into his iCal so that I can load appointments & send them out to clients.  He obviously has access to t

  • BW report adding incorrectly

    I'm having a strange problem with a report on our BW system (3.0B SP15)...it's a headcount report that shows total headcount for a cost center hierarchy. The total for a specific node in the hierarchy is 57 employees, but when I drill down on employe

  • Too much errors/messages in Web Analysis reports stops workspace

    Too often workspace stops to work for the client with the following (example) messages. It seems that too much informational and error messages from reports (like a non working report link or missing member) gives the workspace client so much trouble

  • HT201274 how long does it takes to finish ios resetting?

    I have been waiting to finish ios reset mode(erase all contents) for about 12 hours. My ipad is still showing the apple logo and progress bar but there is no sign of progress in that bar. do u have any idea guys?

  • How to created a new movement type?

    Hi friends, We have a scenario which require stock moved from Return to Unrestriced. However, I haven't found any one step movement type to accomplish the job. I have to use two steps transfer, first Return to QI (457) then QI to unrestricted (321),