Date Variable not working on Query

I have a query that is working just fine and returns the correct values. The problem is that no matter what dates I put in, it always returns all records, not the ones from the variable. Can anyone take a look and see what it is I am doing wrong, or why is it that the date variable has no meaning when I run this.
Here is the query I am using:
SELECT     '00001' AS 'Co', T0.CardName AS 'Customer', T0.CardCode AS 'Customer #', T0.Address2 AS 'Ship To Address', T3.City AS 'Ship To City', T3.State, T3.ZipCode, T3.Country, T0.DocNum AS 'Invoice Number', SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) + CASE WHEN SUM(T1.VATSum) <> 0 THEN SUM(T1.VATSum) ELSE 0 END AS 'Invoiced amount', SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) AS 'Sale', CASE WHEN (T1.TAXCODE LIKE ('%EX')) THEN SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) ELSE 0 END AS 'Exempt Sales', CASE WHEN (T1.TAXCODE NOT LIKE ('%EX') AND T1.VatPrcnt = 0) THEN SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) ELSE 0 END AS 'Not Taxed', CASE WHEN SUM(T1.VATSum) <> 0 THEN SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) ELSE 0 END AS 'Tax Base', CASE WHEN SUM(T1.VATSum)
<> 0 THEN SUM(T1.VATSum) ELSE 0 END AS 'Tax', T1.VatPrcnt AS 'Rate', T1.TaxCode AS 'Tax Rate/Area', T2.Name AS 'Tax Area Description', T0.DocDate AS 'GL Date', T0.TaxDate AS 'Document Date',T3.AdresType
FROM OINV T0
Inner Join INV1 T1 on T0.DocEntry = T1.DocEntry
Inner Join OSTC T2 on T1.TaxCode = T2.Code
Left Outer Join CRD1 T3 on T0.CardCode = T3.CardCode and T0.ShipToCode = T3.address
Where    (T3.AdresType <> 'b') OR  (T0.ShipToCode = ' ') AND (T0.DocDate >= '[%01]' or isnull('[%01]','')='')
and (T0.DocDate <= '[%02]'  or isnull('[%02]','')='')
Group By T0.DocNum, T0.CardCode, T0.CardName, T0.Address2, T1.TaxCode, T0.DocDate, T0.TaxDate, T2.Name, T3.ZipCode, T3.City, T3.State, T3.Country, T1.VATPrcnt, T3.AdresType
Order By T1.TaxCode, T0.CardName, T3.AdresType
For Browse

Hi,
Try:
SELECT '00001' AS 'Co',
T0.CardName AS 'Customer',
T0.CardCode AS 'Customer #',
T0.Address2 AS 'Ship To Address',
T3.City AS 'Ship To City',
T3.State, T3.ZipCode,
T3.Country, T0.DocNum AS 'Invoice Number',
SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) + CASE WHEN SUM(T1.VATSum)!= 0 THEN SUM(T1.VATSum) ELSE 0 END AS 'Invoiced amount',
SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) AS 'Sale',
CASE WHEN (T1.TAXCODE LIKE ('%EX')) THEN SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) ELSE 0 END AS 'Exempt Sales',
CASE WHEN (T1.TAXCODE NOT LIKE ('%EX') AND T1.VatPrcnt = 0) THEN SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) ELSE 0 END AS 'Not Taxed',
CASE WHEN SUM(T1.VATSum) !=0 THEN SUM(T1.LineTotal * (100 - T0.DiscPrcnt) / 100) ELSE 0 END AS 'Tax Base',
CASE WHEN SUM(T1.VATSum) !=0 THEN SUM(T1.VATSum) ELSE 0 END AS 'Tax',
T1.VatPrcnt AS 'Rate',
T1.TaxCode AS 'Tax Rate/Area',
T2.Name AS 'Tax Area Description',
T0.DocDate AS 'GL Date',
T0.TaxDate AS 'Document Date',
T3.AdresType
FROM OINV T0
Inner Join INV1 T1 on T0.DocEntry = T1.DocEntry
Inner Join OSTC T2 on T1.TaxCode = T2.Code
Left Join CRD1 T3 on T0.CardCode = T3.CardCode and T0.ShipToCode = T3.address
Where ((T3.AdresType != 'b') OR (T0.ShipToCode = ' ')) AND (T0.DocDate >= '[%01\]' or isnull('[%01\]','')='')
and (T0.DocDate <= '[%02\]' or isnull('[%02\]','')='')
Group By T0.DocNum, T0.CardCode, T0.CardName, T0.Address2, T1.TaxCode, T0.DocDate, T0.TaxDate, T2.Name, T3.ZipCode, T3.City, T3.State, T3.Country, T1.VATPrcnt, T3.AdresType
Order By T1.TaxCode, T0.CardName, T3.AdresType
For Browse
Thanks,
Gordon

