Show to show Sales Order, Return, Delivery Quantity

Hi all,
See the following query of sales order with combination of Return, Delivery and AR invoice.........and tell how to show Quantity of Sales, return and delivery.........
SELECT b.Doc_Num1 as 'SO. No.',
b.DocDate1   as      'SO. Date',
b.Doc_Num2   AS      'Del.Doc.No.',
b.DocDate2    AS      'Delivery Date',
b.Doc_Num3   as      'A/R Invoice No.',
b.DocDate3    as      'Inv. Date',
b.Doc_Num4   AS      'RETURN Doc.No.',
b.DocDate4    as      'Ret.Date',
b.CardName   as      'Vendor Name',
b.NumAtCard  as      'Bill No. & Date',
b.ItemCode   as      'Item Code',
b.Dscription as      'Dscription',
b.Quantity1  as      'AR Invoice Quantity',
b.LineTotal  as      'Base Amt.(Rs.)',
b.WTSum           AS      'TDS (Rs.)',
b.DocTotal    as     'Total (Rs.)',
sum(b.BED)    as           'Bed Value',
sum(b.EDCS)   as          'EDCS Value',
sum(b.HECS)   as          'HECS Value',
sum(b.VAT)        as           'VAT Value',
sum(b.CST)        as           'CST Value',
sum(b.CVD)        as           'CVD Value',
sum(b.SerTax)  as           'SERTAX Value',
sum(b.CSonSerTax) as      'CS Value',
sum(b.HECS_ST)      as      'HESC Value' 
from (
select *,( a.Bed + a.EDCS + a.HECS + a.VAT + a.CST +a.CVD + a.SerTax + a.CSonSerTax  + a.HECS_ST ) as Filter from (SELECT distinct
T0.DocNum as 'Doc_Num1',
T0.DocDate as 'DocDate1',
T2.DocNum as 'Doc_Num2',
T2.DocDate as 'DocDate2',
M.DocNum as 'Doc_Num3',
M.DocDate as 'DocDate3',
M.CardName,
M.NumAtCard,
L.ItemCode,
L.Dscription,
L.Quantity as  'Quantity1',
S.DocNum 'Doc_Num4',
S.DocDate as 'DocDate4',
L.LineTotal ,
M.DocEntry,
M.[DiscSum],
M.WTSum,
M.DocTotal,
(case T.Statype
when
-90 then sum (T.[TaxSum]) / 4 else 0 end) 'BED ',(case T.Statype when
-60 then sum (T.[TaxSum]) / 4 else 0 end) 'EDCS ',(case T.Statype when
7 then sum (T.[TaxSum]) / 4 else 0 end) 'HECS ',(case T.Statype when
1 then sum (T.[TaxSum])  / 4 else 0 end) 'VAT',(case T.Statype when
4  then sum (T.[TaxSum]) / 4  else 0 end) 'CST ', (case T.Statype when
10 then sum (T.[TaxSum]) / 4  else 0 end) 'CVD ', (case T.Statype when
5  then sum (T.[TaxSum]) / 4  else 0 end) 'SerTax', (case T.Statype when
6  then sum (T.[TaxSum]) / 4  else 0 end) 'CSonSerTax', (case T.Statype when 
8 then sum (T.[TaxSum]) / 4 else 0 end) 'HECS_ST'

Hi Sonal,
Try this,
SELECT b.Doc_Num1 as 'SO. No.',
b.DocDate1   as      'SO. Date',
b.Doc_Num2   AS      'Del.Doc.No.',
b.DocDate2    AS      'Delivery Date',
b.Doc_Num3   as      'A/R Invoice No.',
b.DocDate3    as      'Inv. Date',
b.Doc_Num4   AS      'RETURN Doc.No.',
b.DocDate4    as      'Ret.Date',
b.CardName   as      'Vendor Name',
b.NumAtCard  as      'Bill No. & Date',
b.ItemCode   as      'Item Code',
b.Dscription as      'Dscription',
b.Quantity1  as      'SO_Qty',
b.Quantity2  as      'DLN_Qty',
b.Quantity3  as      'A/R Inv_Qty',
b.Quantity4  as      'Return_Qty',
b.LineTotal  as      'Base Amt.(Rs.)',
b.WTSum           AS      'TDS (Rs.)',
b.DocTotal    as     'Total (Rs.)',
sum(b.BED)    as           'Bed Value',
sum(b.EDCS)   as          'EDCS Value',
sum(b.HECS)   as          'HECS Value',
sum(b.VAT)        as           'VAT Value',
sum(b.CST)        as           'CST Value',
sum(b.CVD)        as           'CVD Value',
sum(b.SerTax)  as           'SERTAX Value',
sum(b.CSonSerTax) as      'CS Value',
sum(b.HECS_ST)      as      'HESC Value' 
from (
select *,( a.Bed + a.EDCS + a.HECS + a.VAT + a.CST +a.CVD + a.SerTax + a.CSonSerTax  + a.HECS_ST ) as Filter from (SELECT distinct
T0.DocNum as 'Doc_Num1',
T0.DocDate as 'DocDate1',
T2.DocNum as 'Doc_Num2',
T2.DocDate as 'DocDate2',
M.DocNum as 'Doc_Num3',
M.DocDate as 'DocDate3',
M.CardName,
M.NumAtCard,
L.ItemCode,
L.Dscription,
T1.Quantity as  'Quantity1',
T3.Quantity as  'Quantity2',
L.Quantity as  'Quantity3',
X.Quantity as  'Quantity4',
S.DocNum 'Doc_Num4',
S.DocDate as 'DocDate4',
L.LineTotal ,
M.DocEntry,
M.[DiscSum],
M.WTSum,
M.DocTotal,
Regards,
Madhan.
Edited by: Madhan Babu C on Aug 28, 2009 2:09 PM

Similar Messages

  • Quantity and Price Totals on Sale Order and Delivery Order

    Dear ABAP Gurus,
    I want to add totals of line items (Quantity and Price) in sale order and delivery order screens. Can you please guide me how to do this. The price can be any from pricing procedure ie exclusive or inclusive price of sales tax.
    regards,
    RSA
    Moderator message : Requirements dumping not allowed, show the work you have already done, thread locked.
    Edited by: Vinod Kumar on Jan 28, 2012 9:23 PM

    Hi,
    Try this :
    IF @transaction_type in ('A','U') AND (@OBJECT_TYPE='22')
    BEGIN
    If exists (SELECT t3.docentry FROM OWOR T0  INNER JOIN WOR1 T1 ON T0.DocEntry = T1.DocEntry left join POR1 T2 on T2.[U_JONum] = T0.[OriginNum] and  T0.[ItemCode] =  t2.U_SubConItem] INNER JOIN OPOR T3 ON T2.DocEntry = T3.DocEntry WHERE T1.[PlannedQty] <> T2.[Quantity] and  T1.[ItemCode]  = 'subcon' and  T3.DocEntry = @list_of_cols_val_tab_del )
    Begin
    SET @error = 10
    SET @error_message = 'Not allowed to add more than planned'
    End
    End
    Thanks & Regards,
    Nagarajan

  • Can't change quantity when copy from Sale order for Delivery

    Hi all!
    Can i use authorization for can't change quantity when copy from Sale order for Delivery.

    Tien,
    Approval will not work when you have mutiple rows of data.  You would have to work with SP Transaction Notification
    There has been threads before on the forum on the same topics.
    Block the Quantity in Sales Delivery
    Approval Procedure for chaning quantity in Delivery Document
    Suda

  • Quantity is different from sale order and delivery

    Hi,
    Gurus,
    Quantity is different from sale order and delivery.
    I identified the Material in the sales order, the item category for this material as BOM.
    I have also checked the bill of material display header overview. The Base Quantity maintained as 1000 EA3. The SUBITEM maintained in G in the unit field in bill of material display.
    Accordingly i have checked the same for material master's additionl data in Units of Measure tab, it is mentioned the basic unit as 1000 EA3 and alternative unit as 600 G.
    My client processed the order for 100 QTY. The QTY for the two sub item is 99.601 each in the sale order.
    My client Question is why in delivery the Material Qty is coming as 99.730 and the SUB ITEM is coming as 99.330 EACH.
    Note:- The material X is maintained in EA3 in Bill of material header overview. I do no how the sale unit came as G for the Material in sale order.
    The other two sub item is perfectly coming as G. Because it is maintained in G in the Bill of Material Display.
    Guide me GURUS.
    Thanks and Regards,
    ANAND

    Hello Rumar
    I guess you entered the text manually in the sales order. The Ship-to may not be having any text, but the Sold-to may be and it may be coming from sold to.
    In transaction VOTXN, check the access sequence for the text type id and see which one takes precedence - one from customer master or from the order by checking the order of accesses.

  • PO is incorrectly showing in other sale order document flow

    Hi expwrs please help me on this issue. One PO is incorrectly showing in other sale order document flow and there is no relationship between PO and sale order. Why it is showing incorrectly.

    Hi,
    First you check the SO created with reference and then check teh PO type (based on item category).
    I think with of any reference the PO will never show on doc flow,

  • Error while doing PGR (post goods issue for sales order return)

    Hello Gurus,
    I'm trying to do PGR for a sales order return. But system shows the following message: "Shortfall below the specified stock level or quantity amounting to 100 UN". (Message number : M7021)
    I've made some searches in SD forum but I didn't fnd appropriate answers.
    What does it mean ? How can I fix it ?
    Thank you,
    Bahia.

    Hi
    "Special Stock E not supported (check your entry)".
    This means your sales order (in your case the returns order ) is created with an item category which is marked with special stock indicator E  in VOV7 and the system is checking for that special stocks and it is not finding that
    When you mark any item category  with special stock indicator it can be E or Q or W ( it can be anything ) system will check for that particular stock category and not the general unrestricted stocks
    For you mistake can be two things
    1. Right now REN or RENN is wrongly marked with special stock indicator E  in VOV7
    If so remove that and try a fresh cycle
    2.The process you are right now doing is returns
    The original sale would have happened with special stock indicator E marked in its item category
    That means it is special stock
    That stock you might be trying to take it into general stocks now
    In that case right now you need to mark REN or RENN with special stock indicator E
    Note whenever you put your hand in VOV7 create a fresh order cycle and test and dont test it with already created order
    Note touching requirement classes are all big things to do in a project and not advisable lot many mistakes we can correct itself if we know order type ,item category and schedule line category
    Regards
    Raja

  • SALES ORDER NO & DELIVERY NO

    Dear All,
    In a sales return scenario i am using inspection type 05,at the time of PGR system is inspection lot with mvt. type 655,my query is i want to get sales order no & delivery no so that i can create notification on the basis of that.I have saved one layout but in QA32 screen but when i am QA32 with inspection type 05,it is not showing sales order no and delivery no.Kindly help me to resolve this issue.
    With Regards.

    hi,
    u create a notification manually or that notification created in bckgrnd while ur RR.
    If it is bckgrnd genrated notification against lot than definitely u get those fields in ur layout. and if u create notification manually than in initial screen u need to enter the sales order / delivery order number.
    if it is bckgrnd one than system shows F1 and if it is manual than it is Q1.
    Regards

  • MD04 and PO return delivery quantity with exception message 15

    Hi, Please suggest me how to get rid of PO return delivery quantity from MD04 where it is showing as POitem with receipt quantity and exception message 15 - reschedule out and reschedule date is showing current date.
    Here we have received x qty from vendor and then moved y qty to blocked stock and then did return delivery (here return delivery did without any reference), we will not receive y qty anymore in future, how to get rid of this qty from MD04.

    Hello
    Please refer to the following note for more details about this scenario:
    634038 - MRP: Returns order and delivery
    This note explains in detail the customizing settings that you might use to turn a return delivery not relevant to MRP.
    Best Regards
    Caetano Almeida

  • Report:SALE ORDER Vs DELIVERY

    Hi Guru's,
          Am creating a report for my client that is Delivery performance Month Wise
    this report should display  the customer wise Sales information like  ordered qty delivered qty then open qty for every month.
    So where i can fetch these information and how can i display the report
    Regards,
    Guru
    Edited by: Vijay Guru on Aug 28, 2008 11:11 AM

    HI Vijay,
    I executed the query in 'Query Manager' and it executed fine prompting me to choose the 'Dates'.
    I think you are making mistake somewhere which Iam not able to judge.
    And you cannot execute the query in SQL Server Query Analyser coz the
    [%0] and [%1]
    works only with SAP 'Query Manager'
    untill to identify the error you can use the following query
    SELECT T1.[DocNum] as 'Sales Order No', T1.[DocDate] as 'Sales Order Date',
    T1.[CardCode], T1.[CardName], T0.[ItemCode], T0.[Dscription], T0.[Quantity]
    as 'Sales Order Qty', T0.[Quantity]-T0.[OpenQty] as 'Delivered Qty', T0.[OpenQty] as
    'Balance Qty' FROM RDR1 T0  INNER JOIN ORDR T1 ON T0.DocEntry = T1.DocEntry
    where T1.[DocDate] between '2008/04/01' and '2008/04/30'
    you can change the dates in the query as per the need.

  • In Sale Order and Delivery - Inventory should be effect

    Dear Experts,
    i am having a scenario that in sales order and delivery, on material items inventory should not be effected.
    How i can acheive this.
    Please let me know the solution.
    With Regards

    Hi Mr.Rachumallu,
    I am not very sure about your question but if my understanding is right, you can acheive it through the VTLA Tcode and for the Item category of the suitable delivery and sales document combination you need to maintain the pos/neg quantity as "Zero".
    I hope I am helping you.
    Regards
    Vijay

  • Sales Order  VS Delivery Alert

    Dear Experts ..
    My client need a following Alert .....
    EXP:--
    If My Sales Order No 1  quantity is 100 and i delivered 110 base on sales Order No 1 at that time required to send  a alert  as per assign user...
    please Provide me the query for the same..
    Thanks and Regards
    Manegsh Pagdhare.

    Hi
    The following alert lets you view the amount that is exceeded in delivery of sales order
    declare @cant as int
    declare @cant2 as int
    declare @ultentg as int
    set @ultentg = (select max(t0.docnum) from odln t0)
    set @cant = (select sum(t1.quantity) from odln t0 inner join dln1 t1 on t0.docentry = t1.docentry where t0.docnum = @ultentg)
    set @cant2 = (select sum(t1.quantity) from ordr t0 inner join rdr1 t1 on t0.docentry = t1.docentry where t1.targettype = '15' and t1.trgetentry = @ultentg)
    if @cant > @cant2
    begin
    select t1.itemcode as 'ItemCode', t1.dscription as 'Product', t4.quantity as 'Quantity Sales Order', t1.quantity as 'Quantity Delivery' from odln t0 inner join
    dln1 t1 on t0.docentry = t1.docentry inner join ordr t3 on t1.baseentry = t3.docnum inner join rdr1 t4 on t3.docentry = t4.docentry
    where t0.docnum = @ultentg and t1.itemcode = t4.itemcode and t1.quantity <> t4.quantity
    end
    Greetings

  • BAPI For Create Goods Issue for Sales order with picked quantity

    Hi friends,
            Is there any BAPI available to create Goods issue For sales order with picked quantity...............?
    we hv used BAPI_OUTB_DELIVERY_CREATE_SLS
    with sales order .......its creating delivery order but not doing goods issue with piked quantity........

    pls,reply its argent

  • Sales Order and Delivery

    Hii
    Is it possible to delete the sales order and delivery documents after adding it.
    for eg.
    Customer C001 created sales order and then made delivery.
    Is it possible to delete that sales order and delivery document and trasactions done related to it.what will be its impact.
    Can we do this.
    reply
    Thanks
    Neetu

    Neetu,
    Change posting period if delivery is not in current month.
    In 2 ways you can return a delivery
    1. Copy To from delivery.
    2. Copy From from return.
    You can return using any of 2 ways as below
    1.Open reqd. delivery click Copy To and select return,
    Change posting date,due date,document date if required,
    once again apply tax code it is removed on changing posting date,Check Doucment total match with delviery
    enter remarks for returning.Click Add to save it.
    2. Open return select required customer code,enter posting
    date,due date & document date as in delivery,Click Copy From
    Select required delivery,Use document wizard,Copy all data,
    Click add to save it.
    3. If items are excisable then copy return to incoming
    excise invoice,Enter excise reference number in it,
    Click add to save it.
    Now return process is completed,status of sales order & delivery & and also return document.
    Jeyakanthan

  • Abap Report including sales orders and delivery data.

    Hi Experts,
    I Want to develop a new abap report which would contain the data for sales orders and delivery.
    I want to fetch all the sales orders based on the ship date (LIKP-WADAT_IST) of the delievry.
    Could anyone please let me know how to fetch teh data or is their any function module which would help me to solve my problem.
    <Removed by moderator>
    Thanks,
    Komal.
    Moderator message : Spec dumping not allowed. Thread locked.
    Edited by: Vinod Kumar on Aug 10, 2011 1:25 PM

    post this in ABAP forum for quicker response.
    Regards
    Raja

  • Link Sale Order with Delivery  through DTW

    Hi All
    While importing Deliveries through DTW, is it possible to Link a Sale Order with Delivery?
    If it is possible then can any one tell me the procedure.
    Thanks in Advance
    Chakrapani Bandaru

    In the template for the document lines, you will find fields for base entry, base type and base line . Fill these with the object type for sales orders, the line number and the doc entry (not doc num) of the relevant linked document

Maybe you are looking for