URGENT - BI Publisher - Get Last Date of Month/Year
Hello,
I want to get the last date of a year/month through BI Publisher. We want to do it by creating a list of values containing the month/year name (i.e. January, February, March for month or 2004 2005 2006 for year) and when the user selects one of this values to get the last date of the month or year in order to select the correct number of records.
Hi,
try with a LOV like the following:
select
to_char(add_months(trunc(sysdate,'MONTH'),-level),'Month - YYYY') display_value,
last_day(add_months(trunc(sysdate,'MONTH'),-level)) return_value
from dual
connect by level <=12
which gives you the last 12 month from today.
Regards
Rainer
Similar Messages
-
How to get last date of month ?
Dear all
hi!!!
How can I get the last date of a particular month?
I mean if the month is Feb, last date of the month should be 28.
Is it required to write in loop or there is any method to get it.
Please write me urgently,
thanx,
SamirHello ,
You can get the last date of a particular month of a particular year like this :
int year= 2000;
int month=1; // February (month is zero based )
int date = 20;
java.util.GregorianCalendar gc = new java.util.GregorianCalendar(year,month,date);
int last_day = gc.getActualMaximum(Calendar.DAY_OF_MONTH));
Sandip -
Dear Experts
Please help, i am new in ABAP.
I want to get number of days for a particular month .Eg if user selects feb as moth and 2009 as year i will get 28.02.2009 as output.
if user selects march and 2009 as year it will automatically returns 31.03.2009..
Also give me function module coding for selection of month and year.
I whouls be highly thankful to you for this.
Regards
Raj JindalHi Raj,
DATA:
w_date type sy-datum.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = '20090214' " pass the date here for which u want the last date
IMPORTING
LAST_DAY_OF_MONTH = w_date
EXCEPTIONS
DAY_IN_NO_DATE = 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_date.
With luck,
Pritam. -
Function Module to get Last date of previous year
Is there any function module to get the Last date of the previous year. e.g, if i give date as 03/02/2009 the output should be 31/12/2008.
pls use below 2 FM's
CALL FUNCTION 'MONTH_PLUS_DETERMINE'
EXPORTING
months = -1
olddate = curent_date
IMPORTING
newdate = w_prevdate.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = w_prevdate
IMPORTING
last_day_of_month = w_lastdayprevmonth
EXCEPTIONS
day_in_no_date = 1
OTHERS = 2. -
RE: FM to get last date of month
Hi,
Please tell me if there is a function to return the last day of the month.
The input is year+month
eg 200710 should return a date 31.10.2007
I noticed that most of the function needs a date, ie DDMMYYYYHi,
use RP_LAST_DAY_OF_MONTHS
SELECT-OPTIONS: S_DATE FOR SY-DATUM.
DATA: V_DATE1 LIKE SY-DATUM,
V_DATE2 LIKE SY-DATUM.
DATA: P_INTRANGE LIKE RSINTRANGE OCCURS 0 WITH HEADER LINE.
INITIALIZATION.
CALL FUNCTION 'RS_VARI_V_1_LAST_MONTH'
IMPORTING
P_DATE = V_DATE1
TABLES
P_INTRANGE = P_INTRANGE.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = SY-DATUM
IMPORTING
LAST_DAY_OF_MONTH = V_DATE2
EXCEPTIONS
DAY_IN_NO_DATE = 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.
S_DATE-LOW = V_DATE1.
S_DATE-HIGH = V_DATE2.
APPEND S_DATE.
Check this link also,
current month
Thanks,
Reward If Helpful. -
Get first and last date of month
Hi,
Is there any function module to get first and last date of month for a entered date.
Please let me know.
Regards,
SPHi,
Use the below FM to find the Last day of month and them u can easily calculate the first day.
DATA : v_startdate TYPE sy-datum.
DATA : v_enddate TYPE sy-datum.
DATA : v_temp TYPE dats.
v_temp = sy-datum.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = v_temp
IMPORTING
last_day_of_month = v_enddate
CONCATENATE v_enddate+0(6) '01' INTO v_startdate.
Hope it helps.
Regards,
Arnab. -
Get Last date of every Month in a year
Hi All,
I need to find last date of month for given year.
Example:
I used to pass date or year such as 2012 or 01-01-2012(DD-MM-YYYY)
SQL query needs to return last date of every month such as
31-01-2012
28-02-2012
31-03-2012
30-04-2012
31-12-2012
for above requirement i have written the following SQL
select rownum as row_count,
case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Jan_month,
case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as Feb_month,
case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as mar_month,
case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as apr_month,
case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as may_month,
case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jun_month,
case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as jul_month,
case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as aug_month,
case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as sep_month,
case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as oct_month,
case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as nov_month,
case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end as dec_month
from dual connect by level <= 12 order by rownum;
Result
Jan_Month
Feb_Month
Mar_Month
Apr_Month
may_month
jun_month
jul_month
aug_month
sep_month
oct_month
nov_month
dec_month
1
31-01-2014
2
28-02-2014
3
31-03-2014
4
30-04-2014
5
31-05-2014
6
30-06-2014
7
31-07-2014
8
31-08-2014
9
30-09-2014
10
31-10-2014
11
30-11-2014
12
31-12-2012
Excepted Result:
am excepted result as single row such as
Jan_Month
Feb_Month
Mar_Month
Apr_Month
may_month
jun_month
jul_month
aug_month
sep_month
oct_month
nov_month
dec_month
31-01-2012
28-02-2012
31-03-2012
30-04-2012
31-05-2012
30-06-2012
31-07-2012
31-08-2012
30-09-2012
31-10-2012
30-11-2012
31-12-2012
Kindly give me suggestion to archive above result.
Thanks&Regards
SamiI agree with Marcus Pivot is the way to go about this... But on the other hand you almost solved it yourself.. just a max function was needed for your expected output:
select
max(case when rownum=1 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Jan_month,
max(case when rownum=2 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as Feb_month,
max(case when rownum=3 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as mar_month,
max(case when rownum=4 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as apr_month,
max(case when rownum=5 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as may_month,
max(case when rownum=6 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jun_month,
max(case when rownum=7 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as jul_month,
max(case when rownum=8 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as aug_month,
max(case when rownum=9 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as sep_month,
max(case when rownum=10 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as oct_month,
max(case when rownum=11 then last_day(to_date(add_months(trunc(to_date('01-01-2014','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as nov_month,
max(case when rownum=12 then last_day(to_date(add_months(trunc(to_date('01-01-2012','DD-MM-YYYY'), 'YYYY'), level - 1), 'DD-MM-YY')) end) as dec_month
from dual connect by level <= 12 order by rownum;
AND to avoid hardcoding you can also modify your query as :
select
max(case when rownum=1 then last_day(to_date(to_char(rownum),'MM')) end) as Jan_month,
max(case when rownum=2 then last_day(to_date(to_char(rownum),'MM')) end) as Feb_month,
max(case when rownum=3 then last_day(to_date(to_char(rownum),'MM')) end) as mar_month,
max(case when rownum=4 then last_day(to_date(to_char(rownum),'MM')) end) as apr_month,
max(case when rownum=5 then last_day(to_date(to_char(rownum),'MM')) end) as may_month,
max(case when rownum=6 then last_day(to_date(to_char(rownum),'MM')) end) as jun_month,
max(case when rownum=7 then last_day(to_date(to_char(rownum),'MM')) end) as jul_month,
max(case when rownum=8 then last_day(to_date(to_char(rownum),'MM')) end) as aug_month,
max(case when rownum=9 then last_day(to_date(to_char(rownum),'MM')) end) as sep_month,
max(case when rownum=10 then last_day(to_date(to_char(rownum),'MM')) end) as oct_month,
max(case when rownum=11 then last_day(to_date(to_char(rownum),'MM')) end) as nov_month,
max(case when rownum=12 then last_day(to_date(to_char(rownum),'MM')) end) as dec_month
from dual connect by level <= 12 order by rownum;
Easy way: (without connect)
SELECT LAST_DAY (TO_DATE (ROWNUM, 'MM')) AS Jan_month,
LAST_DAY (TO_DATE (ROWNUM + 1, 'MM')) AS Feb_month,
LAST_DAY (TO_DATE (ROWNUM + 2, 'MM')) AS Mar_month,
LAST_DAY (TO_DATE (ROWNUM + 3, 'MM')) AS Apr_month,
LAST_DAY (TO_DATE (ROWNUM + 4, 'MM')) AS May_month,
LAST_DAY (TO_DATE (ROWNUM + 5, 'MM')) AS Jun_month,
LAST_DAY (TO_DATE (ROWNUM + 6, 'MM')) AS Jul_month,
LAST_DAY (TO_DATE (ROWNUM + 7, 'MM')) AS Aug_month,
LAST_DAY (TO_DATE (ROWNUM + 8, 'MM')) AS Sep_month,
LAST_DAY (TO_DATE (ROWNUM + 9, 'MM')) AS Oct_month,
LAST_DAY (TO_DATE (ROWNUM + 10, 'MM')) AS Nov_month,
LAST_DAY (TO_DATE (ROWNUM + 11, 'MM')) AS Dec_month
FROM DUAL
Cheers,
Manik. -
Customer Exit for Number of Days from 1 st Apr to last date of Month Enter
Hello BI Experts,
I have a requirement to count the number of days from 1 st April of current year to the last date of month entered.
For example : The use will enter say July 2010 or 003.2010 (as Fiscal Year Variant is V3 ).
Today is 14 July ...So we have to first find out the end date of the July month ie 31 st July
Then go to 1 st April 2010.
Now calculate the Number of days between 1 st April to 31 st July 2010.
I consider I have to create two Customer Exit variable
as below
1 st customer exit Bex variable say ZLY_MTH ( Last day of Month Entered)
and i_step = 1
2 nd Customer Exit BEx Formula variable say ZF_NUMDAYS ( Number of days between two dates)
i_step =1 .
Please provide me the logic for the above two.
Thanks in Advance.
Regards,
Amol KulkarniPSUDEO CODE:
1. Initially LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZMONTH'.
2. Get the Month input using VAR_MONTH2 = LOC_VAR_RANGE-LOW+4(2)
3. Now calculate Month+1: VAR_MONTH2 = VAR_MONTH2 + 1 (Refer **)
4. Now calculate the Current Year: VAR_YEAR = LOC_VAR_RANGE-LOW+0(4).
5. Get the 1st Day of the Month (VAR_MONTH2): CONCATENATE '01' '/' VAR_MONTH2 '/' VAR_YEAR INTO L_S_RANGE-LOW.
6. SUBRACT 1 (0DATE) from this DATE (This will give the logic for last day of the current month)
Insert this code also for using the date conversions
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = VAR_MONTH2
IMPORTING
OUTPUT = VAR_MONTH2.
Pls. check out this logic. Guess it would solve your need.
Thanks,
Arun Bala -
What is the syntax to get last date of Quarter ?
Hi ,
We are planning to have Bom effective date functionality. Presently BOM Disable date is coming in between the Quarter. Is there any funtion or syntax to get last date of quarter for the bom disable date. similar to "$begin" to get the last date.
ThanksHi,
To get this done you can do the following.
1. Create the Result Source.
2. Create the display template using the design manager and copy the existing template make the req. changes on the template and publish it to the document library and give the manage property that you req. for this concatenation functionality. Manage Property
like the domain etc.
3. Create search center and add the new page modified the core result web part and give the result source and custom template that created in step 2.
4. Publish the page.
5. Create the Search vertical and give the name and use the same page the created in step3.
http://sharepointfordeveloper.blogspot.in/2013/09/sharepoint-2013-result-source.html
http://sharepointfordeveloper.blogspot.in/2013/09/sharepoint-2013-result-types.html
http://sharepointfordeveloper.blogspot.in/2013/06/sharepoint-2013-design-manager.html -
Set variant in infopackage to get backward data 1 month automatically
Dear all,
Could anyone tell me how could I set variant in infopackag => tab Data selection to get backward data 1 month from schedule day (every Monday) automatically?
Many thanks & Regards,
Bigtree K.Use this code...
l_t_range-option = 'BT'
l_t_range-sign = 'I'.
l_t_range-low = SY-DATUM - 1.
l_t_range-high = SY-DATUM.
Append l_t_range.
Take a look at this link for more info...
http://help.sap.com/saphelp_nw04/helpdata/en/a3/4f8f3b294a7f2de10000000a11402f/content.htm -
How to get last date of the week
hi,
how to get last date of the week like FM WEEK_GET_FIRST_DAY gives the date of the first day of the week i need the date of the last day of the week..
thnxdata : p_week type KWEEK,
p_Date type SYDATUM.
p_week = <incoming value in week of year>
CALL FUNCTION 'WEEK_GET_FIRST_DAY'
EXPORTING
week = p_week
IMPORTING
DATE = p_date
EXCEPTIONS
WEEK_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.
To get the last day of the week.
p_date = p_date + 6.
You can find the available fm in the system from se37 transaction code. -
When I look up the creation date for files on my Macbook (using "get info", or the information window in Iphoto) I get the date and month in brackets, but not the year. Why is this and how can I look up the year?
Does the Date Modified column in a window set to List view show the date correctly, or does it also display it incorrectly?
To add additional columns to a Finder (folder) window, with that window open and active open the View Options for it. You can do that by pressing Command-J or by selecting View Options from the View menu in the main menubar. -
How to find last date of month
Dear All,
Can anybody tell me how to find last date of month I need it to check some validations
helpful answer will definatly rewarded
Regards
ShashikantHi,
RP_LAST_DAY_OF_MONTHS Determine last day of month
HR-D: Payroll Germany code
RP_LAST_DAY_OF_MONTHS
HR-D: Determine last day of month
DATE_CONVERT_TO_FACTORYDATE
Returns factory calendar date for a date Calculates and returns factory calendar date for a date (if CorrectOption = '+');
Checks if the date is work day (if CorrectOption = '-').
HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND. -
Function module to get the dates from the year and the period
Is there a function Module to get the dates from the year and the period
Check with :
To get last day of period use .
LAST_DAY_IN_PERIOD_GET.
To get last of month Use :
RE_LAST_DAY_OF_MONTH
HRVE_LAST_DAY_OF_MONTH
LAST_DAY_OF_MONTHS
ISB_PREVIOUS_PERIOD_DATE_GET
Thanks
Seshu
Maybe you are looking for
-
CS4 Crashes in SL when opening Raw as 16 bit ProPhoto
It crashes every time on opening a raw in 16 bit ProPhoto. When I open as 8 bit everything seems to work fine. I installed SL on top of Leopard. I have cleared my cache, deleted plists and deleted the Menlo font. To no avail. 8-core Mac Pro. See
-
Can you upgrade Acrobat 9 Standard from a "bundle" license?
Can you upgrade Acrobat 9 Standard to Acrobat XI Standard if you have a "bundle" license? The Acrobat 9 Standard CD envelope has a serial number that must be used to install the software.
-
Problem in sending the report to Outlook from Oracle Forms.
hi buddies I'm trying to send a report to outlook from form. but when I run the report with the following report parameters: Add_Parameter(param, 'DESFORMAT', TEXT_PARAMETER, 'pdf'); Add_Parameter(param, 'DESNAME' , TEXT_PARAMETER,'d:\main\abc.pdf');
-
In Illustrator CS2 I am converting CAD files (typically dxf's) to EPS's scaled to fit on an 8.5" x 11" artboard. I generate these files in AutoCAD and lately, the DXF's will open in Illy by default on a 22" x 64" artboard. I use this size occasionall
-
Import from iPad - destination greyed out
I got a problem, when I import pictures or videos from my new iPad to Aperture 3 the the drop-down menu for the destination (in german: Zielort) and the textfield for the project name (in german: Projektname) is greyed out always. This only happens w