Any FM to get count of each week day for the given date range
Hi guys,
Any FM to get count of each week day for the given date range?
eg: If i give 14/07/2008 to 14/08/2008
I need to find how many Mondays, tuesdays...sundays in this given date range.
If not single FM is available, any logic that gives above result is also appreciated.
Thanks,
Vinod.
hi Vinod,
this is not a full solution, I just give you a basic idea:
DATA : lv_start TYPE sy-datum VALUE '20080714',
lv_end TYPE sy-datum VALUE '20080814'.
WHILE lv_start LE lv_end.
CALL FUNCTION 'FTR_DAY_GET_TEXT'
EXPORTING
pi_date = lv_start.
* IMPORTING
* PE_DAY_TEXT1 =
* PE_DAY_TEXT2 =
* PE_DAY =
* you have to summarize the output here somehow...
lv_start = lv_start + 1.
ENDWHILE.
hope this helps
ec
Similar Messages
-
Get Months for the given date ranges on the Selection Screen
Hello All,
If I give Begin Date (Begda) and End Date (Endda) on the Selection Screen, I need to get all the months given in the selection screen ranges.
Could any one please suggest me how to proceed further on this.
Thanks in Advance
Regards
YathishHI,
Check this FM
HR_99S_INTERVAL_BETWEEN_DATES ---> this can help you it will return the month in this table MONTH_TAB
HR_99S_MONTHS_BETWEEN_DATES -
Getting the week number for a given date
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
CORE 11.1.0.7.0 Production
TNS for 64-bit Windows: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
Hello all.
I am currently migrating our product from SQL SERVER to ORACLE and have the following issue.
Basically I'm just trying to get the year week number for a given date but I'm having trouble with Oracle as it seems to think that the weeks run from Thursday to Thursday?. I presume this is something to do with the fact that the first day of the year was Thursday?
e.g.
SQL SERVER:
select DATEPART(wk, '2009-10-24') as Sat -- 43 - correct
select DATEPART(wk, '2009-10-25') as Sun -- 44 - correct
select DATEPART(wk, '2009-10-26') as Mon -- 44 - correct
select DATEPART(wk, '2009-10-27') as Tue -- 44 - correct
select DATEPART(wk, '2009-10-28') as Wed -- 44 - correct
select DATEPART(wk, '2009-10-29') as Thu -- 44 - correct
select DATEPART(wk, '2009-10-30') as Fri -- 44 - correct
select DATEPART(wk, '2009-10-31') as Sat -- 44 - correct
select DATEPART(wk, '2009-11-1') as Sun -- 45 - correct
select DATEPART(wk, '2009-11-2') as Mon -- 45 - correct
select DATEPART(wk, '2009-11-3') as Tue -- 45 - correct
select DATEPART(wk, '2009-11-4') as Wed -- 45 - correct
select DATEPART(wk, '2009-11-5') as Thu -- 45 - correct
ORACLE:
SELECT to_char(to_date('24-OCT-2009'), 'ww') as Sat from dual; -- 43 correct
SELECT to_char(to_date('25-OCT-2009'), 'ww') as Sun from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('26-OCT-2009'), 'ww') as Mon from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('27-OCT-2009'), 'ww') as Tue from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('28-OCT-2009'), 'ww') as Wed from dual; -- 43 incorrect - should be 44
SELECT to_char(to_date('29-OCT-2009'), 'ww') as Thu from dual; -- 44 correct
SELECT to_char(to_date('30-OCT-2009'), 'ww') as Fri from dual; -- 44 correct
SELECT to_char(to_date('31-OCT-2009'), 'ww') as Sat from dual; -- 44 correct
SELECT to_char(to_date('1-NOV-2009'), 'ww') as Sun from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('2-NOV-2009'), 'ww') as Mon from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('3-NOV-2009'), 'ww') as Tue from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('4-NOV-2009'), 'ww') as Wed from dual; -- 44 incorrect - should be 45
SELECT to_char(to_date('5-NOV-2009'), 'ww') as Thu from dual; -- 45 correct
Now I don't want to get into a discussion with regard to locales etc.
In my world (and is seems SQL SERVER's) the first day of the week is Sunday and the last Saturday.
Is there some NLS_? setting or something that I'm missing?
thanks for any help on this.
AndyThis is what you need.
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) FROM dual
HTH!!!
--tested all these statements.
Works as you wish!!
SELECT ceil(( 7+(trunc(to_date('24-OCT-2009'),'d')-trunc(to_date('24-OCT-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('25-OCT-2009'),'d')-trunc(to_date('25-OCT-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('26-OCT-2009'),'d')-trunc(to_date('26-OCT-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('27-OCT-2009'),'d')-trunc(to_date('27-OCT-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('28-OCT-2009'),'d')-trunc(to_date('28-OCT-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('29-OCT-2009'),'d')-trunc(to_date('29-OCT-2009'),'Y')) )/7) as Thu from dual;
SELECT ceil(( 7+(trunc(to_date('30-OCT-2009'),'d')-trunc(to_date('30-OCT-2009'),'Y')) )/7) as Fri from dual;
SELECT ceil(( 7+(trunc(to_date('01-NOV-2009'),'d')-trunc(to_date('01-NOV-2009'),'Y')) )/7) as Sat from dual;
SELECT ceil(( 7+(trunc(to_date('02-NOV-2009'),'d')-trunc(to_date('02-NOV-2009'),'Y')) )/7) as Sun from dual;
SELECT ceil(( 7+(trunc(to_date('03-NOV-2009'),'d')-trunc(to_date('03-NOV-2009'),'Y')) )/7) as Mon from dual;
SELECT ceil(( 7+(trunc(to_date('04-NOV-2009'),'d')-trunc(to_date('04-NOV-2009'),'Y')) )/7) as Tue from dual;
SELECT ceil(( 7+(trunc(to_date('05-NOV-2009'),'d')-trunc(to_date('05-NOV-2009'),'Y')) )/7) as Wed from dual;
SELECT ceil(( 7+(trunc(to_date('06-NOV-2009'),'d')-trunc(to_date('06-NOV-2009'),'Y')) )/7) as Thu from dual;
Cheers!!!
Bhushan
Edited by: Buga on Oct 29, 2009 10:46 AM -
How to get the week number for a given date?
hi guys,
what is coding to get the week number for a given date?
For example, 1/1/05 is week 1. then 8/1/05 is week 2.The second parameter to pass to the method is supposed to be one of the month constants JANUARY - DECEMBER. It happens to be that their numerical values are 0-11, not 1-12, so your "12" refers to the "13th" month of the year.
givenDate = new GregorianCalendar(2003, Calendar.DECEMBER, 31);
If you want to construct dates and times from strings like you seem to be, look into SimpleDateFormat http://javaalmanac.com/egs/java.text/ParseTime.html
(even still I got WEEK_OF_YEAR as 1 which is true but not really what I expected, excuse my previous reply but I wanted to check the facts before posting this) -
FM that gives number of day in the week for the given date
Hi,
I have a requirement to find the number of the day in a week for the given date. For example, 07/09/2009 is Thursday & 4th day of the week. Is there any FM to accomplish this task?
Appreciate your help in Advance.
Thanks,
Kannan.Hi Kannan,
ISH_GET_DAY_OF_WEEK.
Regards,
Dilek -
How to get the weekends days for a specific date range
I want to select list of only weekend dates from a given date range. Is it possible in SQL?
For example if the range is '08/01/2011' and '08/30/2011'
I want a list
08/06/2011
08/07/2011
08/13/2011
08/14/2011
08/20/2011
08/21/2011
08/27/2011
08/28/2011Thank You, Naveen email:[email protected]First and easy to do is having a Calendar table, which over there you can have those information.
http://arbibaghdanian.blogspot.com/2011/05/calendar-table.html
Declare @beginDate Date, @EndDate Date
Select @beginDate = '08/01/2011', @EndDate = '08/31/2011'
Declare @Calendar Table
(CalendarDate Date Primary key, IsWeekend Bit, YearNo SmallInt, QuarterNo TinyInt, MonthNo TinyInt, DayOfYearNo SmallInt, DayNo TinyInt, WeekNo TinyInt, WeekDayNo TinyInt)
While @beginDate <= @endDate
Begin
Insert Into @Calendar
Select
@beginDate As CalendarDate
,(Case When DATEPART(Weekday, @beginDate) In (7, 1) Then 1 Else 0 End) As IsWeekend
,DATEPART(Year, @beginDate) As YearNo
,DATEPART(QUARTER, @beginDate) As QuarterNo
,DATEPART(MONTH, @beginDate) As MonthNo
,DATEPART(DayOfYear, @beginDate) As DayOfYearNo
,DATEPART(Day, @beginDate) As DayNo
,DATEPART(Week, @beginDate) As WeekNo
,DATEPART(WEEKDAY, @beginDate) As WeekDayNo
Set @beginDate = DateAdd(Day, 1, @beginDate)
End
Select * From @Calendar Where IsWeekend = 1
Best Wishes, Arbi --- MCC 2011; Please vote if you find this posting was helpful or Mark it as answered. -
Get Nexr working day for the given calendar id
Hello,
My requirenment is I have a date.If that date falls on friday then I have to get the next working day date i.e.Monday for the given Calender iDDATA:wk_dat TYPE scal-indicator.
PARAMETERS:pa_dat TYPE sy-datum.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
date = pa_dat
IMPORTING
day = wk_dat.
CHECK wk_dat = 5.
pa_dat = pa_dat + 3.
WRITE pa_dat.
here if u want to get the next working day
Use FM DATE_CHECK_WORKINGDAY after the check statement.
add the date until u find a working day. -
So I checked the order status again today and it still shows that it's being processed but the shipping date is still 11/3. A week later and it still hasn't been shipped. Is there someone who can help me so I have an idea when it will be shipped, if ever? I ordered a gold iPhone 6 64gb. I thought I was going to get it in 2 weeks but instead it's been over a month. Thanks.
Thanks for the additional information michiskippi! I have sent you a direct message so that I can access your account and follow up on this order personally. Please respond to my message at your convenience.
AntonioC_VZW Follow us on Twitter at www.twitter.com/VZWSupport -
ABAP Get Week Number for a Given Date.
Hi All,
I want to calculate week number for given date.
SAP has provided function modules like DATE_GET_WEEK.. Etc are giving week number. taking default start day as Monday. But for my requirement is calculate week number based on start day as Sunday.
Please let me know if we have any custom logic ??
Thanks & Regards
Vasu YadavHi Vasu,
SAP standard functionality takes MONDAY as first day.
But if you want then you can change it to SUNDAY by implementing BADI CALENDAR_DEFINITION. Create a new implementation for method IF_CALENDAR_DEFINITION~GET_FIRST_DAY_OF_WEEK and assign value as SUNDAY.
Hope it solves your problem.
Thanks
Saurabh Kabra -
How to get XLR to show BPs with no transaction data for a given date range
Hi -
I am building an XLR report that does a comparison of net sales data across two periods for a given sales employee's BPs.
The report has the row expansion:
FACT BPA(*) SLP(SlpName = "ASalesPersonNameHere") ARDT(Code = "ARCreditMemo", "Invoice") Group by BPA.CardName
and column expansions:
FIG(SO_TaxDate = @StartDate:@EndDate)
and
FIG(SO_TaxDate = @StartDate2:@EndDate2)
where @StartDate, @EndDate, @StartDate2, @EndDate2 are parameters that define the two ranges of dates.
The column formulas are, from left to right:
=ixDimGet("BPA", "CardName")
=ixGet("SO_DocTotal") <-- filtered by column expansion for first date range
=ixGet("SO_DocTotal") <-- filtered by column expansion for second date range
The report works fine except for one problem, I would like it to include BPs for which no transaction occurred in either date range as well.
Any help is greatly appreciated!
Thanks,
Lang RileyReally appreciate your feedback! Those are good suggestions. I should have mentioned that I had already tried both those suggestions.
Removing FACT on BPA in this case ends up returning all the BPs and not respecting the SLP(SlpName = "aName") part of the query.
Using **, i.e., * or #NULL, makes no change in the resulting data in this case. I had thought that ** would be the solution, but it didn't change the outcome. I still have BPs for which when their sales employee is used as the filter and they have no transactions for either date range, and yet they still do not appear.
I should further mention that the IXL query, as it now stands, does return BPs for which one of the periods has no data, just not both, and I have verified that applicable BPs with no transaction data for both periods do exist in my data set. It seems that perhaps the IXL query needs to be restructured? Please keep the suggestions coming including how this query might be restructured if necessary. -
How to get the date of first day of a week for a given date
Hi gurus
can any one say me how to get the date of first day(date of Sunday) of a week for a given date in a BW transformations. For example for 02/23/2012 in source i need to get 02/19/2012(Sunday`s date) date in the result. I can get that start date of a week using BWSO_DATE_GET_FIRST_WEEKDAY function module. But this function module retrieves me the start date as weeks monday(02/20/2012) date. But i need sundays(02/19/2012) date as the start date. So it would be really great if anyone sends me the solution.
Thanks
RavHi,
The simplest way would be to subtract 1 from the date date which you are already getting in transformation routine, but instead of doing that subtraction manually which might need bit of errort, you can simply use another FM to subtract 1 from given date.
RP_CALC_DATE_IN_INTERVAL
Regards,
Durgesh. -
How to get LASTDAY for each and every month between given dates..
Hi Friend,
I have a doubt,How to get LASTDAY for each and every month between given dates..
for ex:
My Input will be look like this
from date = 12-01-2011
To date = 14-04-2011
And i need an output like
31-01-2011
28-02-2011
31-03-2011
is there any way to achieve through sql query in oracle
Advance thanks for all helping friendsHere's a 8i solution :
select add_months(
trunc(
to_date('12-01-2011','DD-MM-YYYY')
,'MM'
, rownum ) - 1 as results
from all_objects
where rownum <= ( months_between( trunc(to_date('14-04-2011','DD-MM-YYYY'), 'MM'),
trunc(to_date('12-01-2011','DD-MM-YYYY'), 'MM') ) );
The above two query is worked in oracle 11GActually the first query I posted is not correct.
It should work better with
months_between(
trunc(to_date(:dt_end,'DD-MM-YYYY'),'MM'),
trunc(to_date(:dt_start,'DD-MM-YYYY'),'MM')
)Edited by: odie_63 on 12 janv. 2011 13:53
Edited by: odie_63 on 12 janv. 2011 14:11 -
Any hope of getting 64 bit twain plug in for Windows 64 bit Photoshop
Just what the title sez: any hope of getting 64 bit twain plug in for Windows 64 bit Photoshop? Frustrating to upgrade and have to do a work around to use your scanner. Will Adobe release this?
Chris,
I have a CanoScan 8800F plus CS5, both 32-bit and 64-bit versions installed. When I scan four slides in a holder, the 32-bit TWAIN driver/plugin gives me four images of one slide each. The 64-bit WIA driver/plugin gives me one image of the slide holder, with the four slides in it. Is this a limitation of the WIA technique in general or the particular WIA driver for my CanoScan?
Best regards,
Antero -
How to get the date of Friday for the given week
HI,
I have a requirement to get the date of Friday for the given week.
Eg: I have an input of 200722 (Yearweek), From this I need to get the Date of the friday for this week 22 of Year 2007.
Plz let me know how to get this..
Thanks in advance..
Sridhar.Hi,
Thanks for your reply...
I have implemented your logic but not getting exact output as required.
Suppose, If i give the input as 200720, I am getting an output as 18 (friday of week 20 of year 2007), but i need to get an output of 18.05.2007
Plz let me know how to do thdi.
Thanks in advance.. -
Today I deleted an email services I no longer need. Now when I go to the notes app I no longer have any notes. Is there any way to get my notes back. I have the first iPad running iOS 5.1.1
Ah, well, then the notes are probably gone. Did you save any of the email from that account on your computer? The notes might be there if you did.
Maybe you are looking for
-
First day of week in WebAccess and CalendarPublisher
Hi, after upgrading from GW8.02 to GW2012SP1 the first day of week in WebAcc and CalPub is Sunday again. Under GW8.02 I had configured the first day as Monday (in a configuration file) Unfortunately I don't remember which file it was? Any ideas? Kind
-
New ipod, started up with Mac but want to download from music from windows?
Ok, so I got my new 5th gen ipod and started it up with my Mac. However all my music is on my old laptop..windows. Is it possible without restoring the ipod to download my music from windows? By the way I am hopeless and my Mac is 2nd hand so I am no
-
I have 10.8.5 osX and QT 10.2 - I have exported .mov from iPhoto into a folder, and when I open in QT I get this.. QuickTime Player can't open "IMG_0917-2.MOV" because the movie's file format isn't recognized. I clicked on the "tell me more" button t
-
Report on Process Chain Completion Timings
The SAP-delivered BW stat cubes do not seem to be designed to report on process chain completion timings. My requirement is to automatically generate a report on the start time, end time and over-all duration of our scheduled chains and if possible,
-
Hi there, I'm having a problem with Acrobat 9 Pro and Win 7 Dynamic Stamps. I'm an IT technician and I'm trying to help a client wich uses Adobe 9 Pro and Stamps...Dynamic ones. Because we live and work in Portugal, I had to use the next string, in o