Sales Delivery Reports. Fields

Dear All Experts.
I making a Sales Order Reports. Using Following Tables.
VBEP , VBAP ,  VBPA , VBKD , VBAK , LIKP , LIPS , KNA1
I successfully Search Other Fields.
But i cant Find exact field for PENDING QTY, PENDING WEIGHT, ORDER QTY, PENDING VALUE, SCHEDULE OR PLANNED delivery & Next Schedule.
Please Give me help for this Field with table name.
Bhavesh Panchal
SAP ABAP.
Baroda.

Dear All experts.
How to Initialization of Field Calculatio in ABAP code Syntax. Please Guide me for setting UP in ALV Grid
Report.
Also Decleration of Global variable. it can be Used Any where via code.
  wa_fieldcat-tabname = 'ITAB'.
  wa_fieldcat-fieldname = 'NTGEW'.
  wa_fieldcat-seltext_m = 'Net Weight'.
  wa_fieldcat-outputlen = '10'.
  APPEND wa_fieldcat TO i_fieldcat.
  CLEAR wa_fieldcat.
Please Give Me Syntax of the following calculation in ALV Grid programs :
*WEIGHT = WEIGHT + ( ( VBAP-NTGEW / VBAP-KWMENG ) * VBAP-KBMENG ).*
Thnks in Advance :
Bhavesh Panchal.

