Grouping PO Lines according to Tax Codes

Hi All,
I have a query,in my report when i pass the po_number,it prints the po details and line details.For each line i have taxes also.
For Example if i have 5 lines (1,2,3,4,5). For 1st,2nd and 3rd line's have a,b,c,d as the taxes and for 4th and 5th having a,b as taxes.
Now i need to print the report in such a manner that,first i need to print all the three lines (1,2,3) and then need to print there taxes(a,b,c,d).
and then need to print 4th and 5th line and followed by taxes(a,b) which the both line contains.
Waiting for you valuable comments..
Thanks in Advance.....
RR

Hi Salim,
Sorry for this all scripts...
I am posting you all the required data needed.
Please run all the queries so that you will get required information.
--****Creating of PO Header Table *******
create table po_num
(po_num number,
po_header_id number)
--*****Inserting***
insert into po_num
values
(101,1001)
insert into po_num
values
(102,1002)
--****Creating of PO Line Table *******
create table po_lines
(line_num number,
po_header_id number,
po_line_id number,
item varchar2(100))
--*****Inserting***
insert into po_lines
values
(1,1001,1111,'Pen')
insert into po_lines
values
(2,1001,1112,'Mouse')
insert into po_lines
values
(3,1001,1113,'KeyBoard')
insert into po_lines
values
(4,1001,1114,'Book')
insert into po_lines
values
(5,1001,1115,'Desktop')
insert into po_lines
values
(6,1001,1116,'Wire')
insert into po_lines
values
(7,1001,1117,'Laptop')
--****Creating Tax Details Table *******
create table tax_table
(tax_name varchar2(100),
tax_descr varchar2(100),
po_header_id number,
po_line_id number)
insert into tax_table
values
('A','Tax for A ',1001,1111)
insert into tax_table
values
('B','Tax for B ',1001,1111)
insert into tax_table
values
('C','Tax for C ',1001,1111)
insert into tax_table
values
('D','Tax for D ',1001,1111)
insert into tax_table
values
('A','Tax for A ',1001,1112)
insert into tax_table
values
('B','Tax for B ',1001,1112)
insert into tax_table
values
('C','Tax for C ',1001,1112)
insert into tax_table
values
('D','Tax for D ',1001,1112)
insert into tax_table
values
('A','Tax for A ',1001,1113)
insert into tax_table
values
('B','Tax for B ',1001,1113)
insert into tax_table
values
('C','Tax for C ',1001,1113)
insert into tax_table
values
('D','Tax for D ',1001,1113)
insert into tax_table
values
('C','Tax for C ',1001,1114)
insert into tax_table
values
('D','Tax for D ',1001,1114)
insert into tax_table
values
('e','Tax for e ',1001,1115)
insert into tax_table
values
('C','Tax for C ',1001,1116)
insert into tax_table
values
('D','Tax for D ',1001,1116)
insert into tax_table
values
('e','Tax for e ',1001,1117)
--***********For Po Num - 102 ********
insert into po_lines
values
(1,1002,2221,'xxxx')
insert into po_lines
values
(2,1002,2222,'yyyy')
insert into po_lines
values
(3,1002,2223,'zzzz')
insert into po_lines
values
(4,1002,2224,'hhhh')
insert into tax_table
values
('A','Tax for A ',1002,2221)
insert into tax_table
values
('B','Tax for B ',1002,2221)
insert into tax_table
values
('A','Tax for A ',1002,2222)
insert into tax_table
values
('B','Tax for B ',1002,2222)
insert into tax_table
values
('A','Tax for A ',1002,2223)
insert into tax_table
values
('B','Tax for B ',1002,2223)
insert into tax_table
values
('A','Tax for A ',1002,2224)
insert into tax_table
values
('B','Tax for B ',1002,2224)
*** Select statement -
select po_num,po_header_id from po_num
where po_num = 101
select * from po_lines
where po_header_id = 1001
select * from tax_table
where po_line_id = 1111

