Gather and Report Data

I have an input form that the user enters a date range, and the procedure calculates the cost of number of records found by cost per record. I already have a finished product, but I am being asked to make significant changes to the way the data is gathered. I was using the Next_Day function, which was working just fine, but I was told it wasn't foolproof enough sigh. I have the "spelled out" outline of what needs to be done, but I am having trouble knowing where to start. Here's an excerpt of what I need this part of the procedure to do:
For each Date from Start Date through End Date
If Monday
Gather and Display Week's Data
Week Begin Day = Date -7 ***Go get a week's worth of data, start Mon
Week End Day = Date -1 ***End on Sunday
For each Day from Week Begin Day through Week End Day
If Vendor Effective Date = Day
If Vendor not Obsolete
or Vendor Obsolete Date > Week End Day
then
Increment Weekly Count
Even if you can't provide me with actual code, I would like to know what you would recommend I should look at. Like, if you think such and such function or whatever would work well here, that would be a great help. Thanks!
Hmmm, my outline didn't space the way I wrote it. Sorry.
Message was edited by:
user527082

Hi,
Couple of things that would take a lot of time/effort in this scenario would be handling the master data issues(as there are bound to be master data synchronization issues) eg if product A1 and product A2 are indeed same but represented differently in two source systems - how to report them as if they are one and the same; and, exclusion of intra-business transactions (when reporting at consolidated level, you would want to exclude transactions happening between different entities of the same organization).
For both these issues, there are various options in BW (as well as outside, eg MDM for master data).
This is not to say that this is all that is going to be there.
If XI indeed uses XML only (or even if it is another format, essentially it is message based where one message shall contain a limited no of data), it will not be good to do the bulk load. The way it will likely happen is you will do historic data loads direct from source systems to BW, and then can link up through XI (or directly as well, depending whether XI really makes sense in your scenario) to get the delta data fed to BW.
cheers,

