Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hey community
I am having the following issue:
I would like to reload data from a table within SAP. Since I only need the latest 3 months I applied this formula:
date(AddMonths(MonthStart(today()),-2),'YYYYMMDD') which would result by today in 20140801.
The problem is, if I put that into the where statement, it wouldn't work. If i put the plain numbers - hard coded - into it, it works. I think the solution would be, to transform the date format shown above, into a number. Unfortunatley, if I do that, it turns to 41852.
How would you guys go about such an issue?
regards
Sebastian
Following anbu's solution, if vDt has the value you want, maybe it work using () in where clause:
Let vDt= date(AddMonths(MonthStart(today()),-2),'YYYYMMDD');
Sql Select * from Table where DateField > '$(vDt)';
All dates have a corresponding numerical value as you experienced, if you need the date again simply do
Date(41852...let me knowHi Sebastian, if the hard-coded number works you can try with the $-expansion formula:
$(=date(AddMonths(MonthStart(today()),-2),'YYYYMMDD'))
Let vDt= date(AddMonths(MonthStart(today()),-2),'YYYYMMDD');
Sql Select * from Table where DateField > '$vDt';
Hey all,
I tried both, Ruben's and Anbu's proposal, unfortunatley it didn't work. Especially Anbu's solution seemed promising, since the LET statement should display the content of a variable as it is?
Can you post sample qvw
Text(date(AddMonths(MonthStart(today()),-2),'YYYYMMDD'))
or
Num#(Text(date(AddMonths(MonthStart(today()),-2),'YYYYMMDD')))
?
Following anbu's solution, if vDt has the value you want, maybe it work using () in where clause:
Let vDt= date(AddMonths(MonthStart(today()),-2),'YYYYMMDD');
Sql Select * from Table where DateField > '$(vDt)';
This one worked. The brackets were missing. I think though, that Marco's solution might work too. Going to try that...
Thanks guys!!