Similar Messages

  • MIRO - One line and two Tax codes

    Hello dear all,
    If I have a reception (MIGO), one line item.
    But in the supplier invoice this line has two tax codes. How can we post it in MIRO, what can be the process ?
    Is anyone had similar case ?
    Regards

    please, check the note 395973 where it is explained in point 2:
    " If I want to use a different tax code in Transaction MIRO, what
      should I do?
    In the invoice verification, the tax is calculated based on the
    items in the entered invoice.If you want to set a different tax
    code, you must make this change in the item list.You can also use
    the tax tab page in the header area of the invoice, particularly
    when there are several tax codes in the document.If you enter a tax
    code on the initial screen that does not exist in the item list, the
    invoice cannot be posted (error FF812).This system response is
    programmed as such and is intended this way.
    For the default values in the input help for the tax code, refer to
    Note 336821. "
    I hope this information can help you.

  • PO line with Multiple Tax Codes

    Hi Everyone,
    Please guide me about the following query:
    If a PO line is created with amount :Rs.10000.
    Is it possible to apply Tax Code 'X' on 90% of the amount and Tax Code 'Y' on rest 10% of the amount?
    If yes, then please guide how?
    Please guide.
    Thanks and Regards

    Hi
    SAP STD system will not allow multiple tax codes for Single line item of Purchase order - Split the material into multiple line items and do enter the tax code respectively according to your requirement
    Regards
    Anand

  • Credit note split according to tax codes

    hi experts,
    i want to split my credit note (at time of creation) according to the tax codes. like the invoices are split at time of creation. anyone has any input on it ?
    akanksha

    hi experts,
    i want to split my credit note (at time of creation) according to the tax codes. like the invoices are split at time of creation. anyone has any input on it ?
    akanksha

  • Table for tax code line item after miro

    Can anybody tell table for tax code line item (other than BSET) after MIRO.
    Raj

    Hi,
    First let me explain you the logic in this repot. 
    If a document have more than one GL accounts relevant for tax and having the same tax code. So there is only one tax line for that tax code in BSET.
    Now in the standard reports like S_ALR_87012357, output has the tax base amount etc, based on tax line from BSET which is a single line the above document. However this single line contains multiple tax relevant account and thus SAP can not show all the G/L account for this single line in the report S_ALR_87012357. So SAP picks up the first account in the output.
    The declaration in this report is not wrong, as the total gets calculated based on the tax code and which is correct and meets the tax reporting requirement.
    If you want to see the G/L account wise output, you can use the program RFUMSV10. Refer OSS note 1175418 "RFUMSV00: G/L account display" for details.
    https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1175418
    In your report, you can use this program logic for reference.
    Regards,
    Gaurav

  • AP - Supplier Sites Invoice Tab - Diff Btwn Tax code and Line Level

    Hi All,
    In paybles options setup, the Invoice Tax calculation is set to LINE Level and Allow Tax Calculation Override check box is checked.
    While Defining the supplier, in the Invoice Tab of Supplier Sites, I changed it from LINE Level to Tax Code and unchecked the Allow Tax Calculation Override and Distribution Amounts Include Tax check box is Checked.
    How will this change Impact on while creating the Invoices. What will be the Diff when we change the Tax Calculation from LINE Level to TAX CODE.
    Help Appreciated.
    Thanks

    user449960,
    Your scenario is a functional issue, follow Sumit's advise. If you feel there is something related to OAF, put your thoughts here.
    --Shiv                                                                                                                                                                                                                                                                                                                       

  • Tax code missing in local sales GL line item

    Hi,
    When I released Accounting document from local sales billing, I found in that RV type accounting document, the GL 40000120 (Local Sales) line item's tax code was not defined.  Is this a correct posting?
    When I tried for intercompany sales order, the tax code was defined in that GL 40000130 (Intercompany Sales) line item.
    So I am confusing here.  is this a system standard behavior that no tax code defined in GL line item for local sales?  or I miss some configuration setting in IMG?

    Hi Arun,
    I am using VK11 to determine the tax code.
    I attached the screenshot for the accounting document that auto posted by billing for reference.  hope that will help to state my problem clearly.
    that screenshot 1 showed the tax code only appeared on the TAX G/L account, I assumed the tax code should be showed at REVENUE G/L account which is 40000120 - Local Sales as well.
    I checked the billing's item condition detail for condition type (ZNV2 - Net Value), in Account determination part, I saw information for Account Key = ERL, G/L Account = 40000120, but tax code is missing.  (please refer screenshot 2).
    Could that be the reason why the tax code is not assigned to GL 40000120 when generating accounting document?
    thanks.
    regards,
    FLL

  • Report for Sales and purchase tax (selection criteria-Tax code)

    Hi
    I have one query for sales tax details which gives me detail for all A/R invoices and taxes involved in it. But i want that while executing query system should ask tax code and gives detail of tax amount in front of item and invoice according to tax code selected.
    The query is:
    SELECT M.DocNum AS 'Inv.No ', M.DocDate as 'Date', M.CardName as 'Customer Name',L.Dscription,L.Quantity,L.Price, (Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)', (SELECT Avg(TaxRate) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ', (SELECT Avg(TaxRate) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT % ', (SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as ' TAXEXEMPT ', (SELECT Avg(TaxRate) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as ' VAT% ', (SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'VAT12.5 ', (SELECT Avg(TaxRate) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST 2% ', (SELECT Sum(TaxSum) FROM INV4 where statype=9 and DocEntry=M.DocEntry) as ' CST @2 ', (SELECT Avg(TaxRate) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST % ', (SELECT Sum(TaxSum) FROM INV4 where statype=11 and DocEntry=M.DocEntry) as ' CENVCST ', (SELECT Avg(TaxRate) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as ' BED ', (SELECT Avg(TaxRate) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess% ', (SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as ' Cess ', (SELECT Avg(TaxRate) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' HCess % ', (SELECT Sum(TaxSum) FROM INV4 where statype=-55 and DocEntry=M.DocEntry) as ' Hcess ', L.LineTotal as 'Row Total (Rs.)',M.DocTotal as 'Doc Total' FROM OINV M LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry WHERE (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]') AND TargetType ! = 14 GROUP BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal ORDER BY M.DocNum,M.DocDate,M.CardName,M.NumAtCard,M.DocEntry,M.DiscSum,M.WTSum,L.Dscription,L.Quantity,L.Price,L.LineTotal,M.DocTotal
    I want 2 queries which asks tax code during selection criteria for both cases sales and purchase.

    Hi Malhotra,
    Try this,
    1st remove the FROM/TO Doc. Date where Condition in your Query report.
    AND add the below where condition in your Query report.
    WHERE statype = '[%0]'
    OR
    Try this Query Report.
    SELECT
    M.DocNum as 'A/R Invoice No.',
    M.DocDate as 'Inv. Date',
    M.CardCode as 'Customer Code',
    M.CardName as 'Customer Name',
    M.NumAtCard as 'Bill No. & Date',
    ISNULL(L.ItemCode,'Service Item') as 'Item Code',
    L.Dscription,
    L.Quantity,
    L.LineTotal,
    L.TaxCode,
    L.[VatSum],
    M.WTSum AS 'TDS (Rs.)',
    M.DocTotal as 'Total (Rs.)'
    FROM OINV M
    LEFT OUTER JOIN INV1 L on L.DocEntry=M.DocEntry
    LEFT OUTER JOIN INV4 T on T.DocEntry=L.DocEntry and L.LineNum=T.LineNum
    LEFT OUTER JOIN INV5 J ON M.DocEntry = J.AbsEntry
    LEFT OUTER JOIN INV3 Q ON M.DocEntry = Q.DocEntry
    WHERE
    (M.DocDate >= '[%0]' AND M.DocDate <= '[%1]')
    AND
    L.TaxCode='[%2]'
    GROUP BY
    M.DocNum,M.DocDate,M.CardCode,M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    L.LineTotal,M.DocEntry,M.[DiscSum],L.TaxCode,L.[VatSum],M.WTSum,M.DocTotal
    ORDER BY
    M.DocNum,M.DocDate,M.CardCode,M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    L.LineTotal,M.DocEntry,M.[DiscSum],L.TaxCode,L.[VatSum],M.WTSum,M.DocTotal
    Regards,
    Madhan.

  • Two tax codes in MIRO

    Dear All,
    We are having a scenario in which we make freight payment to vendor for import purchase.  But while making freight payment we have 3 different components say A, B, C, out of the three the vendor charges service tax on two A and B, but not on C.
    While making invoice in MIRO i have given V0 tax code at header and for condition C at item level. And accordingly maintained tax code S1 at line item level for A and B. But still the system does not calculate tax for the line item A and B, gives error as tax code S1 does not exist in TAXINN.
    Have maintained all the necessary tax conditions in FV11.
    Request to kindly do let us know is there any other way we can execute the following scenario or where have we left out.
    regards,
    mahesh.

    hi
    try using single tax code S1
    if still error is comming then check following
    u have given proper condition in FV11
    now check ur tax code
    in which for that condition check the transaction key and for this transaction key check the gl acct in OB40
    or in ftxp select the transaction key and click on g/l acct u should get the gl acct for that key here
    if it is not there assign it in OB40
    u will find many threads for this "tax code doesnot exist in taxinn"
    hope it help
    regards
    kunal

  • Remove tax code in billing document

    Hi
       In sales billing, accounting entries for  account key ERL is as below
    PK Account    Account short text   Tx
    01 10000001   Customer                  A0
    50 40001001   Gross Sales - Trade  A0
    The requirement is to remove tax code (A0) from posting in customer account (10000001 ) i.e. it should look like below
    PK Account    Account short text   Tx
    01 10000001   Customer                 
    50 40001001   Gross Sales - Trade  A0
    I could not find any standard solution to this. Can you please suggest what will be best way to achieve this without impacting other processes.
    Thanks in advance.

    Hi,
    1. Kindly make the tax code field 'Suppressed' at the customer's account group level to avoid having tax code getting filled in customer line items.
    2. Using &sap_edit at table level, kindly remove the value of tax code from the customer line item. This will not have any impact as the tax amount are relevant for GL line items and it is more important to populate this information for GL line items.
    3. You can also opt for a substitution rule based on the business requirement.
    BR, D'nesh

  • How to enter multiple TAX codes in MIRO

    Dear Experts,
    I have a scenerio, I created a purchase order with single line item. But I recieve the Invoice with 3 different tax codes for different amounts.
    How can I enter multiple Tax codes in MIRO for a single purchase order.
    Regards
    SK

    Hi
    If you have ordered 3 items in your PO for the same vendor with 3 different Tax codes then obviously you have  to process the MIRO thrice for each line item and Tax code, since at any given time MIRO can process only One Tax Code at Header Level ( select tax code)
    Regards

  • PR to PO Tax code

    Hello,
    I am stuck in conversion issue.
    User wants to to convert PR to PO automatically and if there is no Info record for material then we need to fix the tax code.
    Basically we want to avoid putting tax code again if info record does not exist and PR to PO should convert automatically.
    We need to fix tax codes on the basis of material groups. E.g ABC material group comes then use V1 tax code.. XYZ comes then V2 tax code. There are about 5-6 material groups for which we need to fix that.
    Please let me know if there is any way to achieve this.
    Thanks for help
    Regards
    Himanshu

    Hello,
    Just to correct one thing.
    I need to convert PR to PO and and did not want manual intervention. i.e. if i dont have info record then i should not enter tax codes manually like V0, V1, V2 etc. But want to fix for purchasing groups.
    If AB purchasing group comes then V1 is fixed if BC purchasing group comes then V0 etc.
    In my previous post i mentioned on the basis of material group. That i wanted to correct.
    Is there any way avilable that i dont have info record still PR converted to PO without manual tax code entry.
    Thanks
    Himanshu

  • Tax code should be valid for A/P error

    Hello,
    I have created a new company and setup all the master data and G/L determination information. The account payable is also set for the vendor. On the line item the tax code has the A/P account set. When I try to add a new purchase order I get an error "Tax code should be valid for A/P[Purchase Order - Rows - Tax Code]"
    How can I fix this?
    Thanks & Regards,
    Sheetal

    TaxCode object in the DIAPI has a property called "ValidForAP". It was set to "N" hence the error. The warehouseinfo had this taxcode set and when the item was added to the purchase order the same tax code got set automatically. Hence the add on Purchase order would fail with the message.
    Regards,
    Sheetal

  • Deactivate Tax Code

    Hi,
    Can anyone please tell me "How to deactivate a tax code" not deactivating a line in the tax code.
    Regards,
    Mohan

    i dont think that is available.
    use the personal list option  at the time of selection.
    here you select only valid(active ) tax codes.
    chandra

  • FTXP - activate tax code

    hi,
    Pl. help me in activating a line in a Tax code in
    Transaction FTXP  which is in deactivated state.
    Regards
    Darshana

    Can you tell me which SAP version u r using and which Tax Procedure u r using TAXINN or TAXINJ
    To Activate the line first go to SPRO
    Financial Accounting --> Financial Accounting Global Settings (New) --> Tax on Sales/Purchases --> Basic Settings --> Check Calculation Procedure
    After executing Check Calculation Procedure select Define procedure there you select your Tax procedure whether TAXINN or TAXINJ which ever is activated in ur company.
    {pls chk in FTXP  for which Condition Type & for which level you want to activate that.}
    Then after selecting the Procedure TAXINN or TAXINJ, double click on Control Data
    There you can see the procedure defined, over there three check boxes column u can see, then for which Condition Type & for which level you want to activate you just remove the tick from any of  the check boxes relevant to your Condition type & Level. Then SAVE see the effect in FTXP
    If sufficient provide Points

Maybe you are looking for