Similar Messages

  • UCCX 7.0.1SR5 to 8.0 upgrade while also adding LDAP integration for CUCM - what happens to agents and Historical Reporting data?

    Current State:
    •    I have a customer running CUCM 6.1 and UCCX 7.01SR5.  Currently their CUCM is *NOT* LDAP integrated and using local accounts only.  UCCX is AXL integrated to CUCM as usual and is pulling users from CUCM and using CUCM for login validation for CAD.
    •    The local user accounts in CUCM currently match the naming format in active directory (John Smith in CUCM is jsmith and John Smith is jsmith in AD)
    Goal:
    •    Upgrade software versions and migrate to new hardware for UCCX
    •    LDAP integrate the CUCM users
    Desired Future State and Proposed Upgrade Method
    Using the UCCX Pre Upgrade Tool (PUT), backup the current UCCX 7.01 server. 
    Then during a weekend maintenance window……
    •    Upgrade the CUCM cluster from 6.1 to 8.0 in 2 step process
    •    Integrate the CUCM cluster to corporate active directory (LDAP) - sync the same users that were present before, associate with physical phones, select the same ACD/UCCX line under the users settings as before
    •    Then build UCCX 8.0 server on new hardware and stop at the initial setup stage
    •    Restore the data from the UCCX PUT tool
    •    Continue setup per documentation
    At this point does UCCX see these agents as the same as they were before?
    Is the historical reporting data the same with regards to agent John Smith (local CUCM user) from last week and agent John Smith (LDAP imported CUCM user) from this week ?
    I have the feeling that UCCX will see the agents as different almost as if there is a unique identifier that's used in addition to the simple user name.
    We can simplify this question along these lines
    Starting at the beginning with CUCM 6.1 (local users) and UCCX 7.01.  Let's say the customer decided to LDAP integrate the CUCM users and not upgrade any software. 
    If I follow the same steps with re-associating the users to devices and selecting the ACD/UCCX extension, what happens? 
    I would guess that UCCX would see all the users it knew about get deleted (making them inactive agents) and the see a whole group of new agents get created.
    What would historical reporting show in this case?  A set of old agents and a set of new agents treated differently?
    Has anyone run into this before?
    Is my goal possible while keeping the agent configuration and HR data as it was before?

    I was doing some more research looking at the DB schema for UCCX 8.
    Looking at the Resource table in UCCX, it looks like there is primary key that represents each user.
    My question, is this key replicated from CUCM or created locally when the user is imported into UCCX?
    How does UCCX determine if user account jsmith in CUCM, when it’s a local account, is different than user account jsmith in CUCM that is LDAP imported?
    Would it be possible (with TAC's help most likely) to edit this field back to the previous values so that AQM and historical reporting would think the user accounts are the same?
    Database table name: Resource
    The Unified CCX system creates a new record in the Resource table when the Unified CCX system retrieves agent information from the Unified CM.
    A Resource record contains information about the resource (agent). One such record exists for each active and inactive resource. When a resource is deleted, the old record is flagged as inactive; when a resource is updated, a new record is created and the old one is flagged as inactive.

  • Copy data models and reports from BW 3.1 to NW 2004s

    Hi experts,
    Our client has two BW servers: BW 3.1 and BI 7. BW 3.1 contains lots of data models and reports. And the BI 7 server is newly installed.
    Now we want to copy these data models and reports from BW 3.1 to the new BI 7 server. Are there any solutions for this?
    Thank you very much in advance.

    Hi Frank,
    Sounds like a cross version transport is needed.
    This is a solution we have used to do what you want to do:-
    Create and release a transport as per normal.
    Copy and transport the files from the source system (BW 3.1) e.g /usr/sap/trans/data & /usr/sap/trans/cofiles to the same folders on the target system.
    Basis help is needed here.
    From here onwards using stms_import should help you in the normal manner.
    Works a treat.
    Have transported the following all correctly appearing as 3.x data models in NW2004s.
    DSO objects.
    Cubes
    Transfer/Update rules
    Reports.
    Cheers,
    Pom

  • Query on fetching the no.of days between Invoice date and due date in rtf template embedded BI Publisher Report

    Hi Experts,
    We have a requirement to fetch the value of 'No of days' between Invoice date and due date (Two variable date fields on the template) in an Analysis.
    Please let me know the procedure of how to achieve the same.
    Regards,
    Rev

    it's good for ideas but implementation a bit different
    Oracle Business Intelligence Publisher Report Designer's Guide
    This function provides a method to get the difference between two dates in the given locale. The dates need to be in "yyyy-MM-dd" format. This function supports only the Gregorian calendar. The syntax is as follows:
    <?xdoxslt:date_diff(‘format’, ‘YYYY-MM-DD’, ‘YYYY-MM-DD’, $_XDOLOCALE, $_XDOTIMEZONE)?>
    where
    format is the time value for which the difference is to be calculated
    Example:
    <?xdoxslt:date_diff(‘d’, ‘2006-04-08’, ‘2006-04-01’, $_XDOLOCALE, ‘America/Los_Angeles’)?>
    returns
    -7

  • Multiple data sets: a common global dataset and per/report data sets

    Is there a way to have a common dataset included in an actual report data set?
    Case:
    For one project I have about 70 different letters, each letter being a report in Bi Publisher, each one of them having its own dataset(s).
    However all of these letters share a common standardized reference block (e.g. the user, his email address, his phone number, etc), this common reference block comes from a common dataset.
    The layout of the reference block is done by including a sub-llayout (rtf-file).
    The SQL query for getting the dataset of the reference block is always the same, and, for now, is included in each of the 70 reports.
    Ths makes maintenance of this reference block very hard, because each of the 70 reports must be adapted when changes to the reference block/dataset are made.
    Is there a better way to handle this? Can I include a shared dataset that I would define and maintain only once, in each single report definition?

    Hi,
    The use of the subtemplate for the centrally managed layout, is ok.
    However I would like to be able to do the same thing for the datasets in the reports:
    one centrally managed data set (definition) for the common dataset, which is dynamic!, and in our case, a rather complex query
    and
    datasets defined on a per report basis
    It would be nice if we could do a kind of 'include dataset from another report' when defining the datasets for a report.
    Of course, this included dataset is executed within each individual report.
    This possibility would make the maintenance of this one central query easier than when we have to maintain this query in each of the 70 reports over and over again.

  • Retrieving Freezed and Unfreezed data from a Single Report

    Dear All,
    I have a requirement where we have 2 types of users.
    1. End User and 2. Super User 3. Intermediate Users
    We have source system data which will be retieved on a daily basis.
    Here Super user freeze the data ramdomly.
    We need a report to be generated which with show
    1.Freezed data to Super user
    2. Unfreezed data to End User and
    3. Intermediate User who needs both freezed and unfreezed data.
    Can someone suggest the most optimal way to execute this requirement.
    Early response will be appreciable.
    Thanks,
    Sai Gautam

    Hi,
    you could use the scheduling function of BOE for this.
    For the Super Users: The Report will be scheduled after the data has been frezzed
    For the End Users: They can run the Report On- Demand on any Time
    For Intermediate Users: They can do both. View the Instance of the Scheduled Report and run the Report On- Demand
    This could be handled by Permissions in BOE.
    Regards
    -Seb.

  • Report for Validity Start and End Date in PO

    Dear All
    Is there any report where I can get PO validity start and end date which user input in addtional data header tab of PO?
    Regards
    Satish Kumar

    Hi,
    Yes, It is available standard report using T-code ME2N - Purchasing Document (PO) Per Document Number, enter the T-code and provide the following input data's are as follows.
    Scope of List                 :  ALV ( for Ms-Excel format report)
    Plant                               :   __________ to __________ (if required)
    Document Date              : ____________ to ___________ (if Required)
    Execute the report shown by default in excel format and if required PO validity start and end data, you have to select Change Layout button and open new window options screen right side field option as Validity Per.Start, Validity Period End, Commutative number field data's are selected and click <--- arrow button and then click bottom tick marked button. Now, the report shown your requirement.
    Hope, it is useful for you,
    Regards,
    K.Rajendran

  • Report for shedule vs supply and report for opening stock at back date.

    Dear All Guru,
    please can anybody reply me is there any standard report is available for
    1) Report for shedule vs supply
    2) and report for opening stock at back date.(ex- opening stock at last month 16th july or two months back on 10th may
    pl suggest if any standard report is available or how we can data for this
    Regards,
    Vimlesh

    Hi,
    To see the opening stock at a particular date use T.Code: MB5B,
    To see the scheduled quantity & delivered quantity use table EKET with the filed names MENGE & WEMNG.
    Regards,
    Prabu

  • ALV Report how to display from and to date values in the header.

    I develoeped alv report . i want to display selection screen from and to date values in  top of page...
    any sample code pls guide me..

    You have to do many things...
    first find the selection details using the FM.
    RS_REFRESH_FROM_SELECTOPTIONS
    use the Blog to Align/populate the Header  from the selection table
    /people/community.user/blog/2007/05/07/alignment-of-data-in-top-of-page-in-alv-grid

  • PO report with cost center, order and delivery date

    Hi,
    pls. I just need a report to display the next fields Account Assigment and Delivery Date.
    I attempted with standard reports like ME2N, ME2K but it is impossible to display all the information in the same screen.
    Thanks a lot for cooperation.
    Regards.

    HI,
    Create a Infoset query or ask ababper
    Tables EKKN, EKPO, EKKO
    Regards,
    Pardeep Mlaik

  • Report is executing in background and need data(output) in excel format

    Report is executing in background and need data(output) to get downloaded in excel format in my PC from an internal table;;in any drive i.e. C: or D: .When executing in backround it prompt to user with which location excel file to be saved and the name of file.How to download in background in excel format?
    Edited by: PRASHANT BHATNAGAR on Aug 26, 2008 6:24 AM

    Hi
    Download a report to excel with format (border, color cell, etc)
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_MAPL TYPE OLE2_OBJECT,         " list of workbooks
          H_MAP TYPE OLE2_OBJECT,          " workbook
          H_ZL TYPE OLE2_OBJECT,           " cell
          H_F TYPE OLE2_OBJECT.            " font
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Regards
    Murali Papana

  • Report for special prourement type and GR date

    Hi Gurus,
    Is there a report in SAP that gives us the special prourement type for a material and the date which they were goods receipted into our stock?
    thanks
    Anusha

    No std report available for this kind of seleciton
    either youhave to write the query or custom program
    make joint with MSEG adn MARC for query

  • Stock movement report date and warehouse wise

    I need this report date wise and warehouse wise...
    please help ..
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @Whse nvarchar(10)
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select @Whse = Max(s2.Warehouse) from dbo.OINM S2 Where S2.Warehouse = '[%2]'
    Select @Whse as 'Warehouse',
    a.Itemcode,
    max(a.Dscription) as ItemName,
    sum(a.OpeningBalance) as OpeningBalance,
    sum(a.INq) as 'IN',
    sum(a.OUT) as OUT,
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing
    --(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
    from( Select N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,
    (sum(N1.inqty)-sum(n1.outqty))as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
    Where N1.DocDate < @FromDate and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,
    N1.Dscription Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0 and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription
    Union All select N1.Warehouse, N1.Itemcode, N1.Dscription, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0
    and N1.Warehouse = @Whse Group By N1.Warehouse,N1.ItemCode,N1.Dscription) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode

    please advice.. - wrong out put.
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
    select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
    select
    a.Itemcode, a.warehouse,a.price as 'Item Cost',
    max(a.Dscription) as ItemName,
    sum(a.OpeningBalance) as OpeningBalance,((sum(a.OpeningBalance) *a.Price)) as 'Opening STock Value',
    sum(a.INq) as 'IN',
    sum(a.INq)*a.Price as 'IN Stock Value',
    sum(a.OUT) as OUT,
    sum(a.OUT)*a.Price as 'OUT Stock Value',
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT)) as Closing,
    ((sum(a.OpeningBalance) + sum(a.INq)) - Sum(a.OUT))*a.Price as 'Closing Stock Value'
    --(Select i.InvntryUom from OITM i where i.ItemCode=a.Itemcode) as UOM
    from( Select N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,n1.Price,
    (sum(N1.inqty)-sum(n1.outqty))as OpeningBalance, 0 as INq, 0 as OUT From dbo.OINM N1
    Where N1.DocDate < @FromDate  Group By N1.Warehouse,N1.ItemCode,n1.Price,
    N1.Dscription
    Union All
    select N1.Warehouse, N1.Itemcode, N1.Dscription,n1.Price, 0 as OpeningBalance,
    sum(N1.inqty) , 0 as OUT From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <= @ToDate
    and N1.Inqty >0  Group By N1.Warehouse,N1.ItemCode,N1.Dscription,n1.Price
    Union All
    select N1.Warehouse, N1.Itemcode,N1.Dscription,n1.Price, 0 as OpeningBalance, 0 , sum(N1.outqty) as OUT
    From dbo.OINM N1 Where N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and N1.OutQty > 0
    Group By N1.Warehouse,N1.ItemCode,N1.Dscription,n1.Price) a, dbo.OITM I1
    where a.ItemCode=I1.ItemCode
    Group By a.Itemcode,a.warehouse,a.Price
    Having sum(a.OpeningBalance) + sum(a.INq) + sum(a.OUT) > 0 Order By a.Itemcode

  • Please help to get onhand stock report with last purchase and billed date warehouse and item wise

    please help to get onhand stock report with last purchase and billed date warehouse and item wise

    Hi Rajeesh Ambadi...
    Try This
    SELECT distinct T0.ITEMCODE , t1.ItemName, T0.ONHAND as 'Total Qty',  
      T1.LASTPURDAT ,t1.LastPurPrc
    FROM OITW T0 INNER JOIN OITM T1 ON T0.ITEMCODE = T1.ITEMCODE
    INNER JOIN OITB T2 ON T1.ITMSGRPCOD=T2.ITMSGRPCOD left join ibt1 t3 on t3.itemcode = t0.itemcode and t3.whscode = t0.whscode
    WHERE
    T0.ONHAND>0
    AND T0.WhsCode ='[%0]'
    Hope Helpful
    Regards
    Kennedy

  • How Do I Filter a Report Using a Multi Select List Box and Specifying Date Between Begin Date and End Date

    Hope someone can help.  I have tried to find the best way to do this and can't seem to make sense of anything.  I'm using an Access 2013 Database and I have a report that is based on a query.  I've created a Report Criteria Form.  I
    need the user to be able to select multiple items in a list box and also to enter a Begin Date and End Date.  I then need my report to return only the records that meet all selected criteria.  It works fine with a ComboBox and 1 selection but can't
    get it to work with a List Box so they can select multiple items.  Any help is greatly appreciated while I still have hair left. 

    The query should return all records.
    Let's say you have the following controls on your report criteria form:
    txtStart: text box, formatted as a date.
    txtEnd: text box, formatted as a date.
    lbxMulti: multi-select list box.
    cmdOpenReport: command button used to open the report.
    The text boxes are used to filter the date/time field DateField, and the list box to filter the number field SomeField.
    The report to be opened is rptReport.
    The On Click event procedure for the command button could look like this:
    Private Sub cmdOpenReport_Click()
    Dim strWhere As String
    Dim strIn As String
    Dim varItm As Variant
    On Error GoTo ErrHandler
    If Not IsNull(Me.txtStart) Then
    strWhere = strWhere & " AND [DateField]>=#" & Format(Me.txtStart, "yyyy-mm-dd") & "#"
    End If
    If Not IsNull(Me.txtEnd) Then
    strWhere = strWhere & " AND [DateField]<=#" & Format(Me.txtEnd, "yyyy-mm-dd") & "#"
    End If
    For Each varItm In Me.lbxMulti.ItemsSelected
    strIn = strIn & "," & Me.lbxMulti.ItemData(varItm)
    Next varItm
    If strIn <> "" Then
    ' Remove initial comma
    strIn = Mid(strIn, 2)
    strWhere = strWhere & " AND [SomeField] In (" & strWhere & ")"
    End If
    If strWhere <> "" Then
    ' Remove initial " AND "
    strWhere = Mid(strWhere, 6)
    End If
    DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, WhereCondition:=strWhere
    Exit Sub
    ErrHandler:
    If Err = 2501 Then
    ' Report cancelled - ignore
    Else
    MsgBox Err.Description, vbExclamation
    End If
    End Sub
    If SomeField is a text field instead of a number field, change the line
            strIn = strIn & "," & Me.lbxMulti.ItemData(varItm)
    to
            strIn = strIn & "," & Chr(34) & Me.lbxMulti.ItemData(varItm) & Chr(34)
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

Maybe you are looking for