Similar Messages

  • Re: Sales Delivery Reports. Fields

    Dear All experts.
    How to Initialization of Field Calculatio in ABAP code Syntax. Please Guide me for setting UP in ALV Grid
    Report.
    Also Decleration of Global variable. it can be Used Any where via code.
      wa_fieldcat-tabname = 'ITAB'.
      wa_fieldcat-fieldname = 'NTGEW'.
      wa_fieldcat-seltext_m = 'Net Weight'.
      wa_fieldcat-outputlen = '10'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
    Please Give Me Syntax of the following calculation in ALV Grid programs :
    *WEIGHT = WEIGHT + ( ( VBAP-NTGEW / VBAP-KWMENG ) * VBAP-KBMENG ).*
    Thnks in Advance :
    Bhavesh Panchal.

    hi,
    check this.
    REPORT  YMON_ALV2.
    TYPE-POOLS : SLIS.
    *DATA Declaration
    DATA: i_sflight TYPE TABLE OF sflight,
          i_fcat type slis_t_fieldcat_alv,
          wa_fcat TYPE slis_fieldcat_alv.
    wa_fcat-tabname = 'SFLIGHT'.
    WA_FCAT-COL_POS = 1.
    WA_FCAT-FIELDNAME = 'CARRID'.
    WA_FCAT-SELTEXT_L = 'ID'.
    APPEND WA_FCAT TO I_FCAT.
    WA_FCAT-COL_POS = 2.
    WA_FCAT-FIELDNAME = 'FLDATE'.
    WA_FCAT-SELTEXT_L = 'DATE'.
    APPEND WA_FCAT TO I_FCAT.
    WA_FCAT-COL_POS = 3.
    WA_FCAT-FIELDNAME = 'CONNID'.
    WA_FCAT-SELTEXT_L = 'NO.'.
    APPEND WA_FCAT TO I_FCAT.
    WA_FCAT-COL_POS = 4.
    WA_FCAT-FIELDNAME = 'PRICE'.
    WA_FCAT-SELTEXT_L = 'FARE'.
    APPEND WA_FCAT TO I_FCAT.
    WA_FCAT-COL_POS = 5.
    WA_FCAT-FIELDNAME = 'CURRENCY'.
    WA_FCAT-NO_OUT = 'X'.
    APPEND WA_FCAT TO I_FCAT.
    WA_FCAT-FIELDNAME = 'PLANETYPE'.
    WA_FCAT-NO_OUT = 'X'.
    APPEND WA_FCAT TO I_FCAT.
    *DATA SELECTION
    SELECT * FROM SFLIGHT INTO TABLE I_SFLIGHT.
    *CALL ABAP LIST VIEWER
    *  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    *        EXPORTING
    **          I_STRUCTURE_NAME     = 'SFLIGHT'
    *          IT_FIELDCAT          = I_FCAT
    *        TABLES
    *          T_OUTTAB             = I_SFLIGHT.
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
            EXPORTING
    *          I_STRUCTURE_NAME     = 'SFLIGHT'
              I_GRID_TITLE         = 'FLIGHT INFORMATION'
              IT_FIELDCAT          = I_FCAT
            TABLES
              T_OUTTAB            = I_SFLIGHT.
    and u can write like this
    WEIGHT = WEIGHT + ( ( VBAP-NTGEW / VBAP-KWMENG ) * VBAP-KBMENG ).*
    or
    WEIGHT = (VBAP-KBMENG * ( VBAP-NTGEW / VBAP-KWMENG ) ) + WEIGHT .

  • Standard Extractor for Sales Overview report

    Hi Experts,
    Can you all please help me in finding the Standard Extractor for Sales Overview Report, fields like Product Group, Product, Net Sales, Billed Qty, Sales Plan, % Variance Plan etc are present in this report, i tried to search this in transaction RSA5 but wasnt able to find it. Also, if there is no std extractor then can you please provide me the name of the database table so that i can create a generic datasource on it.
    Thanks & Regards,
    Amit Naik

    Hi Sathya,
    I have received an initial Requirement from the Client (Please refer the list below), It gives us the Report Name & the fields involved in it, i need to tell them the feasibility, can you help me on this? Are there any std reports available for the same?
    Report                          Possible fields
    On Time Delivery-     Month to date on time in full, Year to date on time in full
    Pick Performance-     Days from Pick List Receipt to Despatch
    Delivery Performance-     Days from Order receipt to despatch
    Costs-                          Total Cost per unit despatched,Labour Cost per unit despatched,Monthly spend vs budget by cost centre
    Stocks-                          Openshaw Stock Volume vs budget,Openshaw Stock Value vs budget,Stock Movement by product / range month on month,Stock Turn
    Returns-                          Volume and Value by major type
    Orders in Pick-     Volume and Value
    SMU-                          Outstanding Special Make Up Work
    PI -                          Percentage bins 100% accurate
    Space-                          Count of empty bin locations     
    Progress to Budget for month-     Budget, Forecast and latest estimate.,Invoiced to date, in pick, outstanding,Shortfall to find.
    Profit and EBITDA-     By Brand / Customer / Account
    Monthly pack     -                     Equivalent
    Outstanding PO's-     Volume and Value, by brand / category,Expected receipts this week,View of inbound scheduler (Empirica)
    Vendor Management-     Value of PO's with major vendors,Vendor on time delivery,Vendor Rejections / QC problems
    In Bound Carriage-     Cost of Carriage for month vs budget,Airfreights agreed,PO's Inbound
    Out of Stock Report-     Items where there is zero or projected to be zero stocks,Back Order volume value
    Progress-                          Number of designs in development,Number of designs late against Critical Path
    Thanks & Regards,
    Amit Naik
    Edited by: Amit Naik on Sep 20, 2010 9:28 AM
    Edited by: Amit Naik on Sep 20, 2010 9:35 AM
    Edited by: Amit Naik on Sep 20, 2010 9:38 AM
    Edited by: Amit Naik on Sep 20, 2010 9:43 AM

  • Crystal Report for Sales, Delivery and Payment.

    Hi Guys,
    Need some expert advice over here. Currently, our sales team are using 3 separate report, one report on sales per month for each specific customers, one report on delivered amount per month for specific customers again and the last one report on payment received per month for specific customers as well.
    We have the idea of joining this 3 report so that I can report on sales, delivery and payment all at once so that they can see the trend better. However, after trying for quite a few times, we fail to create a common joining between ORDR, ODLN and ORCT. Is there any possible way to work something out ?
    I have thought of using subreport, but I just cant find the way to plug in the figure correctly.
    Need some advice over there.
    Thank you.
    Best Regards,
    Alex

    Based on what you have told me, then you should then join Sales Order, Delivery, Invoice and Incoming Payments into one.
    The reason I say Invoice table also is because, you cannot directly link Delivery and Incoming Payments window.
    Also you it is not enough that you link the ORDR, ODLN and ORCT, you will need to get the details from RDR1 and DLN1.
    In SAP Business One, each line in SAP Business One can have a different Delivery documnet.
    The TrgetEntry, TargetType will give you this information. For example, if a line for Sales Order has TargetType 15, then TrgetEntry will be the DocEntry in the ODLN. But if it TargetType is 13 it means the Sales order was converted directly to and Invoice and bypassed the creation of Delivery step, which is possible in SAP.
    So here is how I think you will need to link Sales order and Delivery
    RDR1.TrgetEntry INNER JOIN DLN1.DocEntry AND
    RDR1.TargetType INNER JOIN DLN1.ObjType AND
    RDR1.LineNum INNER JOIN DLN1.BaseLine
    Now this could get a little more complicated if you do partial deliveries. For example if a line in your Sales Order has say 10 items and 6 of them are delivered using Delivery Note 123 and the remaining are delivered using Delivery Note 124, then the join will give you 2 different lines.
    So basically you will need to link the tables in this fashion
    ORDR <-> RDR1 <-> DLN1 <-> INV1 <-> RCT2 <-> ORCT
    Unfortunately, this linking process can get complicated if you do not follow certain steps, like for example if you do not create a Delivery Note and converted your Sales order to Invoice. Then the link would be
    ORDR <-> RDR1 <-> INV1 <-> RCT2 <-> ORCT
    I hope I didn't confuse you.
    Krishnan

  • Adding Data Field to Sales Analysis Report

    Does anyone know how to add data fields to Sales Analysis Reports, either in PLD or CR?  On Sales Analysis by Customer, I need to add the total quantities for all items sold for the sales included in the report, excluding negative quantities.
    Thank you,
    Avraham

    Hi Avraham.......
    You can create your own Query Report for getting all the desired outputs and it will be easy to show in reports also.....
    Regards,
    Rahul

  • Sales Analysis Report Additional Field for viewing

    Good Day Experts!
    Is it possible for us to display an additional field  to be viewed in Sales Analysis Report?
    I'm talking about a vacant field from BP Master data, and somehow append it into form settings and put it into the report?
    Is there any store procedures that we can look for prior to this matter? Our client need something more on that particular issue.
    Thank you very much

    Hi Elmar,
    It is not possible to add field on SAP sales analysis report , but you can create report based on query with required fields.
    Check http://wiki.sdn.sap.com/wiki/display/B1/D-SLSalesARModuleSQLPostedto+Wiki link for some sales queries , it might help you.
    Thanks,
    Neetu

  • Planned delivery time field in sale order

    Dear All,
    During creation of  STO at item level under delivery TAB "planned delivery time" field is showing with edit mode, I want to activate this field for sale order creation / change also. Plz advice how I can do this.
    regards,
    sps.

    Dear SP
    This field is laready there in the MRP-2 of the material master. This is used to calculate the no. of days to procure a material/service externally. Why do you want to activate this in sales order.
    Thanks
    Shuktiz

  • Sales order report

    Hi,
    What are the tables I should use for the following reports.
    1.  I want to create sales order status report for given sales office, sales group and creation date.
    2.  Open sales order report which covers all organizational levels, delivery status, invoice status shipping details and partner function details.
    thanks in advance
    with regards,
    VC

    For 2nd Q, you can find the open sales orders in the same VBUK table.
    Delivery status field is LFSTK.
    Invoice status field is RELIK
    The partner information is available in Sales Document: Partner table VBPA.

  • Regarding Sales Order Report in SD

    Hii
    I want to create reports in SD module such as sales order report, which covers all organization levels, delivery status, invoice status, shipping details and partner function details.
    Any inputs would be appreciated
    Regards,
    Guru

    Hello Guru,
    Please use basic SD transactions VA01,VA02,VA03(Create/change/display Sales order).
    Here, places the mouse cursor on any of the fields and hit F1.
    You will be given Technical help info (Table name ,field name,screen name)
    For example in VA03  when we hit F1 on Sales order number input help field, we get the following information.
    Table name VBAK
    Field: VBELN
    Data element: VBELN_VA
    Also as mentioned in the previous threads, please go through the tables VBAK,VBAP,VBFA,VBRP for the information required.
    Please mark as answered if my suggestion helped in resolving your problem.
    Regards,
    Himanshu Limaye

  • Wrong Qty Showing in Sales Analysis Report

    Dear All
    When we run Sales Analysis Report Item Wise by selecting Delivery Note in the selection, then it shows '0' or '-1' in Quantity field. It should show totat quantity delivered of each item.
    Can anyone elaborate this why it happens?
    Thanks and Best Regards
    Nabeel

    Dear Rahul
    I haven't unblocked negative inventory check. But that will not create any affect in Sales Analysis Report.
    Regards
    Nabeel

  • [Sales/Shipment report] - What's the best solution?

    Hello everybody.
    I have to develop a report with some sales data, delivery service data and shipment costs data.
    I have the cubes: 0SD_C03, 0SD_C04, 0LES_C02.. and I thought to do a multicube, but I don't no how to link these cubes...
    I don't have, for example, Sales Document/Item and/or Delivery Document/Item in all os these cubes...
    What is the best solution to this sittuation?
    I thought in some solutions like...
    1 - Extend extractor of 0LES_C02 to include Sales Doc/Item, but I don't know if all delivery doc is related to a sales doc.
    2 - I know I have all the fields that I want in the tables VBAP and LIPS...so I thought in create an generic extractor with a view of these two tables, and than creat a Z cube, to receive these datas...
    I really don't know whats the best solution, or if there is abother solution to this....
    I'll apreciate ideas, or a solution from someone that already face with this and developed a solution.
    Best Regards,
    Thiago

    Hi,
    Its better for you to add sales order,item in the cubes also from the source where your cube gets data ie from DSO as they are only point through which you can combine sales,delivery and billing data.
    Thanks,
    Arun

  • Prevent past date entry on the delivery date field

    Hi Guys,
    I was wondering whether it is possible within standard SAP Business one 8.8 to prevent users from entering past date in the delivery date field on the Sales order screen.   I have people making mistakes by entering 10/10/2010 instead of 10/10/2011.  This caused problems with reports etc..
    Is there a formatted search query i can create to warn/alert users with a message stating incorrect date entered? Please advice best course of action?
    Regards
    nick

    Deepak,
    The following code is already in this section?  Can i just add Gordon query below the last "END" statement?
    --    ADD   YOUR  CODE  HERE
    declare @islocked int
    select @islocked = 0
    if(@object_type = '17' and @transaction_type <> 'A')
    select @islocked = U_LockedForEdit from [@A1WMS_Staging] where U_objType = '17' and U_docEntry = @list_of_cols_val_tab_del
    if(@object_type = '22' and @transaction_type <> 'A')
    select @islocked = U_LockedForEdit from [@A1WMS_Staging] where U_objType = '22' and U_docEntry = @list_of_cols_val_tab_del
    if(@object_type = '202' and @transaction_type <> 'A')
    select @islocked = U_LockedForEdit from [@A1WMS_Staging] where U_objType = '202' and U_docEntry = @list_of_cols_val_tab_del
    if(@islocked <> 0)
    begin
    select @error = 999
    select @error_message = 'Order Cannot be Updated/Canceled/Deleted as it is Locked in WMS'
    end

  • Sales document report for all open documents

    hi i need the code for sales document report for all open documents is sd
    ...      can anyone help me out.
                                     thanks in advance

    Try transaction VA05. In that choose "Open Orders" along with other selection criteria.
    If you want the Open sales order qty in output and its not displayed, do the following.
    Sales -> System modification -> create new fields ( without condition technique) -> New fields for lists.
    You can change V05TZZMO and structure VBMTVZ from there or use SE38 / SE11.
    For both you'll need an object registration in OSS.
    Hope this helps.
    Thanks,
    Balaji

  • Help on Sales order report

    Hi,
    I have a code to display Sales order report. But i need to generate Sales order Line item wise Report. Can anyone help me to modify this code to suit my criteria?
    DATA: IT_VBAK LIKE VBAK OCCURS 0 WITH HEADER LINE.
    DATA: IT_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.
    PARAMETERS: SORG LIKE VBAK-VKORG,
    CCODE LIKE VBAK-BUKRS_VF.
    SELECT * FROM VBAK INTO TABLE IT_VBAK UP TO 100 ROWS
    WHERE
    VKORG = SORG AND
    BUKRS_VF = CCODE.
    SELECT * FROM VBAP INTO TABLE IT_VBAP UP TO 100 ROWS
    FOR ALL ENTRIES IN IT_VBAK
    WHERE
    VBELN = IT_VBAK-VBELN.
    LOOP AT IT_VBAP.
    WRITE: / IT_VBAP-VBELN, IT_VBAP-ERNAM, IT_VBAP-POSNR.
    ENDLOOP.
    Thanks in advance..
    Any help will be greatly appritiated

    Hi
    Hope it will help you..
    Reward if help.
    REPORT ZVRDOC0 no standard page heading
    line-size 300
    line-count 50(5).
    TABLES : vbak, "Sales Document Header Level
    vbap, "Sales Document Header Level
    kna1. "General Data in customer Master
    *INTERNAL TABLE T_VBAP
    DATA : Begin of t_vbap occurs 0,
           vbeln like vbap-vbeln,
           matnr like vbap-matnr,
           posnr like vbap-posnr,
           arktx like vbap-arktx,
           kwmeng like vbap-kwmeng,
           cmkua like vbap-cmkua,
           end of t_vbap.
    *INTERNAL TABLE T_TAB.
    DATA : Begin of t_tab occurs 0,
            vbeln like vbak-vbeln,
            kunnr like vbak-kunnr,
            audat like vbak-audat,
            netwr like vbak-netwr,
            vkorg like vbak-vkorg,
            name1 like kna1-name1,
            land1 like kna1-land1,
            end of t_tab.
    *INTERNAL TABLE T_FINAL.
    DATA : Begin of t_final occurs 0,
            vbeln like vbap-vbeln,
            kunnr like vbak-kunnr,
            matnr like vbap-matnr,
            posnr like vbap-posnr,
            arktx like vbap-arktx,
            kwmeng like vbap-kwmeng,
            cmkua like vbap-cmkua,
            audat like vbak-audat,
            netwr like vbak-netwr,
            vkorg like vbak-vkorg,
            name1 like kna1-name1,
            land1 like kna1-land1,
            end of t_final.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-bO3.
    parameters : P_kunnr like vbak-kunnr.
    select-options : S_vbeln for vbak-vbeln,
                     S_audat for vbak-audat.
    SELECTION-SCREEN END OF BLOCK B1.
    start-of-selection.
    select vbeln  matnr posnr arktx kwmeng cmkua  from vbap
    into corresponding fields  of table  t_vbap  where vbeln in S_vbeln .
    IF sy-subrc EQ 0.
    select  vbakkunnr vbakvbeln vbakaudat vbaknetwr vbak~vkorg
            kna1name1 kna1land1  into  table   t_Tab   from
            vbak   join  kna1   on kna1kunnr  = vbakkunnr
            FOR ALL ENTRIES IN t_vbap
            where vbak~vbeln = t_vbap-Vbeln and
            vbak~kunnr = p_kunnr and
            vbak~audat  in  S_audat .
    ENDIF.
    *end-of-selection.
    loop at t_vbap.
    read table t_tab with key vbeln = t_vbap-vbeln.
    move :
    t_vbap-vbeln to t_final-vbeln,
    t_vbap-matnr to t_final-matnr,
    t_vbap-posnr to t_final-posnr,
    t_vbap-arktx to t_final-arktx,
    t_vbap-kwmeng to t_final-kwmeng,
    t_vbap-cmkua to t_final-cmkua,
    t_tab-kunnr to t_final-kunnr,
    t_tab-audat to t_final-audat,
    t_tab-netwr to t_final-netwr,
    t_tab-vkorg to t_final-vkorg,
    t_tab-name1 to t_final-name1,
    t_tab-land1 to t_final-land1.
    append t_final.
    clear t_Final.
    endloop.
    sort t_Final by vbeln   Kunnr    matnr posnr  .
    loop at t_final.
    at new vbeln.
    write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse.
    ULINE /1(250).
    endat.
    write : /1 SY-VLINE, 2 t_final-vbeln color 5 inverse,
    20 SY-VLINE, 21 t_final-posnr color 5 inverse,
    40 SY-VLINE, 41 t_final-matnr color 5 inverse,
    60 SY-VLINE, 61 t_final-arktx color 4 inverse,
    80 SY-VLINE, 81 t_final-kwmeng color 4 inverse,
    100 SY-VLINE, 101 t_final-cmkua color 4 inverse,
    120 SY-VLINE, 121 t_final-kunnr color 3 inverse,
    140 SY-VLINE, 141 t_final-audat color 3 inverse,
    160 SY-VLINE, 161 t_final-netwr color 2 inverse,
    180 SY-VLINE, 181 t_final-vkorg color 2 inverse,
    210 SY-VLINE, 211 t_final-name1 color 1 inverse,
    230 SY-VLINE, 231 t_final-land1 color 1 inverse,
    250 SY-VLINE.
    at end of vbeln.
    sum.
    ULINE /1(250).
    write: /60 SY-VLINE, 'Total' ,
    81 t_final-kwmeng color 4 inverse ,100 SY-VLINE,
    101 t_final-cmkua color 4 inverse,120 SY-VLINE.
    ULINE /1(250).
    endat.
    at last.
    SKIP 2.
    sum.
    ULINE /1(250).
    write: /1 SY-VLINE, 60 SY-VLINE, 'Grand Total' ,
    81 t_final-kwmeng color 4 inverse , 100 SY-VLINE ,
    101 t_final-cmkua color 4 inverse,120 SY-VLINE.
    ULINE /1(250).
    endat.
    endloop.
    TOP-OF-PAGE.
    ULINE /50(24).
    WRITE : /50 SY-VLINE , 52 'SALES ORDER DETAILS' COLOR 5,
    73 SY-VLINE.
    ULINE /50(24).
    ULINE .
    WRITE: /10 'CURRENT DATE :', 25 SY-DATUM COLOR 1 INVERSE,
    100 'CURRENT TIME :', 115 SY-UZEIT color 5 INVERSE.
    WRITE: /10 'USERNAME :', 25 SY-UNAME COLOR 1 INVERSE,
    100 'PAGE NO :', 113 SY-PAGNO COLOR 5 INVERSE.
    WRITE: /10 'LOGON CLIENT :', 25 SY-MANDT COLOR 1 INVERSE,
    100 'COLON N0 :', 114 SY-COLNO COLOR 5 INVERSE.
    WRITE: /10 'CURRENT REPROT:', 25 SY-REPID COLOR 1 INVERSE,
    100 'LANGUAGE :', 116 SY-LANGU COLOR 5 INVERSE.
    ULINE.
    ULINE /1(250).
    write : /1 SY-VLINE, 2 'SALES DOC NO' color 6 inverse,
    20 SY-VLINE, 21 'SALES DOC ITEM' color 6 inverse,
    40 SY-VLINE,41 'MATERIAL NO' color 6 inverse,
    60 SY-VLINE, 61 'SHORT SALES TEXT' color 6 inverse,
    80 SY-VLINE, 81 'CUMM ORDER SALES' color 6 inverse,
    100 SY-VLINE, 101 'CREDIT DATA' color 6 inverse,
    120 SY-VLINE, 121 'CUSTOMER NO' color 6 inverse,
    140 SY-VLINE, 141 'DOC DATE' color 6 inverse,
    160 SY-VLINE, 161 'NET VALUE SALES' color 6 inverse,
    180 SY-VLINE, 181 'SALES ORG' color 6 inverse,
    210 SY-VLINE, 211 'CUSTOMER NAME' color 6 inverse,
    230 SY-VLINE, 231 'CUSTOMER CONTY' color 6 inverse,
    250 SY-VLINE.
    ULINE /1(250).
    END-OF-PAGE.
    ULINE.
    WRITE: /45 ' THIS IS END OF PAGE FOR SALES DOCUMENT DETAILS'
    COLOR 6 .

  • Query to mimic the items tab of the Sales Analysis report.

    Hi there,
    I'm currently looking to create a query that mimics the behaviour of the Sales Analysis report in B1. The items tab of the Sales Analysis report provides all the data I require - the only issue is that I would like to merge this data with some other data regarding current on hand stock quantities etc. and therefore I would like to be able to pull out the query behind the Sales Analysis report.
    I'm assuming this cannot be done and therefore I'm attempting to build a query to replicate the results. The query needs to show Item No, Item Description, Quantity Sold, Sales Amt (in system currency), Gross Profit and Gross Profit % for items within a given period.
    If this can be done relatively easily, can the query then be modified to show all items (including items that haven't sold in the date range) merely with '0' for Quantity Sold, Sales Amt etc. if the item hasn't been sold in the period, and the appropriate figures if each of these columns if the item has sold. I assume some kind of CASE statement can be used to generate this.
    So the query needs to show Item No, Item Description, Current quantity in stock, Quantity Sold, Sales Amt (in system currency), Gross Profit and Gross Profit % for all items within a given date range.
    I hope you can assist me with this problem.
    Thanks
    Grant.

    Hi,
    Thanks Gordon that was exactly what I needed.
    I've been trying to add some additional columns to the query but I'm experiencing some errors and I can't quite tell why.
    Basically, here's the code from another working query I have which I wish to merge into the query you've suggested above:
    SELECT T0.[ItemCode],
    T0.[ItemName],
    T3.[ItmsGrpNam],
    T4.[Name] AS [Sub-Category],
    T5.[Name] AS [Sub-Sub-Category],
    T0.[CardCode] AS [Pref Supplier],
    T6.[FirmName] AS [Brand],
    T0.[U_Range],
    T0.[OnHand],
    CASE WHEN T0.[StockValue] = 0 THEN 0 ELSE T0.[StockValue] END AS [StockValue],
    T1.[Price] AS [PBK GBP Price],
    CASE WHEN T0.[OnHand] = 0 THEN T0.[LastPurPrc] ELSE T0.[StockValue]/T0.[OnHand] END AS [Ave Cost],
    CASE WHEN T0.[OnHand] = 0 THEN T1.[Price]-T0.[LastPurPrc] ELSE CASE WHEN T0.[OnHand] > 0 THEN T1.[Price]-T0.[StockValue]/T0.[OnHand] END END AS [Margin],
    CASE WHEN T0.[OnHand] = 0 AND T0.[LastPurPrc] = 0 THEN 0 ELSE CASE WHEN T0.[OnHand] > 0 AND (T0.[StockValue]/T0.[OnHand]) = 0 THEN 0 ELSE CASE WHEN T0.[OnHand] = 0 THEN (T1.[Price]-T0.[LastPurPrc])/T1.[Price]*100 ELSE CASE WHEN T0.[OnHand] > 0 THEN (T1.[Price]-T0.[StockValue]/T0.[OnHand])/T1.[Price]*100 END END END END AS [Margin %],
    T0.[LastPurPrc]
    FROM [dbo].[OITM]  T0 INNER JOIN [dbo].[ITM1]  T1 ON T0.ItemCode = T1.ItemCode INNER JOIN [dbo].[OITB]  T3 ON T0.ItmsGrpCod = T3.ItmsGrpCod LEFT OUTER JOIN [dbo].[@U_SUBCATEGORY]  T4 ON T0.U_Subcategory = T4.Code LEFT OUTER JOIN [dbo].[@U_SUBSUBCATEGORY]  T5 ON T0.U_SubSubCategory = T5.Code INNER JOIN OMRC T6 ON T0.FirmCode = T6.FirmCode
    WHERE T0.[OnHand] >= 0 and T0.U_Range not in ('E','X')  
    ORDER BY T0.[ItemCode]
    Essentially I just wish to add the fields which are specified in the query above, but not in the query you've already suggested:
    SELECT T0.ItemCode,
    Max(T0.ItemName),
    Max(IsNull(T0.OnHand,0)) 'In Stock',
    SUM(IsNull(T1.Quantity,0)) 'Quantity',
    Sum(IsNull(T1.LineTotal,0)) 'Sales Amt',
    SUM(IsNull(T1.GrssProfit,0)) 'Gross Profit',
    Case WHEN Sum(Isnull(T1.LineTotal,0)) = 0 THEN 0 ELSE
    SUM(IsNUll(T1.GrssProfit,0))/Sum(Isnull(T1.LineTotal,0)) * 100 END 'Gross Profit %'
    FROM dbo.OITM T0
    LEFT JOIN dbo.INV1 T1 ON T1.ItemCode=T0.ItemCode
    LEFT JOIN dbo.OINV T2 ON T2.DocEntry=T1.DocEntry AND T2.DocDate Between [%0] AND [%1]
    GROUP BY T0.ItemCode
    I was hoping it would be fairly straight forward but so far I've had limited success.
    What am I missing here?
    Thanks in advance!

Maybe you are looking for