Similar Messages

  • Query key Date Variable not working

    Hi Folks -
         I am coming across an issue with which some of you might be able to help me. I have a time dependent master data object which I've marked as a datatarget and have created a report on it. I wanted to give the user an option of specifying the key date and hence have created a variable in the query properties for the key date. This variable is of the type SINGLE VALUE, MANDATORY, USER ENTRY and CAN BE CHANGED DURING QUERY NAVIGATION.
         Now my issue is that even though I enter a specific key date, the query is not pulling the records according to the key date. But instead if I use the option of specifying a particular date (instead of a variable in query properties), the query is running fine!!! Can someone please let me know why this is happening? Why is the query working fine when I mention a single constant value but not when I use a variable? Thanks for your help in advance.

    hi
    This clearly shows your variable is not working fine
    So in RSRT transaction debug using your variable
    See in every step whether the variable is working properly
    Assign points if useful
    Thanks
    N Ganesh

  • Date field not working in Query definition

    Hello Experts ,
    I am trying to prepare one report which will pull some fields ( extended fields ) from Rfx header page and display in the report . For this I have made one  query definition and written SQL query .  Now all fields except the date fields are successfully fetched and displayed by the query .  Only when I am adding the date field inside "result field" tab , the query is throwing error  like -
    " ORA-00904: "EFFECTIVE_START_DATE": invalid identifier   "
    but this field name is correct  .
    Any formatting needs for this field ?
    Regards
    Sudipta

    Hi Sudipta,
    Thanks for your reply.
    Actually I have created a diferent extension field and want to add that field in Results fields of particular Query Definition. But when I use it Tablename.Extension_Field_Name, its giving below exception
    ORA-00904: "t"."fieldname": invalid identifier
    Any idea what needs to be taken care of while using extension fields in Queries.
    Thanks,
    Saloni

  • Bug (?) - TP3 - Date popup not work in query panel

    Steps:
    1. In the data control pallette, expand a view object that has a date attribute
    2. Drop the "All Queriable Attributes" named criteria onto a page and choose "Query -> ADF Query Panel With Table"
    3. Run the page. Click on the icon next to the date field in the query panel to launch the date picker. Notice that nothing pops up
    I tried this both in IE7 and FF2 with the same results

    Hi Scott,
    The error is present in the TP3 release but I couldn't replicate it in one of the latest build so this is fixed for upcoming releases.
    Juan C.

  • Text Variable not working correctly

    In CS3 I could create a TEMPLATE (.indt) with the "creation date" text variable in it and when I opened it it would have the CURRENT DATE (the date the new file was generated from the template) . In CS4 it opens with the date the TEMPLATE was MADE and not the current date (the day the new file was generated). I need the template to open with the current date (the day the template was opened). I tried using the "modification date" variable which works the FIRST time but if I open it the next day the date changes. I need the date to remain the same as the creation date. Does this make sense? Why did Adobe change the behavior of this? Please help.
    -John Streeter

    Hi Rakesh,
    Just curious what is the purpose of creating a hidden column as suggested? Anyway, I have created it but nothing changes.
    Allow me to clarify my situation again.
    I have three columns:
    1. Actual This Year
    Type: Selection
    2. Actual Last Year
    Type: Selection
    3. % of Actual This Year / Actual Last Year
    Type: Formula
    Definition: (Actual This Year) %A (Actual Last Year)
    All columns use &0T_FYEAR& as text replacement variable. As such, all title would have year text.
    The first two columns have been restricted with Fiscal Year variable, 0P_FYEAR.
    1. Actual This Year
    0P_FYEAR
    2. Actual Last Year
    0P_FYEAR - 1
    Upon executing the query, I got the first two columns displaying their titles right, but the third column does not.
    For example, let's assume I entered 2008 for 0P_FYEAR variable, the columns would display the following titles:
    1. 2008
    2. 2007
    3. &0T_FYEAR&
    I need the third column to display current fiscal year i.e. 2008 but it does not.
    Appreciate your help!

  • (Substitution Variables) not working in "SQL Developer" Environment !!!!!!!

    this photo illustrate how that (Substitution Variables) not working in "SQL Developer" Environment :-
    http://www.imagehosting.com/show.php/1555180_ddddd.PNG.html
    any solve for this problem ?????!!!!!!!!!!

    There is a dedicated forum for SQL Developer related questions
    SQL Developer
    I should admit however, that query you have provided ( with substitution variables) works like a charme in my environment (SQL Developer 1.1.0.23 build 23.64)
    Best regards
    Maxim

  • Payload variables not working

    Hi all,
    I've been trying to use Profile Manager to specify user e-mail accounts on Mac devices (eg, MacBooks) but I've been encountering a couple of problems. I've tried searching around and didn't find any answers.
    First of all I'm running the latest Mountain Lion Sever. All clients have up-to-date Mountain Lion too.
    Problem 1: Payload variables not working
    I'd like to automatically setup Gmails on the MacBooks. Now the users' email addresses are already set to their gmail accounts. So all I have to be able to do is use the %email% payload variable as the username when I go set up the (IMAP) mail accounts in the Profile Manager. However, when I download the profile to the device, it does not convert the payload variable; ie, it tries to log into gmail with the username '%email%'. Other payload variables do not work either.
    Oddly enough, the payload variables work as they should with iOS devices...
    Problem 2: Profiles stuck on 'Sending'
    After enrolling the devices, it seems a hit and miss whether the MacBook downloads the correct profiles from the server... Is there a way to force on the MacBook to update/refresh its profiles? Also, when I update profiles within Profile Manager, the changes are pushed to iOS devices fine but not to MacBooks. Those tasks are all stuck on Sending... Logging in, restarting etc. sometimes helps but not always... Is there a reason why?
    Thanks in advance.
    P.S. Sorry I posted in the wrong forum first...

    Same problem here. Some profiles are being sent, some are stuck on the server. I have no idea why this difference.
    Any luck solving the issue?

  • Payload variables not working & Profiles stuck on 'Sending'

    Hi all,
    I've been trying to use Profile Manager to specify user e-mail accounts on Mac devices (eg, MacBooks) but I've been encountering a couple of problems. I've tried searching around and didn't find any answers.
    First of all I'm running the latest Mountain Lion Sever. All clients have up-to-date Mountain Lion too.
    Problem 1: Payload variables not working
    I'd like to automatically setup Gmails on the MacBooks. Now the users' email addresses are already set to their gmail accounts. So all I have to be able to do is use the %email% payload variable as the username when I go set up the (IMAP) mail accounts in the Profile Manager. However, when I download the profile to the device, it does not convert the payload variable; ie, it tries to log into gmail with the username '%email%'. Other payload variables do not work either.
    Oddly enough, the payload variables work as they should with iOS devices...
    Problem 2: Profiles stuck on 'Sending'
    After enrolling the devices, it seems a hit and miss whether the MacBook downloads the correct profiles from the server... Is there a way to force on the MacBook to update/refresh its profiles? Also, when I update profiles within Profile Manager, the changes are pushed to iOS devices fine but not to MacBooks. Those tasks are all stuck on Sending... Logging in, restarting etc. sometimes helps but not always... Is there a reason why?
    Thanks in advance.

    Same problem here. Some profiles are being sent, some are stuck on the server. I have no idea why this difference.
    Any luck solving the issue?

  • DOCUMENT SETTING that ALLOW FUTURE POSTING DATE does not work in PL34

    Hi Expert,
    I am now using SAP B1 2005B (7.40.252) sp:00 pl:34 and realised that the ALLOW Future Posting Date was not working. 
    I still can remember while I was using pl:11 at B1 2005A, there is no such problem and wish to know when can the bug fix up? in which sp/pl?
    Wish to hear goods news ASAP .
    Thank you.
    Joan.

    Basically can you please clarrify your requirement as to what you want to change ..what I understand you would need to change the code for ABAP - RFEBBE00
    Value Date code in the above abap
            IF PAR_VALD = 'X'.
              MOVE C2-VALDT TO HLP_VALDT.  "  VALUE DATE
             write hlp_valdt to umsatz-budat dd/mm/yy.
            ELSE.
              MOVE C8-BALDT TO HLP_BALDT.
              MOVE HLP_BALDT TO HLP_VALDT.
            write hlp_valdt to umsatz-budat dd/mm/yy.
            ENDIF.
               MOVE HLP_VALDT(2) TO UMSATZ-BUDAT.
               MOVE HLP_VALDT2(2) TO UMSATZ-BUDAT3.
               MOVE HLP_VALDT4(2) TO UMSATZ-BUDAT6.
    Regards
    Anurag
    Message was edited by: Anurag Bankley

  • The Restriction option to NOT ALLOW CHANGES to Mobile or Cellular data does not work why is this ?

    The Restriction option to NOT ALLOW CHANGES to Mobile or Cellular data does not work why is this ?

    Hi there,
    You may want to try force closing all open apps and resetting the device as an initial troubleshooting step. Take a look at the articles below for more information.
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    Turn your iOS device off and on (restart) and reset
    http://support.apple.com/kb/ht1430
    Additionally, you may want to try completely disabling and re-enabling restrictions.
    -Griff W.

  • Umm I just got this iPhone 5 and cellular data is not working, can't access apps, heck can't even download any and Safari...ummm yeah not happening.  I'm with Sprint if that makes any difference.

    Umm I just got this iPhone 5 and cellular data is not working, can't access apps, heck can't even download any and Safari...ummm yeah not happening.  I'm with Sprint if that makes any difference.

    Are you in an area where there is no coverage?
    You can try a reset, hold down the home/sleep button together until you see the apple logo and then release, then wait for the phone to boot back up.
    If that doesn't help, then yOu'll need to contact Sprint again.

  • HT1976 my cellular data is not working , how do i fix it

    my cellular data is not working
    when i turn it on it doesnt show
    but ym wirless network works
    i need help.
    thanks

    My cellular data stopped working when i update my iphone 5c to ios7.1 any help please

  • Row Level Security - Data filter - Roles Variable Not working in OBIEE 11.1.1.7.1

    Hi all,
    Previously, we were using OBIEE 11.1.1.5.0 and we were able to assign users to application roles by using the initialization block to assign the ROLES session variables.
    1. My USER_SECURITY table in Oracle database:
    USER_NAME | USER_ID | ROL
    user1       | 1723    | GobalDataRole
    user2       | 1739    | GobalDataRole
    user3      | 1743    | GobalDataRole
    2. The SQL query in my session initialization block:
    select USER_NAME, USER_ID, ROL
    from USER_SECURITY
    where USERNAME = ':USER'
    3. The row-wise initialization option is not checked.
    4. In the Oracle Enterprise Manager Fusion Middleware Control, we created new application role: GobalDataRole and sync with rpd.
    5. The GobalDataRole is used in the RPD to filter the data under permissions --> data filter. GobalDataRole only has access to Country A data.
    6. Result: under my account, also in rpd Manage --> Sessions, user variable details
    User_name , user_id & Rol variable is working fine as expected,
    When we log in as user1, we can see in My Account, user assigned to: BI Consumers; Authenticated Role; GobalDataRole
    When we log in as user2, we can see in My Account, user assigned to: BI Consumers; Authenticated Role; GobalDataRole
    When we log in as user3, we can see in My Account, user assigned to: BI Consumers; Authenticated Role; GobalDataRole
    User1, User2, and User3 are able to see the data correctly according the their data access setup.
    Now, we using OBIEE 11.1.1.7.1 and using the same method, but we not able to assign users to application roles by using the initialization block to assign the ROLES session variables anymore.
    Result:
    User_name & user_id variable is working fine as expected, but the ROl variaible is not capturing the DB value,
    When we log in as user1, we can see in My Account, user assigned to: BI Consumers; Authenticated Role
    When we log in as user2, we can see in My Account, user assigned to: BI Consumers; Authenticated Role
    When we log in as user3, we can see in My Account, user assigned to: BI Consumers; Authenticated Role
    User1, User2, and User3 can see all data (which is wrong) because they are not assigned to the correct application role that sets the data restriction/filter.
    Has anyone encountered the same issue? Any advice on how to solve this?
    Thanks in advance!
    Satheeshkumar P

    Thanks user10615659     ,
    - Yes the variable ROLES available in OBIEE 11.1.1.7.1
    - Tested the init block and variables in offline rpd its working as expected.
    - In online rpd, except ROLES and GROUP variable remaining variables working fine.
    - Verified log file in both online and offline init block testing - the init block execution is successful.
    Thanks

  • Power Query/Data Management Gateway data refresh not working

    Pretty new to o365/Power BI, but here's what I've got going on (hopefully someone can help me out):
    I created a data management gateway and data source.  The data source says it's online in the PowerBI admin center, and it seems to be working correctly.  I can open Excel 2013 on my desktop (logging in as my trial o365 account which has Power
    BI associated with it) and connect to the data source via Power Query using the oData option.  I make sure to import the data into the model, and then open up the PowerPivot window and create a simple pivot table using the data in the model.
    that all works just great.  The problem comes when I upload the workbook and try to update it.  I've tried a few different ways.
    1. When I try to manually refresh the workbook by opening it in my o365 site and going to data-->refresh I get the following error:
          An error occurred while working on the Data Model in the workbook. Please try again.
          We were unable to refresh one or more data connections in this workbook.
          The following connections failed to refresh:
          Connection: Power Query - dbo_DimProductCategory
          Error: Out of line object 'DataSource', referring to ID(s) 'a75593f3-c34d-4f83-9458-49aa2cece164', has been specified but has not been used.
          The following system error occurred: Class not registered
          The provider 'Microsoft.Mashup.OleDb.1' is not registered.
          Power Query - dbo_DimProductCategory
    2. When I go into Power BI and go to "Schedule Data Refresh" for the workbook, I get the following error:
          Sorry, the data connections in this report aren’t supported for Scheduled Refresh.
          Technical Details â–¼
          Correlation ID: B3CE4B10-2137-E593-6FCF-189B73465190
          Date and Time: 03/31/2014 06:20:39 PM (UTC)
    Any help would be greatly appreciated.  If you need additional information, I'd be happy to provide it.

    Hey Guy,
    Thanks for the reply.
    The "data source type" of the data source in Power BI is "SQL Server" (there was only that and Oracle available to select from)
    The "data source type" that Power Query is using in Excel is "From oData Feed"....which is using the Power BI data source....which is using the data management gateway.
    A few follow up questions if you have a second
    1. Do you know when PowerQuery data refresh will be supported? (just a general idea....weeks, months, next year?)
    2. Is there any other way to connect to (and be able to refresh) PowerBI data sources referencing "on prem" data via the data management gateway?  I tried using the oData feed URL in non-PowerQuery areas of excel (excel data tab, PowerPivot directly)
    but it didn't work.  If there's some other way to connect to and refresh on prem data, i'm all ears :D 
    Really appreciate your help, thanks for taking the time.

  • Key date not work in query on infoset

    hi experts,
    i have a infoset, which includes a time-dependent infoobject eg.0employee and an ods eg. ods1
    i set the ods time-dependent by setting from ods1-field1 to ods2-field2, and link the 0employee to ods1.
    then i create a query on the infoset and set a key date in the query, eg20061231.
    but the query result goes wrong, the key date doesn't work, the result shows below:
    employ1 1000.12.31-2008.01.01   $123 (this record is right,because i want the key date to be 20061232)
    employ1 2008.01.02-9999.12.31   $123 (but this record should not be displayed)
    i haven't set any field in infoset to be key date, just set the "from" and "to".
    pls help and thanks a lot!

    Hi
    Check the link.
    http://help.sap.com/saphelp_nw04/Helpdata/EN/11/723c3b35703079e10000000a114084/content.htm
    Chandu.

