Current week + year in this format (2011-WK29)
Hi friends.
I am using this query to get the current week
select to_char(sysdate,'IW') from dual;I want to edit this query and add the current year also in this and the format should be 2011-WK29
Thanks in advance
Regards
Edited by: User_Apex on Jul 19, 2011 12:48 AM
Hi Chaitu
Thanks. This worked
select to_char(sysdate,'YYYY"-WK"IW') from dual;Regards
Similar Messages
-
Query to get data for current week+13
Hi Friends,
I have two tables
BACKLOG_WEEK_AFTER_ATP (LE)
BACKLOG_ATP_GT_CW (RE)
** First I have to query whats the current week and year and it should come in this format ---- 2011-WK30
columns in table BACKLOG_WEEK_AFTER_ATP are:
ITEM_NUMBER QUANTITY
1N5418 20
1N5614 30
1N5806SM 10
1N5811 0
2PFF6 60columns in table BACKLOG_ATP_GT_CW are:
ITEM_NUMBER QUANTITY YEAR_WEEK
1N5418 30 2011-WK30
1N5418 5 2011-WK31
1N5614 30 2011-WK32
1N5806SM 30 2011-WK33
1N5811 20 2011-WK32
3EX473K1 20 2011-WK30My report should look like
ITEM_NUMBER 2011-WK30 2011-WK31 2011-WK32 2011-WK33 ...............till 13th week
1N5418 10 -5 -5 -5 ...............till 13t week
1N5614 30 30 0 0 ................till 13th week
1N5806SM 10 10 10 20 ................till 13th week
1N5811 0 0 20 20 ................till 13th week
2PFF6 60 60 60 60 ................till 13th week
3EX473K1 20 20 20 20 ................till 13th weekTo get this report i have these conditions to keep in mind.
1) If item_number not present in LE table and present in RE table then repeat what it is in RE table till 13th week
2) If item_number not present in RE table and present in LE table then repeat what it is in LE table till 13th week
3) If item_number present in LE and also present in RE table then do subtraction for RE - LE for that particular item_number till 13th week.
4) If item_number is there in LE table but not present in RE table for current_week+1(today week comes as 29th week) then repeat the same which is there in LE table. If item is found in RE table for (example 32th week) then subtract RE -LE for that particular item_number
Thanks in advance.
RegardsHello,
If you don't need the PIVOT display, then this may help you :
with le as
(select '1N5418' item_number, 20 quantity from dual union all
select '1N5614' item_number, 30 quantity from dual union all
select '1N5806SM' item_number, 10 quantity from dual union all
select '1N5811' item_number, 0 quantity from dual union all
select '2PFF6' item_number, 60 quantity from dual ),
re as
(select '1N5418' item_number, 30 quantity, '2011-WK30' year_week from dual union all
select '1N5418' item_number, 5 quantity, '2011-WK31' year_week from dual union all
select '1N5614' item_number, 30 quantity, '2011-WK32' year_week from dual union all
select '1N5806SM' item_number, 30 quantity, '2011-WK33' year_week from dual union all
select '1N5811' item_number, 20 quantity, '2011-WK32' year_week from dual union all
select '3EX473K1' item_number, 20 quantity, '2011-WK30' year_week from dual
row_gen as (
select item_number, calc_year_week,
row_number() over(partition by item_number order by calc_year_week) rn
from
(select le.item_number from le union select item_number from re) item,
(select to_char(level*7+sysdate,'YYYY-"WK"WW') calc_year_week from dual connect by level<=13) week)
select item_number, calc_year_week, calc_qty
from row_gen, le, re
where row_gen.item_number=le.item_number(+)
and row_gen.item_number=re.item_number(+)
and row_gen.calc_year_week=re.year_week(+)
model
partition by (row_gen.item_number)
dimension by (rn)
measures (calc_year_week, year_week, le.quantity le_qty,re.quantity re_qty,0 calc_qty )
rules (
calc_qty[1] =
case when re_qty[cv()] is null then le_qty[cv()]
when le_qty[cv()] is null then re_qty[cv()]
else re_qty[cv()]-le_qty[cv()]
end,
calc_qty[rn>1] order by rn =
case when re_qty[cv()] is null then calc_qty[cv()-1]
else re_qty[cv()] - calc_qty[cv()-1]
end )
order by 1,2;I am not sure this is the simplest way to do it, but the results seem to match your example.
Regards,
Sylvie
Edited by: Troll35 on Jul 19, 2011 3:08 PM -
Selecting Invoice (OINV) records from the current financial year
Hi Everyone,
I would like to select Invoices (OINV) from the current Financial Year. I am located in Australia and our financial year is measured from the 1st of July to the 30th of June.
Here is a pseudo - code sample -
SELECT T1.DocEntry, T1.DocNum, T1.DocDate
FROM AU.dbo.OINV T1
WHERE "CURRENT FINANCIAL YEAR"
Notice above that I would like to replace "CURRENT FINANCIAL YEAR" with an SQL code snippet that selects all dates from the beginning of the financial year (1/07/xx) to the current date.
Any help here will be greatly appreciated.
Kind Regards,
DavidHi Everyone,
Here is a code snippet that permits returning only values from the current financial year -
DECLARE @day nvarchar(2) = DAY(GETDATE())
DECLARE @currentMonthAndDay INT = CAST(CAST(MONTH(GETDATE()) as nvarchar(2)) + (REPLICATE('0', 2 - LEN(@day)) + @day) as int)
DECLARE @StartOfFinancialYear DATETIME
SET @StartOfFinancialYear = CAST(YEAR(GETDATE()) - CASE WHEN @currentMonthAndDay<701 then 1 else 0 end as nvarchar(max)) + '0701'
SELECT *
FROM AU.dbo.OINV T0
WHERE T0.DocDate >= @StartOfFinancialYear
AND T0.DocDate < DATEADD(yy, 1, @StartOfFinancialYear)
Many thanks to Faheem for providing the answer to returning only results from the current financial year, in this thread: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/2edbe630-faca-4f94-a014-04f5a832f81d/returning-results-that-fall-within-the-current-financial-year?forum=transactsql
Kind Regards,
David -
Store value less than current week and year.
Hi All,
I have a table called BACKLOG whose structure is like this
ITEM_NUMBER YEAR_WEEK MS
1N58 2012-WK02 01/15/2012
1N58 2011-WK02 01/15/2011current from my procedure i am storing the value in my new table which is less than current week. But i want to store the value less than current week and current year. Please help me to get how i can do this.
PROCEDURE BACKLOG_PROC_LT_CW IS
BEGIN
DELETE BACKLOG_LT_CW;
COMMIT;
INSERT INTO BACKLOG_LT_CW
SELECT
DC_UTIL.GEN_YEAR_WEEK(MS) YEAR_WEEK,
ITEM_NUMBER,
MSD
FROM BACKLOG
where to_char(MS, 'IW')<to_char(sysdate, 'IW');
END BACKLOG_PROC_LT_CW;Currently with the above procedure code both the value is storing in my BACKLOG_LT_CW table but if you see the data of BACKLOG table you will find YEAR_WEEk 2012-WK02 falls in next year but still it is storing in my table because i have taken IW only. Please help me to get the soln
Thanks in advance
RegardsAre you looking for this?
where to_char(MS, 'YYYYIW')<to_char(sysdate, 'YYYYIW'); -
I am feeling so ripped off right now. I have wanted a Mac for years and believed the hype about it's stability and I have had more trouble with this Imac 2011 than I have ever had with a pc. It locks up with several software products from APP store. I have already had to have a technician to look at it and really couldn't figure out what the deal was. I was told that the APP store software should give me no problems but the truth is that it locks up on the software. This machine is only 4 weeks old and I am using 37 g on a 1 T hard drive. There is no reason for it to be locking up. Also, when I try to use the help program, it always tells me that I am not connected to the internet even though I have used both the mail program and the browser with no problem just before that. I successfully used the help program on my pc lots of times. I did not need a $2000. plus machine to just get email. I just wanted to unload on somebody that might understand my pain and after checking out this site...I think there is a few of you out there.
I was told that the APP store software should give me no problems but the truth is that it locks up on the software.
The apps downloaded from the Mac App Store are written by third party developers, not Apple. If you have problems with those apps you need to visit the support area for their websites. Launch the App Store, locate the app name. You should see a support link.
when I try to use the help program, it always tells me that I am not connected to the internet even though I have used both the mail program and the browser with no problem just before that
Go to ~/Library/Preferences. Move the com.apple.helpviewer.plist file from the Preferences folder to the Trash. Restart your Mac, try the Help menu.
If you need help finding that file, hold down the Finder icon in the Dock then click: New Finder Window. From the menu bar top of your screen click: Go > Go to Folder. Type this in exactly as you see it here: ~/Library/Preferences/com.apple.helpviewer.plist That will take you right to that file.
(.plist) files stores information about a particular app or in this case, the Help viewer. Often times deleting the .plist file resolves the issue.
It's fine to "unload"... we understand that you expect your iMac to be stable but there are times when things go awry. That's why we have these forums so that you can you get help.
You may want to read up on how to repair the disk if necessary or reintsall Lion > OS X Lion: About Lion Recovery
Apple - Find Out How - Mac Basics
How to "switch" from PC to Mac > Apple - Support - Switch 101
I'm sorry you feel, "ripped off", but you are using the world's most advanced operating system and it may take some time to adjust to a new OS. http://developer.apple.com/technologies/mac/ -
The specified year 2011 is not the current calendar year 2012 in MM?
Hi,
when I am doing the MIGO transaction i am getting the error like this, The specified year 2011 is not the current calendar year 2012
I gone throught the t coded like: MMPV, MMRV, OMSY, OB52
As per my company, fiscal yerar is v3 (Apr - Mar)
So now i am in posting period 10(Jan)
And my OB52 settings are 1-2011-12-2011-13-2011-16-2011
In OMSY 2012-10-2012-9-2011-12
Here system displays as my fiscal year is 2012 and last FY is 2011.
I can't find out the mistake where it was. As a FI guy I know there is no mistake in FI side.
IN MMRV
Current period 10 - 2012
Previous period 09 - 2012
Last period in last Fy 12 - 2011
When i am trying to chage the last FY in OMSY, it is grayed out. I reveiwed some of the threads and based on that i was removed my Plants in OX18 also.
Pls guide me how to slove this..
Regards,
GamidiiHi,
OMSY cannot be modified because plants are configured with the Company code.
First you need to unmap the plant with company code. Go to OX18 and delete the plants which have been mapped with your company code.
Then change the OMSY period. Once you have changed the period, map the plants with company code in the OX18.
And go to OMWD and assign Valuation grouping code for all the plants as "0001".
Please try it out in Quality server. Thanks.
Regards,
Vijay N -
Hello, I am interested in buying this week of a mac mini 2011 withintel graphics HD3000 but I'm not sure it looks good with my Samsung SyncMaster 933HD monitor. How would it look better.... with the hdmi-dvi connection built in, buying a HDMI 1.3 cable and HDMI-making or buying an adapter hdmi display port - vga and connected through the port thunderbolt
ThanksI originally set up my mini with the included HDMI -> DVI adaptor to connect to a Sycmaster monitor. The graphics were very good.
-
QUESTION from an American in India:
How do I find the screen with my personal iPod (my name's iPod) so I can download from my purchased or free songs/pods from my computer? My iPod has opened to that for 3 years and this week I can't find it: not on purchased page or on Apple store page.See:
Recovering your iTunes library from your iPod or iOS device: Apple Support Communities -
Determining current week of a year
Hi,
is anybody have idea, how to determine the current week of a year.
Please give some ideas.
Thankssomething like
Calendar cal = new GregorianCalendar();
int weeks = cal.get(Calendar.WEEK_OF_YEAR));
? -
I did a system retsore to restore to a date 2 weeks ago. I have had firefox for 2 years on this computer. Since I did the restore firefox will nolonger open. I know i can download it again - but will have lost all my bookmarks etc. is there a way to get it all back?
Ubuntu/9.04 (jaunty) is an old version of Linux from 2009. You're gonna need to upgrade to a newer operating system to use a more recent version of Firefox.
My advice is to consult with the Ubuntu support forums to find out if your PC can support the latest version of Ubuntu, or if you should switch to a different "flavor" of Linux.
http://ubuntuforums.org/ -
Hello Experts,
I have a day name column and 3 measures query count, row count... and the requirement i have is, i need to get the data about the current week it means when i run the report now i should get only Monday of this week and its row count, query count.. and when i run it tomorrow i should get Monday, Tuesday and when i run it on wednesday Monday, tuesday, Wednesday and so on. Please let me know if i am not clear with my presentation. I am wondering how i can achieve this.
Thanks,
RCThanks for your response. I tried your code in the date column filter but its not working, i am getting error not sure if i can just take it and use the same code in the filter criteria. To be more clear i have Day name(Monday, Tuesday..), Day number(for sunday its 1,Monday 2,tuesday 3..) and Date (in the format 11/6/2011...) and the rest are measures,. Basically this is a system generated report like stats report. My requirement is i need to get the current week data as i mentioned earlier if i run the report today it should give me the information only from sunday to today. Please let me know how i can achieve this.
Thanks,
RC
Edited by: user1146711 on Nov 8, 2011 8:55 AM -
Hi Firends,
I have to write a logic to display in the page whats the current week for this year. I mean if i am talking about 2nd of june 2011, how can i calculate and display what week 2nd june falls in
RegardsHi,
User_Apex wrote:
Hi Sybrand Bakker
I tried this and its showing week 23 but your query is showing as week 22. Please run this and let me know the difference. Thanks in advance
SELECT ceil(( 7+(trunc(sysdate,'d')-trunc(sysdate,'Y')) )/7) FROM DUAL;(a) That gets the week number based on the calendar year, which begins on January 1.
ISO Years begin on the Monday closest to January 1 (e.g., Monday, January 3, 2011).
(b) TRUNC (dt, 'D') is dependent on your NLS settings.
TO_CHAR (dt, 'IY') (or TRUNC (dt, 'IY') does not depend on your NLS settings.
(c) Using CEIL (( 7 + ...))) means you'll add a week to the results when dt is not the same day of the week aTRUNC (dt, 'Y'). If you want to use the approach above, you'd be better off using 1 + FLOOR (...)
Any of the above could cause differences between Sybrad's approach and yours. In this case, it seems to be (c).
If you want a result based on the calendar year and your NLS settings, then TO_CHAR (dt, 'WW') could be it.
No kidding, we could help you a lot more if you posted some sample data (CREATE TABLE and INSERT statements), results, and an explanation of how you get those results from that data (e.g., what a "week" means in this context). -
Create an Activity Report for Current Week
I would like to create a activity report for the current week. The trick is that if the weekday is Wednesday or earlier (Sunday being the first day of the week), the report shows last week's activities; but if the weekday is Thursday or later (Saturday being the last day of the week), the report shows the current weeks activities.
I have a filter that works in Access but does not seem to work in Siebel. It does just what I explained above:
Between CDate(Int((IIf(Weekday(Now())<=4,Now()-(6+Weekday(Now())),Now()-(Weekday(Now())-1))))) And CDate(Int((IIf(Weekday(Now())<=4,Now()-Weekday(Now()),Now()+(7-Weekday(Now()))))))
Thank you,
David
Edited by: DavidE on Oct 7, 2008 4:17 PMDavid,
try this:
case DAYOFWEEK(CAST(Activity."Planned Start Time" AS date))when 1 then timestampadd(sql_tsi_day,1,CAST(Activity."Planned Start Time" AS date)) when 3 then timestampadd(sql_tsi_day,-1,CAST(Activity."Planned Start Time" AS date)) when 4 then timestampadd(sql_tsi_day,-2,CAST(Activity."Planned Start Time" AS date)) when 5 then timestampadd(sql_tsi_day,-3,CAST(Activity."Planned Start Time" AS date)) when 6 then timestampadd(sql_tsi_day,-4,CAST(Activity."Planned Start Time" AS date)) when 7 then timestampadd(sql_tsi_day,-5,CAST(Activity."Planned Start Time" AS date)) else CAST(Activity."Planned Start Time" AS date) end
This gave me the sunday of the week. You should be able to modify this format for your purposes.
cheers
Alex -
Week Number of the current week...URGENT
hi gurus,
I want to calculate the week number of the current week as per Fiscal year.
What variable or the Customer Exit code needs to be written for it?
regardsHi Venu,
Use the code below. I assume that the client is US based where the Fiscal Year starts 1st October every year. Just in case the fiscal year starts in some other month then adjust the code (if SY-DATUM+4(2) >= 10.) below. Hope this helps.
DATA: PFY(8) TYPE C.
DATA: CFY(4) TYPE C.
DATA: LFY TYPE I.
DATA: FYD TYPE I.
DATA: TWD TYPE I.
DATA: RES TYPE I.
if SY-DATUM+4(2) >= 10.
concatenate SY-DATUM+0(6)
'01'
into PFY.
else.
LFY = SY-DATUM+0(4).
LFY = LFY - 1.
CFY = LFY.
concatenate CFY
SY-DATUM+4(2)
'01'
into PFY.
endif.
FYD = P_FY.
TWD = SY-DATUM.
RES = ( TWD - FYD ) / 7.
Write: Res. -
Only activities of the current calendar year are shown in plannend act.
Hello Techies,
We are using the 2007 UI and I have the following problem. Only activities of the current calendar year are shown in plannend activities and interaction history.
SAP probably made a query only showing a set of data (current year) for performance reasons. I would like to change this in the last 6 months. My users can not see there activities of last week since it only shows 2009.
How can this be changed?
Kind regards.
FrederikFrederik
You can control this by maintaining the view:
CRMV_ACC_1O_CUST
Or in the IMG:
CRM->Master Data->Business partner->Specify Display Options for Business Transactions
Take care,
Stephen
Maybe you are looking for
-
Question re. RequestDispatcher - can I include a target fragment?
Hi I have a web page with 2 forms: Log in Register If the user submits invalid data, the controller servlet uses 'RequestDispatcher.forward()' to re-display the page. Is there some way to also specify a specific portion of the page? For example: some
-
Hi I have to sum the rows in a table eliminating duplicates(i.e for example I have TransactionID,Amount, as rows and the table name as TransactionTable). Now I have the TransactionID as 1000 and for this ID I have Amount as Rs.5500 in 6 rows and Rs.1
-
Keyboard problem (letters aren't written )
Hello i had just bought a hp pavillon notebook dv6 for about 3 weeks i have a problem with the keyboard some letters aren't written at all anymore like the "p" and "m" and the "A" is written instead of the key to move to the left. some friends s
-
Migrating Arch's initscripts to dash
I recently "discovered" dash and how fast it is as compared to bash. FYI, dash is "a POSIX-compliant shell that is much smaller than bash". That being said, here are some simple benchmarks which compare the speed of bash and dash using a for loop (bt
-
In Production system Infocube mange screen selection changed
Dear Experts, I have problem with my production system. Problem:In Prod system for all the Infocube settings has changed may yesterday because of that we are not able to see in the manage screen Tranferred and Added records colums. Could you please s