How to make a query which gives sales tax as output

can any body help me, I am making a report for sales tax i only want the amount of VAT & CST in the output of the query, as we are manufacturer so we charge both excise duty & Sales tax from customer, i only want the system to retrieve cst & vat amount. when i am making a query on oinv table it is giving the total tax amt as output.

Hi
SELECT  T0.DocNum as 'SO. No.',
T0.DocDate as 'SO. Date',
T2.DocNum AS 'Del.Doc.No.',
T2.DocDate AS 'Delivery Date',
M.DocNum as 'A/R Invoice No.',
M.DocDate as 'Inv. Date',
M.CardName as 'Vendor Name',
M.NumAtCard as 'Bill No. & Date',
ISNULL(L.ItemCode,'Service Item') as 'Item Code',
L.Dscription,
L.Quantity,
(Select Sum(LineTotal) FROM INV1 L Where L.DocEntry=M.DocEntry) as 'Base Amt.(Rs.)',
(SELECT Sum(TaxSum) FROM INV4 where statype=-90 and DocEntry=M.DocEntry) as 'ED (Rs.)',
(SELECT Sum(TaxSum) FROM INV4 where statype=-60 and DocEntry=M.DocEntry) as 'EDCS (Rs.)',
(SELECT Sum(TaxSum) FROM INV4 where statype=7 and DocEntry=M.DocEntry) as 'HECS (Rs.)',
(SELECT Sum(TaxSum) FROM INV4 where statype=1 and DocEntry=M.DocEntry) as ' VAT (Rs.) ',
(SELECT Sum(TaxSum) FROM INV4 where statype=4 and DocEntry=M.DocEntry) as ' CST (Rs.) ',
(SELECT Sum(TaxSum) FROM INV4 where statype=10 and DocEntry=M.DocEntry) as ' CVD (Rs.) ',
(SELECT Sum(TaxSum) FROM INV4 where statype=5 and DocEntry=M.DocEntry) as ' Ser.Tax (Rs.) ',
(SELECT Sum(TaxSum) FROM INV4 where statype=6 and DocEntry=M.DocEntry) as 'CS on Ser.Tax (Rs.)',
(SELECT Sum(TaxSum) FROM INV4 where statype=8 and DocEntry=M.DocEntry) as 'HECS_ST (Rs.)',
(Select Sum(LineTotal) From INV3 Q Where Q.DocEntry=M.DocEntry) AS 'Freight (Rs.)',
M.WTSum AS 'TDS (Rs.)',
M.DocTotal as 'Total (Rs.)'
FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN ODLN T2 ON T2.DocEntry = T1.TrgetEntry
INNER JOIN DLN1 T3 on T3.DocEntry = T2.Docentry
INNER JOIN OINV M ON M.DocEntry = T3.TrgetEntry
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]'
GROUP BY
T0.DocNum,T0.DocDate,T2.DocNum,T2.DocDate, M.DocNum,M.DocDate,M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
ORDER BY
T0.DocNum,T0.DocDate,T2.DocNum,T2.DocDate, M.DocNum,M.DocDate,M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
U can modify this query little bit as per ur Need
Giri

