Order query by empty position - BEX query

Hi,
We need to order a BEX query by Invoice and Ascending Position (we need to see first the empty position #).
The type of the infoObject "Position" is NUMC (6).
We tried to convert it to char, but it didn't work.
We also ordered the query by position ascending, but the result we obtained is:
Invoice
Position
Material
Quantity
1
1
930100
20
1
2
930200
30
1
50
2
1
930200
70
2
70
3
1
930200
35
3
2
930100
25
3
60
We need to obtain this result:
Invoice
Position
Material
Quantity
1
50
1
1
930100
20
1
2
930200
30
2
70
2
1
930200
70
3
60
3
1
930200
35
3
2
930100
25
Any ideas?
Thanks in advance,
Florencia

Hi Kodanda, we've already tried the ascending order, but we're gettting this order:
nvoice
Position
Material
Quantity
1
1
930100
20
1
2
930200
30
1
50
2
1
930200
70
2
70
3
1
930200
35
3
2
930100
25
3
60
We need to obtain this result:
Invoice
Position
Material
Quantity
1
50
1
1
930100
20
1
2
930200
30
2
70
2
1
930200
70
3
60
3
1
930200
35
3
2
930100
25

Similar Messages

  • Combined Purchase Order and Sales Order Query. (Including Stand Alone Docs)

    Hi,
    I need some help please!
    I am looking for a query that will show all the Purchase Orders with all their base document Sales Orders. However I also need to show those stand alone Purchase orders and Sales Orders.
    What I have is two queries, one for the PO fields en one for The SO fields. I would like a way to combine these two so I have one query with the relevant PO and SO info next to each other.
    The final query will have a top heading structure like this:
    Status,Purchase No.,Supplier No.,Supplier Name,Week,Month,Del Method,Country,Method,Rep.|Status,Rep.,Sales No.,Customer No.,Customer Name,Customer Order no.,Cust. Del date,Doc total,Del Method
    +(The first part is for the purchase order section, the second part starting at the second 'Status' is the sales order section)
    +Purchase Order Query:
    SELECT
      T0.DocStatus 'Status',
      T0.DocNum'Purchase Order No.',
      T0.CardCode 'Supplier No.',
      T0.CardName'Supplier Name',
      DATEPART(ww,T0.DocDuedate)'Week',
      DATEPART(mm,T0.DocDuedate) 'Month',
      T1.TrnspName 'Delivery Method',
      T2.Country 'Country',
      T0.JrnlMemo 'Method',
      T3.SlpName 'Rep.'
    FROM OPOR T0 
    INNER JOIN OSHP T1 ON T0.TrnspCode = T1.TrnspCode
    INNER JOIN OCRD T2 ON T0.CardCode = T2.CardCode
    INNER JOIN OSLP T3 ON T0.SlpCode = T3.SlpCode
    Sales Order Query:
    SELECT
      T0.DocStatus 'Status',
      T2.SlpName 'Rep.',
      T0.DocNum 'Sales Order No.',
      T0.CardCode 'Customer No.',
      T0.CardName 'Customer Name',
      T0.NumAtCard 'Customer Order no.',
      T0.DocDueDate 'Cust. Delivery date',
      T0.DocTotal ' Doc total',
      T1.TrnspName ' Delivery Method'
    FROM ORDR T0 
    INNER JOIN OSHP T1 ON T0.TrnspCode = T1.TrnspCode
    INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode
    The problem I am having is that if I combine these queries it excludes all those records with blank/empty data fields.
    I do not mind having to go to crystal reports to get what I want.
    Any suggestions?
    Thanks!

    Hi thanks GordonDu,
    I have tried a union before, and yours works great. However my problem is to display the  PO en SO columns next to each other and not underneath each other.
    Something like this:
    Po No          Supplier          SO No           Customer
    1234           Sup 1             9876              Cust 1
    1235           Sup 2             no SO             Cust 2
    1236           Sup 3             9877              Cust 3
    1237           Sup 4             9878              Cust 4
    1238           Sup 5             no SO             Cust 4
    I have this query, but with this it drops all those Purchase Orders made Stand Alone and without a SO number.
    SELECT
      T2.DocNum AS 'Purchase Order No.',
      T0.DocNum AS 'Sales Order No.',
      T2.CardCode AS 'Supplier No.',
      T2.CardName AS 'Supplier Name'
    FROM ORDR T0 
       INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
       INNER JOIN OPOR T2 ON T2.DocEntry = T1.PoTrgEntry
    Though using your Union gives me all the information I want and the ability to expand on that, my problem is the "Display" part. I am sure I am doing something stupid somwhere 
    Edited by: Desmond Moll on Mar 7, 2012 8:03 AM

  • Monthly Sales Order query Doc Status problem

    Hi Experts,
    I am having an problem while making a total monthly sales order query in which I am not getting the document status which are Open - Printed. Also note that these document which are open printed are not having any target document.
    SELECT T0.[DocStatus],T1.[TargetType],T0.[CANCELED],T0.[CardCode], T0.[CardName], T0.[NumAtCard], T5.[SeriesName], T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal],T0.[Max1099]'Total Before Discount',T0.[TotalExpns],T4.[descript]'Territory',T2.[SlpName]'Employee Name'
    ,T0.[discsum]  FROM ORDR T0  ,RDR1 T1,OSLP T2,OCRD T3,OTER T4,NNM1 T5  where  T0.DocEntry = T1.DocEntry AND T0.SlpCode = T2.SlpCode AND T0.CardCode = T3.CardCode
    AND T3.Territory = T4.territryID AND T0.Series = T5.Series and T0.[CANCELED]='N' and T1.[TargetType] is not null
    My mission for the above query is to have Total Monthly Sales Orders with value exluding the cancelled and closed sales sales ( close here means - which are manually done by right click on sales order screen and selecting Close )
    Please guied how to solve this issue because in the back end for Sales Order which have turned to deleivery are showing doc status as closed and the sales order which are manually closed are also showing doc status as closed. How to diffrentiate between them.
    Waiting for a positve feedback.
    Regards,
    Rahul

    Try this one:
    SELECT DISTINCT T0.[DocStatus],T0.[CardCode], T0.[CardName], T0.[NumAtCard], T5.[SeriesName],
    T0.[DocNum], T0.[DocDate], T0.[DocDueDate], T0.[DocTotal],T0.[Max1099]'Total Before Discount',
    T0.[TotalExpns],T4.[descript]'Territory',T2.[SlpName]'Employee Name',T0.[discsum]
    FROM DBO.ORDR T0
    INNER JOIN DBO.RDR1 T1 ON T0.DocEntry = T1.DocEntry
    INNER JOIN DBO.OSLP T2 ON T0.SlpCode = T2.SlpCode
    INNER JOIN DBO.OCRD T3 ON T0.CardCode = T3.CardCode
    INNER JOIN DBO.OTER T4 ON T3.Territory = T4.territryID
    INNER JOIN DBO.NNM1 T5 ON T0.Series = T5.Series
    where  T0.[CANCELED]='N' and T1.[TargetType] != -1
    Thanks,
    Gordon

  • I paid my purchase, but my order list is empty

       I purchase my lightroom4 at http://www.adobe.com/cn/, paid by my taobao.com, however, there was a internet connection error poped up, after i fixed the problem, i finished the payment,but when i logged on my adboe id, i found my order list is empty, there is no any sigh saying i purchased the lightroom4 , but my bank statment showes the payment has already been made, so , what should i do ?

    The issue has been resolved, thank you very much.

  • Create Delivery from a Sales Order adding a new position

    Hi experts!
    I need to create a delivery from an existing Sales Order (with just 1 position), and add a new position to this Delivery so it creates with two positions, the one from the SO and the added one.
    I'm using FM RV_DELIVERY_CREATE. Is it possible to do this?
    Thanks!!
    Carles

    Hi Carles,
    I would prefer BAPI_OUTB_DELIVERY_CREATE_SLS. At least the delivery creation will be fine, your second position might be more complicated. But there are exits in the Bapi and you might go for an exit of the delivery creation itself -> then also manual triggered creation of a delivery will be correct.
    BR, Christian

  • Change Sorting order in F4 Help in BEx Query

    Hello All,
    My users want to change the sorting order of variable (e.g. Calmonth) in the selection screen (while executing a query).
    Currently, by default,the sorting order is ascending on key.
    I need to change it to descending on key.
    How to change the sorting order for F4 ONLY?
    Thanks,
    Mainak

    Hi,
    You can sort the Char.Values by doing settings in Query Designer :
    Say for 0calmonth :
    In its Display properties tab,You select appropriate options in
    Sort Char -> select the name
    sort by -> Key/Text
    Sort Direction -> Ascending/Descending.
    You will then have them in required order.
    ALso if you want it only for F4 help:
    In F4 help screen,you will see two arrow buttons next to Char. name. they are useful for sorting the values to either descending or ascending.
    Hope it helps:)
    Edited by: Sriman on Nov 12, 2008 5:17 PM

  • Sale Order Query Print layout/Crystal Report Query required

    Hi Experts,
    I created a Sale Order. Items included in it are service and material.
    (I created a BOM, bound the child material item to the parent service item. Moreover child item will have unit price where as parent item will not have unit price)
    I need the report on it please let me know how i can do it.
    I tried with below query
    select a.DocEntry, a.DocNum, a.CardCode, a.CardName, b.DocEntry,b.ItemCode, b.Dscription, b.Quantity, b.Price, b.LineTotal, a.DocTotal, a.VatSum 
    from ORDR a inner join RDR1 b on a.DocEntry = b.DocEntry
    --and b.TreeType <> 'N'
    where a.docnum = '14240621'
    output of above query is
    DocEntry
    DocNum
    CardCode
    CardName
    DocEntry
    ItemCode
    Description
    Qty
    Unit Price
    Line Total
    DocTotal
    Tax Amount
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302010001
    PROVIDING & LAYING
    17.62
    2493.76
    43940.05
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0001
    Material for PROVIDING & LAYING
    17.62
    2800
    49336
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    305010005
    BM CM INCLUDING CEMENT
    10.055
    1980
    19908.9
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0002
    Material for BM CM  INCLUDING CEMENT
    10.055
    1650
    16590.75
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302040001
    P/APPLYING
    65
    116.5
    7572.5
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0003
    Material for P/APPLYING
    65
    65
    4225
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    301000001
    P& FIXING
    2.233
    31625.05
    70618.74
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0004
    Material for P& FIXING
    2.233
    44000
    98252
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    306010001
    PROVIDING RMC
    3
    3593
    10779
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0005
    Material for PROVIDING RMC
    3
    4847
    14541
    354652
    18888.46
    and my desired output is
    Unit price of both child item and parent item should be display in single column. ie. cumulative in Unit Price Column and Linetotal respectively.
    DocEntry
    DocNum
    CardCode
    CardName
    DocEntry
    ItemCode
    Description
    Qty
    Unit Price
    Line Total
    DocTotal
    Tax Amount
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302010001
    PROVIDING & LAYING
    17.62
    5293.76
    93276.05
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    305010005
    BM CM  INCLUDING CEMENT
    10.055
    3630
    36499.65
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302040001
    P/APPLYING
    65
    181.5
    11797.5
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    301000001
    P& FIXING
    2.233
    75625.05
    168870.7
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    306010001
    PROVIDING RMC
    3
    8440
    25320
    354652
    18888.46
    please let me know the update on this.
    with regards

    Hi Nagarajan,
    thanks for reply..
    1) Yes, i.e i have taken into BomType: Template
    2) i did not get any helpful output by using treetype by keeping 'S' and 'N', i kept in comment.
    3) Actually MT0001-05 - these are material item- unit prices are fixed. see in attached image
         for parent item, unit prices are not fixed. I give the price for them in Sale Order.
         I want unit price for parent and child should be summed/cumulative for Sale Order print.
         (in my above post, first matrix exactly same as sale order line items plz check it)
    Please help me, how i can achieve this by query(for PLd or Crystal report)
    With Regards

  • Order Query in SQ01 using Table Joins in CRM

    Hello Experts,
    I am trying to create a query using table joins in SQ01 in CRM because I need a report that will give me all transactions for a selected Business Partner.  I am unable to display any results when running my query.  I have found other threads which give a list of possible tables to join together, but the fields used in the joins were not described. 
    The tables I have joined in my query are as follows:
    CRMD_ORDERADM_H
    CRMD_ORDER_INDEX
    CRMD_PARTNER
    BUT_000
    I have used SE16 to try to search for additional tables to use for linking the Business Partner with a transaction, but I have been unsuccessful.
    Would anyone please give advice as how to proceed? 
    Reward points are available!
    Thank you in advance,
    David

    David
    The link with be the GUID.
    CRMD_ORDERADM_H = Document Header Table
    CRMD_ORDERADM_I = Document Line item Table
    CRMD_LINK = Lists various ‘link’ GUIDs, to
    access order Information
    The Table CRMD_ORDERADM_H will contain you transactions , once you find the GUID of your sales transaction in the table CRMD_ORDERADM_H.
    You then need to check the table CRMD_LINK.
    In this table you will then find a number in 11 = sales. This refers to the table CRMD_SALES. There are also links to many other tables ie Shipping, pricing, org etc.
    CRMM_BUT_SET0140 - for Sales Group, Sales Office, District
    CRMM_BUT_LNK0141 - for Sales Area data
    Transaction CRMD_BUS2000115 allows you to see all sales transactions for a BP. CRMD_BUS2000126 shows you activities for selected BP.
    Regards
    M

  • Open Orders Query showing all open AP Orders

    Hi All,
    I wish to generate a report that shows all open AP Purchase Orders as well as all orders that are partially inviced.
    I have been using the following query but it is not giving me complete results:
    SELECT
    T1.[DocNum] AS 'PO NUMBER',
    T1.[DocDate] AS 'POSTING DATE',
    T1.[DocDueDate] AS 'DUE DATE',
    T1.[TaxDate] AS 'DOC DATE',
    T1.[Comments] AS 'REMARKS',
    T1.[CardCode] AS 'CUSTOMER/VENDOR CODE',
    T1.[CardName] AS 'CUSTOMER/VENDOR NAME',
    T0.[LineTotal] AS 'LINE TOTAL',
    T0.[OcrCode] AS 'PROFIT CENTER',
    T1.[PaidSum] AS 'PAID',
    T0.[Project] AS 'PROJECT CODE',
    T0.[LineNum] AS 'ROW NUMBER',
    T0.[LineStatus] AS 'LINE STATUS',
    T1.[DocStatus] AS 'PR STATUS'
    FROM
    POR1 T0  INNER JOIN OPOR T1 ON T0.DocEntry = T1.DocEntry
    WHERE
    T1.DOCSTATUS <>'C'
    AND
    T0.LineStatus <> 'C'
    ORDER BY T1.docentry
    I need to add to this query a column to show PO's that have been partially invoiced, a column to show if the invoices have been paid and another column to show the balances for those particular orders.
    HELP PLEASE!
    Robinson

    Thanks Carin,
    That was very helpful, BUT:
    1. I still wish to view all open orders that have been partially invoiced
    2. I still wish to see all the Purchase Orders that have been partially invoiced and paid
    3. I finally want to see the balances for these Purchase Orders that have been partially invoiced.
    I don't seem to find the correct fields containing the information. So far all that I was able to establish is that OPOR.DocTotal is the total amount for the Purchase Order. However, OPOR.PaidToDate does not give an accurate value of what is invoiced or paid.
    I wish to add the following fields. A field showing the corresponding Invoice number for the partially invoiced order, the amount paid for that PO and the balance.
    Thank you.
    Robinson

  • Open Sales Order Query

    Hello Experts,
    I would like to pull all Open Sales Orders that do not have purchase orders and are more than 180 days old.
    I tried the following query but does not seems to work exactly:
    select t0.DocNum
    ,t0.DocDate
    ,DateAdd(Day,180,t0.DocDate) as Due180Days
    , t0.DocDueDate
    , t1.PymntGroup
    , t0.OwnerCode
    , t2.firstName
    , t2.lastName from ordr t0
    inner join OCTG t1 on t0.GroupNum = t1.GroupNum
    inner join OHEM t2 on t0.OwnerCode = t2.empID
    where (t1.PymntGroup like '%prepaid%'
    or t1.PymntGroup like '%deposit%')
    and t0.DocStatus ='O'and t0.PoPrss='N' and DATEADD(Day,180,t0.DocDate)>180
    and t0.OwnerCode=18
    Any hlep would be appreciated.
    Regards,
    Praneeth

    Hello Praneeth,
    You may try this:
    select t0.DocNum,t0.DocDate,DateAdd(Day,180,t0.DocDate) as Due180Days,
    t0.DocDueDate, t1.PymntGroup, t0.OwnerCode, t2.firstName, t2.lastName
    from ordr t0
    inner join OCTG t1 on t0.GroupNum = t1.GroupNum
    inner join OHEM t2 on t0.OwnerCode = t2.empID
    where (t1.PymntGroup like '%prepaid%'
    or t1.PymntGroup like '%deposit%')
    and t0.DocStatus ='O'and t0.PoPrss='N' and DATEDIFF(DD,t0.DocDate,GetDate())>180
    and t0.OwnerCode=18
    What is exactly the issue not seems to work?
    Thanks,
    Gordon

  • Work Order Query

    Hello Experts,
    I have a query for work order.
    1) if parts have been reserved in a work order, what is the method of converting those parts to confirmations?
    2) Is there any report which shows parts that have been reserved on work orders ? Or any way to see this?
    Regards
    Himanshu

    Hi,
    For reservation confirmations got to IW42, it will automatically take movement type 261.
    For reservations, goto IW40 and select layout view, there you will get option for Reservations.
    Hope it is helpful.
    Thanks

  • Problem in Sales Order Query

    Hi All,
    I have problem....This is query which ic combination of Sales Order, Return, Delivery and AR Invoice.....Please tell me why this query is not working ......I want Document No, Quantity, Doc Date from Sales Order, Return, Delivery and AR Invoice and Tax bifergation also.....I per my view this query there should not be any problem but it is not working...please tell me where I am wrong....Just copy and paste this query and check in ur system.......
    SELECT b.Doc_Num1 as 'SO. No.',
    b.DocDate    as      'SO. Date',
    b.Doc_Num2   AS      'Del.Doc.No.',
    b.DocDate    AS      'Delivery Date',
    b.Doc_Num3   as      'A/R Invoice No.',
    b.DocDate    as      'Inv. Date',
    b.Doc_Num4   AS      'RETURN Doc.No.',
    b.DocDate    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.Quantity2  as      'Sales Order Quantity',
    b.Quantity3  as      'Delivery Quantity',
    b.Quantity4  as      'Return 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,
    T0.DocDate,
    T2.DocNum,
    T2.DocDate,
    M.DocNum,
    M.DocDate,
    M.CardName,
    M.NumAtCard,
    L.ItemCode,
    L.Dscription,
    L.Quantity,
    T1.Quantity,
    T3.Quantity,
    S.DocNum,
    S.DocDate,
    X.Quantity,
    L.LineTotal,
    M.DocEntry,
    M.[DiscSum],
    M.WTSum,
    M.DocTotal,
    M.WTSum,
    M.DocTotal,

    Hi Sonal,
    Try this,
    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',
    T4.DocNum AS 'Return No.',
    T4.DocDate AS 'Return 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 JOIN ORDN T4 ON T4.DocEntry = L.TrgetEntry
    LEFT JOIN RDN1 T5 ON T5.DocEntry = T4.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]'
    GROUP BY
    T0.DocNum,T0.DocDate,T2.DocNum,T2.DocDate, M.DocNum,M.DocDate,T4.DocNum, T4.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,T4.DocNum,T4.DocDate, M.CardName,M.NumAtCard,L.ItemCode,L.Dscription,L.Quantity,
    M.DocEntry,M.[DiscSum],M.WTSum,M.DocTotal
    Regards,
    Madhan.

  • Sales Order Query for  in SAP B1

    Hi,
    I Need  to generate a report to Calculate the net sales orders for a particular customer in a given period. i can able to calculate the total sales order details itemwise but my query not works when the customer returns the particular products.( ie) I need to subtract the credit memo value from the order value of the particular product when the customer returns the product.
    Here is my Query Please any one Help me... what mistake in this query
    SELECT     A.CardName AS 'Customer Name', A.Address, A.DocNum AS 'Ord.No', CONVERT(varchar, A.DocDate, 3) AS 'Date', B.Dscription AS 'Item Name',
                          CASE WHEN B.itemcode = F .itemcode and A.CardCode = G.CardCode and A.Slpcode = F.Slpcode THEN B.quantity - F .quantity ELSE B.quantity END AS Quantity,
                          CASE WHEN B.itemcode = F .itemcode and  A.CardCode = G.CardCode and A.slpcode = F.slpcode THEN B.price - F .price ELSE B.price END AS Price, B.DiscPrcnt,
                          CASE WHEN B.itemcode = F .itemcode and A.CardCode = G.CardCode THEN B.linetotal - F .linetotal ELSE B.linetotal END AS Amount, B.VatPrcnt,F.ItemCode,E.Itemcode,D.Itemcode,C.Itemcode
    FROM
    ORDR A INNER JOIN
    RDR1 B ON A.Docentry = B.Docentry LEFT JOIN
    INV1 C ON A.Docentry = C.Baseref and C.Basetype=17 LEFT JOIN
    DLN1 D ON A.Docentry = D.BaseRef and D.Basetype=17 or C.Docentry=D.BaseRef and D.Basetype =13 LEFT JOIN
    RDN1 E ON D.Docentry = E.BaseRef and E.Basetype =15 LEFT JOIN
    RIN1 F ON C.Docentry =F.BaseEntry and F.Basetype = 13 or E.Docentry = F.BaseRef and F.BaseType = 16 or E.TrgetEntry = F.Docentry and F.Targettype= 14 LEFT JOIN
    ORIN G ON G.Docentry =F.Docentry Left join
    OSLP H ON A.Slpcode = H.Slpcode
    WHERE     (A.CardName = 'SHASUN CHEMICAL AND DRUGS') AND (A.DocDate >= '2000/9/30') AND (A.DocDate <= '2009/10/10')
    group by A.CardName , A.Address, A.DocNum , A.DocDate, B.Dscription,B.Itemcode,
    F.Itemcode,A.cardcode,G.cardcode,A.slpcode,
    F.Slpcode,B.quantity,F.quantity,B.Price,F.price,B.vatprcnt,B.discprcnt,B.Linetotal,F.linetotal,F.ItemCode,E.Itemcode,D.Itemcode,C.Itemcode
    ORDER BY 'Date'
    Thanks,
    vasanthapraba.

    Maybe this will help you further?
    SELECT A.CardCode, DocNum AS 'Ord.No', CONVERT(varchar, A.DocDate, 3) AS 'Date', B.Dscription AS 'Item Name', B.ItemCode AS 'Item Code'
    , SUM(B.quantity - D.quantity) AS 'Quantity'
    , SUM(B.price - D.price) AS 'Price'
    , SUM(B.LineTotal - D.LineTotal) AS 'Amount'
          FROM ORDR A
    INNER JOIN RDR1 B ON (A.DocEntry = B.DocEntry)
    LEFT JOIN DLN1 C ON (B.DocEntry = C.BaseEntry AND B.LineNum = C.BaseLine)
    LEFT JOIN RDN1 D ON (C.DocEntry = D.BaseEntry AND C.LineNum = D.BaseLine)
    WHERE (A.DocDate >= '20090925') AND (A.DocDate <= '20090925') AND (A.CardName = 'SHASUN CHEMICAL AND DRUGS')
    GROUP BY A.CardCode, A.DocNum, A.DocDate, B.Itemcode, B.Dscription
    ORDER BY 'Date'

  • Import Purchase order Query

    Hi all,
    I have one query.In most of the forum, i had read that it is suggested to have GR Based IV not ticked. Why is it so?  what are the consequence if i keep it ticked?
    Regards,
    S Anand

    Hi Anand,
    Your query is correct. I myself have worked on the same in my test system and verified. My observations are:
    You create a Purchase order, enter duty values manually after receiving the BoE. When you refer to std. sap procedure i.e Duty MIRO first, then GR and lastly Supplier MIRO, you will find the impact in the excise duty capturing and Posting.
    If you check the Excise Tab at the MIGO level you will find the exact amounts those are cenvatable (if you have done duty MIRO first).
    Now if you make GR first, you will see the difference in amounts in the excise invoice tab. Also when you do MIRO (first for Planned delivery cost i.e duty and second for foreign Currency) you will find the difference ther as well. The diffrence here is you will get only duties those are to be loaded on the material i.e Basic Customs, Cess on BCD and SECess on BCD. These values are not the same as they are entered in the PO. While the cenvatable conditions are not there as they are already captured at the GR level.
    If your GR based IV is active in 1st case, system throws an error and does not allow to post the MIRO, while in second case it allows.
    Usually in our case, we import @ 200+ items in one BoE. It creates trouble in posting a/c entry as a/c document can not carry more than 999 items if GR based IV is active. Please check in your case.
    Too long answer, but hope you got the point.
    Regards,
    Rahul.

  • Sale order Query

    SELECT T0.[DocNum], T1.[Project], T2.[PrjName], T1.[CogsOcrCod] as Region, T1.[CogsOcrCo2] as Branch,T1.[WhsCode],  T1.[Dscription],T1.[LineStatus],T1.[Quantity], T1.[OpenQty],T0.[DocCur], T1.[Price], T0.[U_OrderStatus], T3.[DocNum],T3.[cardname],T3.[DocStatus] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OPRJ T2 ON T1.Project = T2.PrjCode,OPOR T3 INNER JOIN POR1 T4 ON T3.DocEntry = T4.DocEntry
    WHERE T4.BaseRef = T0.DocNum and T0.[DocStatus] = 'O'
    i have this query it is working fine but there is problem. that is  it is showing only that sale order wich purchase order is posted my client want all sale order if his purchase order is poted or not

    Hi Ajit,
    See if this one works. A few fields were removed as they don't exist in my db, you should be able to add them again.
    SELECT
    T0.DocNum, T1.Project, T2.PrjName, T1.CogsOcrCod as Region,
    T1.WhsCode, T1.Dscription,T1.LineStatus,T1.Quantity, T1.OpenQty,T0.DocCur,
    T1.Price, 'No Purchase Order','No Purchase Order','No Purchase Order'
    FROM
    ORDR T0 INNER JOIN
    RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
    OPRJ T2 ON T1.Project = T2.PrjCode
    WHERE T0.DocStatus = 'O'
    Union
    SELECT
    T0.DocNum, T1.Project, T2.PrjName, T1.CogsOcrCod as Region,
    T1.WhsCode, T1.Dscription,T1.LineStatus,T1.Quantity, T1.OpenQty,T0.DocCur,
    T1.Price, cast(t3.docnum as varchar),
    T3.cardname,T3.DocStatus
    FROM
    ORDR T0 INNER JOIN
    RDR1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN
    OPRJ T2 ON T1.Project = T2.PrjCode, OPOR T3 INNER JOIN
    POR1 T4 ON T3.DocEntry = T4.DocEntry
    WHERE T4.BaseRef = T0.DocNum and T0.DocStatus = 'O'
    Hope it helps,
    Jesper

