Function Modules to get First day of week, month, Year
Can anyone name the Function Modules for getting First day of week, month ,year.
to get first day of week use this function; WEEK_GET_FIRST_DAY
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
WEEK = '201107'
IMPORTING
DATE = l_date
EXCEPTIONS
WEEK_INVALID = 1
OTHERS = 2.
with DATE_COMPUTE_DAY function you can get date number in week.
CALL FUNCTION 'DATE_COMPUTE_DAY'
EXPORTING
DATE = workdate
IMPORTING
DAY = day_of_week_num
EXCEPTIONS
OTHERS = 8.
CASE day_of_week_num.
WHEN 1.
hold_day_of_week = 'Monday'.
WHEN 2.
hold_day_of_week = 'Tuesday'.
WHEN 3.
hold_day_of_week = 'Wednesday'.
WHEN 4.
hold_day_of_week = 'Thursday'.
WHEN 5.
hold_day_of_week = 'Friday'.
WHEN 6.
hold_day_of_week = 'Saturday'.
WHEN 7.
hold_day_of_week = 'Sunday'.
WHEN OTHERS.
hold_day_of_week = 'invalid'.
ENDCASE.
Similar Messages
-
Function Module to get first day of the fiscal year on passing a date
Hi Experts!!
Can you please suggest a Function Module to get first day of the fiscal year on passing a date..?
Example: if a fiscal year starts from 30 November 2009 and ends at 28 november 2010.
it should return 30 th nov 2009 (first day of the fiscal year)Moderator message - Welcome to SCN.
I think you'll find that this question has been answered before. Please search the forum before posting.
Also, Please read Please read "The Forum Rules of Engagement" before posting! HOT NEWS!! and How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
Rob -
Any Function Module to get date by passing week and year
Hi,
Is there any Function Module available to get date by passing week and year. For example, Week 24, Year 2005 and you get the date.
Regards,
MiraWEEK_GET_FIRST_DAY
pass 'YYYYWW' (200524) to WEEK parameter it will give you the week start date
Raja -
Function module for getting starting day of a week form current data
Hi ,
Is there any function module that gives starting day of week when we give a particular date
eg: today date is 19-12-2007
if i give this date as input i should get 16-12-2007 because this is starting day of this week .Hi,
Use FM GET_WEEK_INFO_BASED_ON_DATE
You will get the first day of the week in export parameter MONDAY
Lokesh -
How to get first day of the month by the given date?
Now, is there function in CRM system that can get the first day of the month ?
for example:
input date is 2007/12/12, then return 2007/12/01 (the first day of month).
Thank you~Hi ping,
data: w_date type sy-datum ,
w_temp(2) type c.
w_date = '20071212'.
w_temp = w_date+6(2).
w_temp = w_temp - 1.
w_date = w_date - w_temp.
write / w_date.
Plz Reward if useful,
Mahi. -
How to - get first DAY of the month from the date ?
Hi
pls helphi,
data : DAYNR LIKE HRVSCHED-DAYNR,
DAYTXT LIKE HRVSCHED-DAYTXT.
data langu like sy-langu value 'EN'.
Parameters PDATE LIKE SY-DATUM.
PDATE+6(02) = '01'.
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
EXPORTING
LANGU = LANGU
DATE = PDATE
CALID =
IMPORTING
DAYNR = DAYNR
DAYTXT = DAYTXT
DAYFREE =
EXCEPTIONS
NO_LANGU = 1
NO_DATE = 2
NO_DAYTXT_FOR_LANGU = 3
INVALID_DATE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE :/ PDATE, DAYNR, DAYTXT.
(OR)
Try..
DATA:DAYNR LIKE HRVSCHED-DAYNR,
DAYTXT LIKE HRVSCHED-DAYTXT,
DAYFREE LIKE HRVSCHED-NODAY.
DATA:LANGU LIKE SY-LANGU ,
DATE LIKE SY-DATUM,
CALID LIKE P1027-CALID VALUE 'US'.
date = sy-datum.
date+6(2) = 01. "----->to get the first day .
*first day of the month
write:/ 'First date of the month', date.
*Day name
CALL FUNCTION 'RH_GET_DATE_DAYNAME'
EXPORTING
langu = SY-LANGU
date = DATE
CALID = CALID
IMPORTING
DAYNR = DAYNR
DAYTXT = DAYTXT
DAYFREE = DAYFREE
EXCEPTIONS
NO_LANGU = 1
NO_DATE = 2
NO_DAYTXT_FOR_LANGU = 3
INVALID_DATE = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ DAYTXT.
Don't forget to reward if useful.... -
Function module to get the next new 12 months of a year
Hi All,
I have a requirement to get the next new 12 months of a year from the current month , i.e. if my current month is June 2009 , I need to get June 2009, July 2009,...................., May 2010 .
Does anybody know if there is any function module for this or is there any logic to implement this .
Please could someone help me out with this.
Regards,
Sushanth H.S.Dear Srinivas,
Have a look at the below code. It works fine. Change according to your req.
REPORT ztest_notepad.
DATA:
month_index TYPE i,
wa_t015m TYPE t015m,
it_t015m TYPE t015m OCCURS 0 WITH HEADER LINE.
DATA:
BEGIN OF it_next12 OCCURS 0,
months_12 TYPE string,
END OF it_next12.
PARAMETERS:
p_month TYPE num2,
p_year TYPE num4.
START-OF-SELECTION.
SELECT * FROM t015m INTO TABLE it_t015m WHERE spras = sy-langu.
READ TABLE it_t015m INTO wa_t015m WITH KEY monum = p_month.
IF sy-subrc = 0.
month_index = sy-tabix.
LOOP AT it_t015m INTO wa_t015m FROM month_index TO 12.
CONCATENATE wa_t015m-monam p_year INTO it_next12-months_12 SEPARATED BY '-'.
APPEND it_next12.
CLEAR it_next12.
ENDLOOP.
p_year = p_year + 1.
LOOP AT it_t015m INTO wa_t015m FROM 1 TO month_index.
CONCATENATE wa_t015m-monam p_year INTO it_next12-months_12 SEPARATED BY '-'.
APPEND it_next12.
CLEAR it_next12.
ENDLOOP.
ENDIF.
LOOP AT it_next12.
WRITE:/ it_next12-months_12.
ENDLOOP.
Thanks
Venkat -
Function for finding first day of the month !!
Hi,
I know we have function to find the last day(DD) of the month. Do we have any functions for finding the first day of the month ??? if not is there any way i can find the first date(DD) of the month .
Bcoz i m trying to incorporate the logic for finding the first day of the month partition.
Thank you!!!Shahid Ali Tcs wrote:
There are many solution given by member in relation with your question, and all are correct .
I want to make u know something else.
Have you ever think why oracle has given function for last_day but no function for first.....
I u think this question u will get the answer of your "first day finding " question.
Because first day is alwasy 01 of every, while last day can be 30,31,29,28.....
Got my words ........
One more solution from my side,,,,
SQL> select '01' || to_char(sysdate,'-MON-YY') from dual;
'01'||TO_
01-SEP-09Which is a completely poor way of doing it.
Using TRUNC or LAST_DAY(..) + 1 will return a DATE datatype result.
Your method is converting the DATE into a VARCHAR2, which then prevents further processing/date based calculations unless it is explicitly converted back to a DATE again.
The reason Oracle hasn't provided a FIRST_DAY is because the TRUNC function already caters for it as this works with DATE's as well as NUMBER's, not because the first day is always 1. -
FM to get first date of the month
hi,
any FM to get first day of the month , lets say based on input 24.11.2008 , the FM would return 01.11.2008Do search in such case(Easy findings).
https://www.sdn.sap.com/irj/scn/advancedsearch?query=fmtogetfirstdayofthemonth&cat=sdn_all -
FM for First day of the Fiscal Year.
Hi ,
i want to calculate First day of the Fiscal Year ,please send me the FM name urgently.
Thanks in advancehi,
BAPI_CCODE_GET_LASTDAY_FYEAR
this will give you back the last day of a fiscal year for a company code, but if you start with previous year, than you add 1 to the result, than you get first day of current fiscal year.
FIRST_AND_LAST_DAY_IN_YEAR_GET
this will give you back the first and the last dates of a given year, but you'll need the period version as well.
hope this helps
ec -
Function module to get the 'first day of next month'
Hi
I have a selection screen with input fields
1. period (month eg: 07)
2.year(fiscal year eg: 2008 )
If user enters 07 as month and 2008 as year, then I have to display 08/01/2008(MM/DD/YYYY) as output.
Requirement is to calculate the 'first day of next month'
I have written code for this requirement.But I am asked to use function mdule.
Please help me in this regard.
Thanks&Regards
Rama.Mekalahi try this FM ...
HR_JP_MONTH_BEGIN_END_DATE
it gives the Begin Date and End date of the month
rewards points if found useful
regards,
Balaji -
I am trying to get "First day of the week" data from CLDR spec24 but cannot find where to look for it in the spec. I need this data to calculate numeric value of "LOCAL day of the week".
This data to implement "c" and "cc" day formats that equals numeric local day of the week.
e.g if "First day of the week" data for a locale is 2 (Monday) , it means numeric value for local day of the week will be 1 if it is Monday that day, 2 if it is Tuesday that day and likewise.Hi
If you want to week to be started with Sunday then use the following formula:
TimestampAdd(SQL_TSI_DAY, 1-DAYOFWEEK(Date'@{var_Date}'), Date'@{var_Date}') if it's retail week(starts from Monday) then the follow below:
TimestampAdd(SQL_TSI_DAY, 1-DAYOFWEEK(Date'@{var_Date}'), Date'@{var_Date}')
I'm assuming var_Date is the presentation variable for prompt...
Edited by: Kishore Guggilla on Jan 3, 2011 4:48 PM -
ABAP - Function module to get the number of working days between 2 days
Hi gentlemen,
I have been asked to produce a report that gives the number of working days between 2 days, based on a calendar.
I didn't find anything...
Has any of you already written a function module to get this ?
A great thanks in advance.
Jacques LagrifHi ,
you can try this ,
when you require the number of working days between D1 and D2
Total No of Days will be
D2 - D1
No of holidays between D1 and D2 , use the FM HOLIDAY_GET
Pass the From date , to date , and the factory calendar to get the of Holidays
Total no of days - Number of Holidays will your Working days
Regards,
Sathya -
Function Module to get pernr number based on first name and last name
Hi All,
What is the Function Module to get pernr number based on first name and last name.
Could you please help me.
T@R.
Vidyahi Vidya,
you can get perner from PA0002 based on firs name and last name.
use select query and get perner. -
Any function module for getting fiscal year week numbers
can any one provide me function module for getting fiscal year week numbers ? if no function module please let me know work around.
Thanks!
Lakshmikandhhi,
Use FM <b>'DATE_GET_WEEK'</b>...
parameter D1 LIKE SCAL-DATE.
Data w like scal-week.
CALL FUNCTION <b>'DATE_GET_WEEK'</b>
EXPORTING
date = D1
IMPORTING
WEEK = W
EXCEPTIONS
DATE_INVALID = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
write W+4(2).
Regards,
Santosh
Maybe you are looking for
-
Hi Guys, When we try to do follow up for a course event, the check box options for the participants come in disabled mode.We have maintained the follow up infotye for this course type. Regards Sandeep
-
Time Capsule and Back to my Mac
Hi there, I found my perfect configuration. A MacBook Air for my daily mobile use and a Time Capsule at home. The only thing that I do not know how to setup and really want to have is: How can I use my new (test-)MobileMe account with "back to my mac
-
Change printer settings using print management
I have deployed some printers using 'Print Management' in Windows 2012. My users see the printer. By default, 'paper size' is set to 'letter'. I want to change it to 'A4'. I went to 'print management' tool on the print server. There I changed the fo
-
I take photos in RAW and edit frequently. It seems every time I make more than a few adjustments or process heavy adjustments, the program crashes. I have tried uprgrading memory from 4 to 8gbs, but this hasn't helped. My Macbook runs OS X 10.7.5. My
-
"java.sql.SQLException: Result set already closed" on weblogic 9.1
Hello together, i'm using hibernate 3.2.5ga on weblogic 9.1 through a data source with JTA defined to access oracle 10 with the Oracle's Thin XA Driver. Sporadically i get this: Caused by: java.sql.SQLException: Result set already closed at webl