Similar Messages

  • How to make the status of a sales order complete of which PART DELIVERY

    How to make the status of a sales order complete of which PARTIAL DELIVERY has already done. <b>(Assigning rejection status not accepted)</b>

    Hi Gyana
    There is no document with me. But I can confidently say that because I am using this functionality.
    In my case I have created a Order Reason as "Short Closed". once you short close this order only the balance quantity gets rejected (provided you have already made previous delivery and PGI).
    Try it in one of your test clients if you have. Once it is short Closed it wont also show in the orders due for processing in Production.
    Also you can generate reports based on this if your customer wants to know how many order he has short closed, qty of item short closed etc.
    Try it.
    Rgds
    Sunil

  • How to make all fields mandatory in sales order T- code VA01 initial screen

    Dear all,
    how to make all fields mandatory in sales order T- code VA01 initial screen itself
    The fields are
    Sales Organization
    Distribution Channel
    Division
    Sales Office
    Sales Group
    Regards,
    Amar Reddy

    Hi,
    You can use Transaction Variant to achieve this functionality.Please go through the following link which helps you in creating the same.
    [Link|http://wiki.sdn.sap.com/wiki/display/Snippets/TransactionVariant-AStepbyStepGuidefor+Creation]
    Regards,
    Phani Prasad

  • How to make af: query (ResultComponentId) has two target values?

    hello all :D
    i'm newbie in jdev, i have little problem with af:query.
    how to make af: query (ResultComponentId) has two target values?
    thx
    agungdmt :D

    I think you can simply set the second target control's partialTrigger to the af:query.
    and access to the same binding attribute as your first target. (e.g.: if you have 2 target tables, set the value to #{bindings.XxxxxVO1.collectionModel})
    Samson Fu

  • How to make a query to list out Journal voucher that hasn't been posted

    Hi, do you know how to make a query to list out Journal voucher that hasn't been posted?
    By what code name identify that?
    Thanks.
    Raymond
    Edited by: Rui Pereira on Aug 6, 2008 3:57 PM

    jack,
    there is no link with OBTD to OJDT and JDT1.
    voucher number in obdt is different,
    after posting voucher is saved as journal entry seperate
    number is generated.
    you can link OACT,OCRD WITH OJDT,JDT1.
    Jeyakanthan

  • How to make all the rows editable in webdynpro alv output

    Hi,
    How to make all the rows editable in webdynpro alv output.
    Thanks
    Rakshar

    Hi Rakshar,
    Check this wiki:
    http://wiki.sdn.sap.com/wiki/display/WDABAP/HowtoeditconditionallyrowofaALVtableinWebDynprofor+ABAP
    Regards

  • How to make plant mandatory field in Sales order thru standard SAP process

    Hello,
    There is requirement in business that User wants to make plant field Mandatory in Sales order line item once material number is entered. Can you please guide me how I can make Plant field mandatory thru Standard SAP process.
    I had checked it thru Incompletion process & Order type incompletion messages but still Plant field is not becoming mandatory in Sales order. It only gives incompletion log while saving the SO. Please suggest how to do it thru Standard SAP process.
    Thanks & Regards,
    Saurabh

    HI
    Plant will determine based on Customer-material Info Record, Customer Master data & material Master
    If plant is not mandatory in customer Master and Customer material no problem
    but at the time of creating the material master  Plant Mandatory as per my knowledge, so system will pick plant from Material master  that is the case why you required plant Mandatory in Sale order level
    and you need to do Shipping Point Determination for that plant
    Did you check by using User Exit ? if not try once what i have suggested
    Try with User Exit
    MV45AFZZ , FORM USEREXIT_SAVE_DOCUMENT
    VBAP - WERKS = " "
    if VBAP - MATNR , POSNR = not initial
    Error Messgae "E"
    Check and Revert
    Regards,
    Prasanna
    Edited by: prasanna_sap on Feb 14, 2012 11:41 AM

  • How To Make Search Query Showing the Result As List of Buttons.

    Can some one give me an idea how to start to make a Search Query showing the results as list of buttons.. i have already have my buttons with names. i just dont know how to make a search query.
    this is my on screen keyboard i made..
    im making a system that the result were a list of buttons.. showing like this
    This was supposed to be the output of the query that i need to do..
    Please help me.. i just need a idea or tips how to make this one.

    Here is code I posted recently for another question
    Public Class Form1
    Const BUTTON_SIZE As Integer = 20
    Const SPACE As Integer = 5
    Sub New()
    ' This call is required by the Windows Form Designer.
    InitializeComponent()
    ' Add any initialization after the InitializeComponent() call.
    Dim buttons As New List(Of List(Of MyRadioButton))
    For row = 1 To 6
    Dim newRow As New List(Of MyRadioButton)
    buttons.Add(newRow)
    For col = 1 To 6
    Dim button As New MyRadioButton()
    button.row = row
    button.col = col
    button.Height = BUTTON_SIZE
    button.Width = BUTTON_SIZE
    button.Left = col * (BUTTON_SIZE + SPACE)
    button.Top = row * (BUTTON_SIZE + SPACE)
    button.Name = String.Format("radGr1{0}_{1}", row.ToString(), col.ToString())
    Me.Controls.Add(button)
    newRow.Add(button)
    AddHandler button.CheckedChanged, AddressOf Radio_Change
    Next col
    Next row
    End Sub
    Private Sub Radio_Change(ByVal sender As Object, ByVal e As System.EventArgs)
    Dim button As MyRadioButton = CType(sender, MyRadioButton)
    Dim row As Integer = button.row
    Dim col As Integer = button.col
    End Sub
    End Class
    Public Class MyRadioButton
    Inherits RadioButton
    Public row As Integer
    Public col As Integer
    End Class
    jdweng

  • HOW TO MAKE MATERIAL DESCRIPTION  FIELD IN SALES ORDER AS UNEDITABLE

    how to make the material description field as un editable in sales order , pls help me

    Through Transaction Variant <b>SHD0</b>
    Refer the thread
    /message/4083386#4083386 [original link is broken]
    Message was edited by:
            SHESAGIRI.G

  • How to make the line items of sales order cannot be deleted.

    Hi All,
    Is there any Enhancement spots or user-exits which make the line items of sales order cannot be deleted if item category is 'TAN'.
    Thanks in Advance,
    Sudhakar Reddy .A

    Hi All,
    If you doesn't want to delete sales order line items then we have write in the Include Program which has mentioned below and in the form .....endform.
    Program Name :  Include MV45AFZB
    _Example:_
    form userexit_check_xvbap_for_delet using us_error
                                              us_exit.
    IF .......
      US_EXIT = CHARX.
    ENDIF.
    endform.

  • How to make the connection between a sale order and an invoice in SDK

    Hi,
    Im trying to make the connection between a sales order and an invoice using the SDK.
    Here is how i create each of them:
    Invoice:
    public int SalesInvoiceInternalSave(string buisnesspartnerCardCode, DateTime dueDate, double discountPercent, string id, IList<InternalItem> items, ref int invoiceId)
          int res = 0;
          SAPbobsCOM.Documents invoice_entry = (SAPbobsCOM.Documents)Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices);     
          invoice_entry.CardCode = buisnesspartnerCardCode;
          invoice_entry.DocDueDate = dueDate;
          invoice_entry.DiscountPercent = discountPercent;
          invoice_entry.Reference2 = id;
          foreach (InternalItem item in items)
            invoice_entry.Lines.WarehouseCode = item.Shopid;
            invoice_entry.Lines.ItemCode = item.Code;
            invoice_entry.Lines.ItemDescription = item.Name;
            invoice_entry.Lines.Quantity = item.Quantity;
            invoice_entry.Lines.UnitPrice = item.Price;
            invoice_entry.Lines.Add();
          res = invoice_entry.Add();
          return res;
    Sales order:
        public Boolean SalesOrderInternalSave(string orderId, string buisnesspartnerCardCode, DateTime dueDate, IList<InternalItem> items)
          SAPbobsCOM.Documents order_entry = (SAPbobsCOM.Documents)Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oOrders);
          order_entry.CardCode = buisnesspartnerCardCode;
          order_entry.DocDueDate = dueDate;
          foreach (InternalItem item in items)
            order_entry.Lines.WarehouseCode = item.Shopid;
            order_entry.Lines.ItemCode = item.Code;
            order_entry.Lines.ItemDescription = item.Name;
            order_entry.Lines.Quantity = item.Quantity;
            order_entry.Lines.UnitPrice = item.Price;
            order_entry.Lines.Add();      
          int res = order_entry.Add();
          return res == 0;
    What do i need to change to get the connection between the two of them?
    And how do you insert a amount (not percent) discount into an invoice?
    Regards,
    Torben

    Hi,
    Add the sale order, then add the invoice. and while adding the invoice please add the following details to the invoce documen
    invoice_entry.Lines.BaseEntry = 'Doc entry of the newly created SO
    invoice_entry.Lines.BaseLine = 'Line No of the SO
    invoice_entry.Lines.BaseType = 17 'For sales order document type.
    Hope it helps,
    Vasu Natari.

  • How to make dynamic query using DBMS_SQL variable column names

    First of all i will show a working example of what i intend to do with "EXECUTE IMMEDIATE":
    (EXECUTE IMMEDIATE has 32654 Bytes limit, which isn't enough for me so i'm exploring other methods such as DBMS_SQL)
    -------------------------------------------------CODE-----------------------------------
    create or replace PROCEDURE get_dinamic_query_content
    (query_sql IN VARCHAR2, --any valid sql query ('SELECT name, age FROM table') 
    list_fields IN VARCHAR2) --list of the columns name belonging to the query (  arr_list(1):='name';   arr_list(2):='age';
    -- FOR k IN 1..arr_list.count LOOP
    -- list_fields := list_fields || '||content.'||arr_list(k)||'||'||'''~cs~'''; )
    AS
    sql_stmt varchar (30000);
    BEGIN
                   sql_stmt :=
    'DECLARE
         counter NUMBER:=0;     
    auxcontent VARCHAR2(30000);     
         CURSOR content_cursor IS '|| query_sql ||';
         content content_cursor%rowtype;     
         Begin
              open content_cursor;
              loop
                   fetch content_cursor into content;
                   exit when content_cursor%notfound;
                   begin                              
                        auxcontent := auxcontent || '||list_fields||';                    
                   end;
                   counter:=counter+1;     
              end loop;
              close content_cursor;
              htp.prn(auxcontent);
         END;';
    EXECUTE IMMEDIATE sql_stmt;
    END;
    -------------------------------------------------CODE-----------------------------------
    I'm attepting to use DBMS_SQL to perform similar instructions.
    Is it possible?

    Hi Pedro
    You need to use DBMS_SQL here because you don't know how many columns your query is going to have before runtime. There are functions in DBMS_SQL to get information about the columns in your query - all this does is get the name.
    SQL&gt; CREATE OR REPLACE PROCEDURE get_query_cols(query_in IN VARCHAR2) AS
    2 cur PLS_INTEGER;
    3 numcols NUMBER;
    4 col_desc_table dbms_sql.desc_tab;
    5 BEGIN
    6 cur := dbms_sql.open_cursor;
    7 dbms_sql.parse(cur
    8 ,query_in
    9 ,dbms_sql.native);
    10 dbms_sql.describe_columns(cur
    11 ,numcols
    12 ,col_desc_table);
    13 FOR ix IN col_desc_table.FIRST .. col_desc_table.LAST LOOP
    14 dbms_output.put_line('Column ' || ix || ' is ' ||
    15 col_desc_table(ix).col_name);
    16 END LOOP;
    17 dbms_sql.close_cursor(cur);
    18 END;
    19 /
    Procedure created.
    SQL&gt; exec get_query_cols('SELECT * FROM DUAL');
    Column 1 is DUMMY
    PL/SQL procedure successfully completed.
    SQL&gt; exec get_query_cols('SELECT table_name, num_rows FROM user_tables');
    Column 1 is TABLE_NAME
    Column 2 is NUM_ROWS
    PL/SQL procedure successfully completed.
    SQL&gt; exec get_query_cols('SELECT column_name, data_type, low_value, high_value FROM user_tab_cols');
    Column 1 is COLUMN_NAME
    Column 2 is DATA_TYPE
    Column 3 is LOW_VALUE
    Column 4 is HIGH_VALUE
    PL/SQL procedure successfully completed.I've just written this as a procedure that prints out the column names using dbms_output - I guess you're going to do something different with the result - maybe returning a collection, which you'll then parse through in Apex and print the output on the screen - this is just to illustrate the use of dbms_sql.
    best regards
    Andrew
    UK

  • How to make linkage query In Data Model for search

    I want to make an linkage query as a condition for my  report in BI Publisher. how to make the linkage in Date Model ?

    This is the forum for SQL Developer, not for general SQL or PL/SQL questions.
    Please repost this in the SQL and PL/SQL forum.

  • How to execute a Query which exceeds 32K size?

    My Stored Procedure has one o/p parameter of REF CURSOR type. Based on the inputs,i'm forming the dynamic query which exceeds 32k size in length. So when i'm executing the proc it throws error.
    How can i execute the procedure contains dynamic query(>32k size) and get the result set through REF CURSOR type o/p parameter?
    I heared that it's possible through DBMS_SQL.PARSE() procedure. If it so, explain me in detail.
    Thanks!

    http://htmldb.oracle.com/pls/otn/f?p=2853:4:9265445064393730839::NO::P4_QA_ID:401

  • How to make this query

    hi,
    i have 2 tables emp1 & emp2
    emp1 consist
    empno month amt
    001 201002 200
    001 201003 100
    emp2 consist
    empno month amt
    001 201001 100
    001 201002 200
    001 201003 100
    i want to make a query on emp1 table where i want to show amt according to month ,if data is not available in emp1 table then only then it should take data from emp2 table ,if emp2 has that month data o/w 0.
    my output should be like this
    empno month amt
    001 201001 100
    001 201002 200
    001 201003 100
    regards

    May be....
    SQL> WITH emp1 AS (SELECT '001' empno,'201002' mon,200 amt FROM DUAL UNION ALL
      2                SELECT '001' empno,'201003' mon,100 amt FROM DUAL
      3                )
      4  ,emp2 AS   ( SELECT '001' empno,'201001' mon,100 amt FROM DUAL UNION ALL 
      5               SELECT '001' empno,'201002' mon,200 amt FROM DUAL UNION ALL
      6               SELECT '001' empno,'201003' mon,100 amt FROM DUAL
      7              )
      8   SELECT coalesce(e1.empno,e2.empno) empno,
      9          coalesce(e1.mon,e2.mon) mon,
    10          coalesce(e1.amt,e2.amt)amt
    11   FROM emp1 e1 FULL OUTER JOIN emp2 e2
    12   ON e1.empno =e2.empno
    13     AND   e1.mon=e2.mon
    14  ORDER BY 2   ;
    EMP MON           AMT
    001 201001        100
    001 201002        200
    001 201003        100

Maybe you are looking for