Maybe you are looking for

  • Can't find most of my songs on my iPhone 5. They only show up on the computer. How do I fix it?

    I just updated my software and now I can't seem to locate most of my songs on my iPhone 5. When I'm in the "on this iphone" tab, I can see all of the music I've added to the iphone library. However, when I look on my actual phone none of them are the

  • Which? CS3 or Elements for HV20 24p work?

    Hello: I am an ELements user and I was made an offer to upgrade to Pro CS3 for $299. Will this upgrade buy me anything? I have a Canon HV20 and the big pain is the 24p workflow. Does Pro CS3 offer any improvement over pulldown? I can see various 24p

  • Page attribute in PDF URL not working

    Hi,<br /><br />I have a web page with several links - each pointing to a page in PDF.<br />I have used the #page=<page number> attribute to do this and it works very well.<br /><br />e.g.<br /><a href="myPdf.pdf#page=3">Page 3</a> -- Opens PDF and ta

  • Changing the name of my podcast

    So I am making some changed to my podcast and need to change the name to reflect that. I am hoping that I will not have to lose all my subscribers. I have changed the name and all the info in the .xml file and it will still be linked to the same feed

  • Error in picking the mail...

    Hi to all.. I am trying to pick the mail with attachment, i want to make the attachment as the main payload so i have used Michael Blog: /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step But i am getting t