Maybe you are looking for

  • Problem with iTunes and sync two phones one laptop

    Me and my partner both have an iPhone I have iPhone 5 he has iPhone 4S he had his before me so he registered with iTunes I wanted some photos from his phone so stupidly instead of just sending them to myself I plugged my phone into iTunes and it auto

  • How to find whether any disk arry is connected in the system

    Hi Guys, Please help me regarding Disk Array. 1) What command(s) should I use to check whether any disk array is connected in the server or not. 2) Please share the method for, For single server system (A single sun server is connected with exernal d

  • Dbanalyzer ERROR 25: SQLDBC error -4008, POS(1) Unknown user name/password combination (SQL state "28000").

    Hello Gurus, we have a unusual problem with our MaxDB 7.9.8.25 We want to check the parameter like discribed in note 1111426, but dbanalyzer throws the following error. tttadm >/sapdb/TTT/db/bin/dbanalyzer -d TTT -u superdba,****** -f dbanalyzer_Inst

  • Question about the PNG location

    Hello, I've created a swf/fla simple  slideshow with 5 fireworks png images. 1.  Should I be using jpgs instead? 2.  When  uploaded to the internet, is the png now a part of the flash movie file,  and not a seperate png any longer?  i.e., If I had to

  • Report.SetParameterValue(  ,  )  question

    I bought one more book and followed an example for .NET coding. I do not want the parameter prompting screen to come up and I have a parameter value stored in a session variable that I am trying to use as the "value" in the following method from the