Same date of previous month / Leap year
In my requirment , I am passing a date, I want a function module which will return me the same date of last month. I have found a function HR_PSD_DATES_ADD_MONTHS , but it is not giving output if I pass date as 31st March 2000 , as previous month is February and its a leap yr.
If you know function module which could help me , pls help me.
Hello,
Try this way :
REPORT ZTEST_NP .
parameters: p_dt type d.
data:
lst_dt type d,
l_dt type d,
days type i,
prv_dt type d.
l_dt0(4) = p_dt0(4).
l_dt4(2) = p_dt4(2) - 1.
if l_dt+4(2) le '00'.
l_dt+4(2) = '12'.
endif.
l_dt6(2) = p_dt6(2).
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = l_dt
IMPORTING
LAST_DAY_OF_MONTH = lst_dt
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
if lst_dt ge l_dt.
prv_dt = l_dt.
else.
prv_dt = lst_dt.
endif.
write: prv_dt.
regards,
Naimesh
Similar Messages
-
OBIEE 11g - Current year date and the same date in Previous year
Hi Experts,
I have an attribute say RECEIPT NO, i want to display the "No of Receipts" i.e(count(receipt no)) for any given date in the current year as well as for the same date in previous year.
Please suggest me how to achieve this in 11g.
ThanksHi Veeravalli,
Thanks for your prompt help.
Could you please ellobarate this. I have to display the count(receipt_no) for the last year same date.
Thanks -
Variable last date of previous month/last date of current month
Hello Experts,
I am facing an issue while designing a query.
Requirement is like this.
Report will be run on monthly basis.so on execution of report, it should prompt for month/year.
now on report there are two columns for which I have to get data on date basis(last date of previous month and Last date of current month).
Can anyone tell me is there any standard variable for this? what is it?
or how to achieve this?
Regards,
NiravHi,
See if this post in this forum can help you.
Re: Last date of a month
Regards
Shalabh Jain -
Calculating previous month and year of the previous month
Hi frenz,
Can anybody know FM to calculate the previous month and year of the previous month.
are there any standard FMs existed to achieve this?
br,
anil.hi,
lv_period gives the month and year which is two months earlier now as we have specified lv_months as -2.
DATA: LV_PERIOD LIKE S001-SPMON,
LV_MONTHS(2) TYPE C VALUE '2-',
LV_DATUM LIKE SY-DATUM,
LV_NEWDT LIKE SY-DATUM,
P_SPMON LIKE S001-SPMON VALUE '200601'.
CONCATENATE P_SPMON '01' INTO LV_DATUM.
LV_PERIOD = P_SPMON+0(6).
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
MONTHS = LV_MONTHS
OLDDATE = LV_DATUM
IMPORTING
NEWDATE = LV_NEWDT
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC = 0.
LV_PERIOD = LV_NEWDT+0(6).
ENDIF.
WRITE :/ LV_PERIOD.
Regards,
Sailaja. -
I added Icloud to join my calendar on my phone to another person. It erased all history date from previous months. how do I get that data back?
i found the answer to the first part: reboot and keep hold of command+r
this gave me a list of options
one of them was to reinstall lion from fresh
i went for this
dont know why... but all forum posts i read said u should delete hard disc? theres an option for this
which is the right option?
any suggesstion where i go to register new mac would be great
thanks -
Previous month first data and previous month last date
can any body have query to get previous month first date and previous month last date.
Ex: First day of the previous week:
TIMESTAMPADD(SQL_TSI_DAY,-6, (TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)))
Last day of the previous week:
TIMESTAMPADD(SQL_TSI_DAY, DAYOFWEEK(CURRENT_DATE) *-1,CURRENT_DATE)
can anybody have it for first day of the previous month,last day of the previous month?
Edited by: user12255470 on Apr 7, 2010 3:30 AMHi,
1st day of previous month :
TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1) + 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE))
last day of previous month :
TIMESTAMPADD(SQL_TSI_DAY,DAYOFMONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)) * -1 , TIMESTAMPADD(SQL_TSI_MONTH, 1, TIMESTAMPADD(SQL_TSI_MONTH,-1,CURRENT_DATE)))
Please mark Q answered and award points for correct answers !
Thanks
Alastair -
Query returns data from previous month. Need to have it return data for the entire year
This is the part of the query that returns data by month:
(YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)AND MONTH(`rereport`.`market_reports_5`.start_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH))
How can I get it to return data for the year.
TIYHow about omitting the MONTH part:
(YEAR(`rereport`.`market_reports_5`.start_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH)
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
Reporting on Previous Month/Current Year - Jan 09 fix
I currently have about 10 reports that are being filtered to only show data on the repository variables for :
PreviousMonth and Current Year.
When Jan 1, 2009 comes around, these reports will be kicked off to show Decemeber of the Current Year, so December of 2009.
What is the best/easiest way to fix this problem for the future?What Shiva meant was to let YEAR be a Presentation Variable that the user can select from, say a drop down list of "years."
But consider this. Whenever the month of the "system date" is January, you want the year to be one less than the "current year." For all other months, you want the year of the "system date."
PrevYear = CASE WHEN MONTH(Calendar."System Date")=1 THEN YEAR(TIMESTAMPADD(SQL_TSI_YEAR, -1,Calendar."System Date")) ELSE YEAR(Calendar."System Date") END
And since you weren't sure about how to do the previous month...
PrevMonth = MONTH(TIMESTAMPADD(SQL_TSI_MONTH,-1,Calendar."System Date")) -
FM to find same date of next month
Hi All,
Please tell me the FM to find out the same date of the next month?
Thanks - ChandanHi,
Use the FM HR_PT_ADD_MONTH_TO_DATE.
Give the input like this,
Import Parameters Value
DMM_DATIN 12.11.2007
DMM_COUNT 1
DMM_OPER -
DMM_POS 1
Export Parameters Value
DMM_DAOUT 12.10.2007
if the count is ' - ' ,it will give the previous month same date and and '+' will give u the next month same date depending upon the count u give i.e. 1 or 2 etc.
reward pts if useful.
Regards,
Subha -
Expression - First date and last date of current month, current year
Hi
I need to have 2 ssrs expression as I can use as default parameters in my report where I can - out from my Time dimension, get the
first date of the current, current year - and one where I get last date, current month, current year.
My data source is a SSAS cube and my timedimension is structured like this:
[Time].[Days].&[2009-01-16T00:00:00]
Any suggestions how to solve this ?Hi ,
You can use below in Default Values in ssrs ;
for first Day of current month and year
="[Time].[Days].&[" +Format(dateadd("m",0,dateserial(year(Today),month(Today),1)), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-01T00:00:00]
For last day of current month and year
="[Time].[Days].&[" +Format(DateSerial(Year(Now()), Month(Now()), "1").AddMonths(1).AddDays(-1), "yyyy-MM-dd")+"T00:00:00]"
output will be ;
[Time].[Days].&[2014-09-30T00:00:00]
Please correct me if I misunderstood your requirement.
Thanks
Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem. -
Data element for Month and Year
Hello All,
Is there any data element which will have only Month and Year.
I have to introduce this field in a table. It should have convesion exits also.
Ex: If i give 092009, it sould come like 09.2009
Thank you.
Best Regards,
Sasidhar Reddy Matli.Kindly Try this code for Month and year as input and having standard F4 help..
INCLUDE RMCS0F0M.
TYPES : BEGIN OF TY_SELECT,
MONTH TYPE FTI_MONTH_YEAR,
END OF TY_SELECT.
DATA : WA_SELECT TYPE TY_SELECT.
SELECTION-SCREEN : BEGIN OF BLOCK SANDEEP WITH FRAME.
SELECT-OPTIONS : S_MONTH FOR WA_SELECT-MONTH OBLIGATORY NO INTERVALS NO-EXTENSION.
SELECTION-SCREEN : END OF BLOCK SANDEEP.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MONTH-LOW.
PERFORM MONAT_F4.
SANDEEP JAIN -
How to get first and last date of previous month
To set default values in selection screen,I want first and last date of the previous month.
Also I want the first and last dates of previous quarter.
The quarters can be only january to march, apr to june, jul to sept, oct to dec.
I want to run a program on beginning of each month by job scheduling having <b>selection screens</b> for the above monthly and quarterly dates.Hi Suhas,
Use the below code.
DATA: v_date LIKE sy-datum.
DATA: v_month_begin_date TYPE sy-datum,
v_month_end_date TYPE sy-datum,
v_month(2) TYPE n,
v_month1(2) TYPE n,
v_quarter TYPE i,
v_year(4) TYPE n,
v_quarter_begda TYPE sy-datum,
v_quarter_endda TYPE sy-datum.
v_month = sy-datum+4(2).
IF v_month = '01'.
v_month = '12'.
v_year = sy-datum+0(4) - 1.
ELSE.
v_month = v_month - 1.
v_year = sy-datum+0(4).
ENDIF.
CONCATENATE v_year v_month '01' INTO v_date.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = v_date
IMPORTING
ev_month_begin_date = v_month_begin_date
ev_month_end_date = v_month_end_date.
v_month1 = sy-datum+4(2).
IF v_month1 = '01' OR
v_month1 = '02' OR
v_month1 = '03'.
v_quarter = 1.
ELSEIF v_month1 = '04' OR
v_month1 = '05' OR
v_month1 = '06'.
v_quarter = 2.
ELSEIF v_month1 = '07' OR
v_month1 = '08' OR
v_month1 = '09'.
v_quarter = 3.
ELSEIF v_month1 = '10' OR
v_month1 = '11' OR
v_month1 = '12'.
v_quarter = 4.
ENDIF.
IF v_quarter = 1.
v_quarter = 4.
v_year = sy-datum+0(4) - 1.
ELSE.
v_quarter = v_quarter - 1.
v_year = sy-datum+0(4).
ENDIF.
CALL FUNCTION 'HR_99S_GET_DATES_QUARTER'
EXPORTING
im_quarter = v_quarter
im_year = v_year
IMPORTING
ex_begda = v_quarter_begda
ex_endda = v_quarter_endda.
WRITE:/5 'previous month begin date : ', v_month_begin_date.
WRITE:/5 'previous month end date : ', v_month_end_date.
WRITE:/5 'previous quarter begin date : ', v_quarter_begda.
WRITE:/5 'previous quarter end date : ', v_quarter_endda.
Message was edited by:
Velangini Showry Maria Kumar Bandanadham -
SAP XI runtime workbench doesnot display data for previous months
Hi,
We are experiencing an issue in our XI system. When we try to extract messages from the Integration engine we recieve data only for two months including the present month and not for previous months.
Can you pleaes suggest which SAP job or any set parameter is creating such a scenario.
Thanks in advance and suggestion are welcome.
Regards,
SubhramYou should check the archiving/deletion jobs in the PI Admin Check guide..
Kind regards,
Mark -
Date concatenation using MONTH and YEAR
Env : Oracle Reports 9I.
I need to display reports based on dates.
If the user enters in one field 'SEP' and in another '2005',
how can I concatenate both the fields as one and then display
all results for SEP 2005?
The Table has a field called Eff_Date (of type Date)
and containing values:
Eff_Date
==============
01-09-05
02-09-05
04-09-05
05-09-05
My code is
SELECT col1,
col2
FROM TableA
Where TRUNC(Eff_Date )=:MONTH ?? PARAMETER: Here is the month : SEPT
and TRUNC(Eff_date) =:YEAR ?? PARAMETER: Here is the Year : 2005I need to concatenate parameters MONTH and YEAR in one and then
display records for that month.
How can I write the SQL Query to concatenate MONTH and YEAR and
TRUNCATE the column eff_date?
Please help.Env : ORACLE REPORTS 9I
I am passing 3 parameters to the report:
Parameters are of type CHAR
Report Parameters
Year / Month : 2005 / AUG
Effective Date :
The colunm in table is eff_date
eff_date
01/08/2005
02/08/2005
03/08/2005
15/09/2005
17/09/2005
18/09/2005
29/09/2005The problem is:
1)If I dont enter anything,I just get displayed 2 record for the above.
It should display all records rather than 2.
2)If I enter Effective date as 01-AUG-2005,no records are displayed.
This is my code:
Select col1,col2
from TableA
where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) )
AND TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH, 'yyyymon') ,
TRUNC(ch.eff_date) )
)Shud i change the AND to OR? -
Concatenate Date fields as month and year
Hi,
I want to concatenate the field bseg-augdt as month and year.
And have to append as a seperate field (Fiscal month | fiscal year) in the output.
Plz help me to overcome this issue.
Thanks and Regards,
Karthik
Moderator message: very basic, please try yourself and search for information before asking.
locked by: Thomas Zloch on Aug 4, 2010 1:22 PMEnv : ORACLE REPORTS 9I
I am passing 3 parameters to the report:
Parameters are of type CHAR
Report Parameters
Year / Month : 2005 / AUG
Effective Date :
The colunm in table is eff_date
eff_date
01/08/2005
02/08/2005
03/08/2005
15/09/2005
17/09/2005
18/09/2005
29/09/2005The problem is:
1)If I dont enter anything,I just get displayed 2 record for the above.
It should display all records rather than 2.
2)If I enter Effective date as 01-AUG-2005,no records are displayed.
This is my code:
Select col1,col2
from TableA
where ( TRUNC(ch.eff_date) = nvl (:E_DATE, TRUNC(ch.eff_date) )
AND TRUNC(ch.eff_date, 'MONTH') = nvl (TO_DATE(:YR||:MTH, 'yyyymon') ,
TRUNC(ch.eff_date) )
)Shud i change the AND to OR?
Maybe you are looking for
-
Mac Mini Late 2011 keeps restarting after shutdown.
Hi, I had my Mac Mini Late 2011 installed with Mountain Lion yesterday (25 July 2012). The installation was successful but I cannot shut it down. When I shutdown, the system goes down and the display goes black, but after 3 seconds it starts up again
-
Links not working in Reader for some
Hi, I'm making PDF documents from InDesign and then opening up the PDF in Acrobat Pro on my Mac and adding in links. Once I save and open the PDFs again, I'm able to click on the links in both Pro and Reader and they work on my computer, but for othe
-
Aperture 3.0.1 won't open in 64-bit mode; only opens in 32-bit
I downloaded the trial version and then purchased the serial for A3. I installed the plug-in Aperture2gmail and that seems to be where my trouble began. I realized I had to open A3 in 32-bit mode for A2gmail to work. When I un-selected 32-bit mode, I
-
I want to pick up an old G5 tower for video editing and use my PB as the monitor for said tower. This is mainly because of space issues. Is this at all possible? cheers
-
Website looks normal in FF but not in IE
Someone made this website for my volleyball club in dreamweaver, and the size looks normal in FF. I made some changes to the template (sidenote: I pretty much have no idea what i'm doing) and I think messed something up. Now in FF the size looks norm