Defaulting date 3 months from present date
HI!
In my selection screen in my report I need to default a
selection option to a future date which is 3 months from the
present date. Can anyone tell me whats the way to do this so
that I can add 3 montsh from the present date and default it in my selection screen.
example : if we consider todays date then we need to
default that date to 9th of september 2008 so it keeps of
changing everyday as dates proceed.
Thanks
Check the below program :
REPORT ZTEST78 .
data v_fdate type d.
CALL FUNCTION 'HR_PSD_DATES_ADD_MONTHS'
EXPORTING
V_DATE = sy-datum
V_MONTHS = 3
IMPORTING
E_DATE = v_fdate
EXCEPTIONS
NOT_POSITIVE = 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:/ v_fdate.
do not add 90 days ,some months may have 31 or 29 or 28,you will not get exact calculation,so use FM 'HR_PSD_DATES_ADD_MONTHS'
Thanks
Seshu
Thanks
Seshu
Similar Messages
-
Get the month from a date column with the calculated column
I am trying to get the month from a date field with the help of calculated column. However I get this syntax error whenever I want to submit the formula:
Error
The formula contains a syntax error or is not supported.
the default language of our site is German and [datum, von] is a date field.Hi,
I have created two columns
Current MM-YY
Calculated (calculation based on other columns)
Today
Date and Time
Current MM-YY is calculated value with formula as
=TEXT(Today,"mmmm")
But the output shows as December instead of May.
I have tried =TEXT([Datum, von];"mmmm") but no help.
I am trying to populated the column automatically with current month..ex: if its May the field should show May, next month it should show June an so on.
Any kind help is grateful.
Regards,
Pradeep -
I am attempting to have cells use data from a selective month from the year before so that I can show actual from the prio. year each month. I need to create a spreedsheet using the the Acutlas from the year-to-date and from last year-to-date, but need to report each month.
Hi Tony,
Answering your question would be easier given a screen shot of the source table and one of what you want the summary table to look like.
Is the data you want for each month in a single cell o the source table, or does the summary table need to collect February's data (for example) from several cells and do some math with those numbers before presenting them on the summary table?
Regards,
Barry -
FM to tansfer data in flat file from presentation to application server
Hi Experts,
Please tell the FM to tansfer data in flat file from presentation server to application server or vice versa in ECC 6.0.
Thanks.Hi,
This is how you can achieve it:
1. You read the flat file from presentation layer and store the file content in internal table gt_inrec
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gw_filename
filetype = 'ASC'
IMPORTING
filelength = gw_length
header = gw_header
TABLES
data_tab = gt_inrec
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
2. Create a new file at the application server:
OPEN DATASET p_ofile FOR OUTPUT IN
TEXT MODE ENCODING DEFAULT.
3. Transfer the content from the internal table into the file at the application server:
LOOP AT gt_inrec.
TRANSFER gt_inrec-record TO p_ofile.
ENDLOOP.
Hope it helps,
Lim.... -
Using the default date for presentation variable
In the report I want to use the default date for the presentation variable.
If I use the query like below,default value is giving correctly.but if I pass the date value from dashboard prompt it is throwing error
Anybody help me to modify the below
query to get the valid results?
Timestampadd(SQL_TSI_day,(dayofmonth(date @{asdf}{date '1900-01-01'})*-1)+1,date @{asdf}{date '1900-01-01'})
Edited by: user12255470 on Dec 2, 2010 12:11 PM
Edited by: user12255470 on Dec 2, 2010 12:12 PMtry this:
Timestampadd(SQL_TSI_day,(dayofmonth(date '@{asdf}{1900-01-01}')*-1)+1,date '@{asdf}{1900-01-01}')
mark answers promptly.
J
-bifacts
http://www.obinotes.com
Edited by: bifacts on Dec 2, 2010 3:21 PM -
Hi,
i have a dimension table with month_key having values (201201,201202,201203.......202011,202012) and month name ( Jan 12, feb 12,......NOV 20, Dec 20) and a fact table with columns (month_key ,measure_types, Amount)
My requirement is to create a power pivot report in which when a user select a month from the filter, the report should display the (selected month+18 ) month's data against each type . when JAN 12 is selected ,the jan 2012 +18 = june 2013
, month name should be populated with months till june 2013 only .
i tried creating calculated column"END DATE " in the fact table with dax expression to calculate the 18th monh from the current month as below
month_key END DATE
201201 201306
201202 201307
and thought of filtering the table with month key <= ENDDATE but it is not working as expected. could you please guide me on this ? Is there any time intelligence function that serve the purpose . Iam using excel 2010
..hence could not do any calculation on the report side also. please suggest .
Thanks in advanceDo you need to show the measure calculated for those 18 months as a total on 1 row, or do you need to select a single month and then display on row filters 18 distinct rows?
The first is trivial as driezl has suggested.
The second will require a second calendar table.
I created this example workbook for a coworker who had a similar problem. You will have to use the disconnected table as your filter and pull your related table onto the rows.
Finally, the easiest way to deal with the sort of date arithmetic you need to do is to restructure your date table to have a series of "Sequential" fields. These fields should be the number of units of time since the beginning of your calendar.
For example, consider a calendar starting on January 1, 2010. For January - December 2010, [MonthSequential] = 1, 2, ..., 12. For January - December 2011, [MonthSequential] = 13, 14, ..., 24, and so on, incrementing by 1 for each sequential month in time.
Assuming you have this set up in your date tables (one related to your model - DimDate - and one disconnected - DisconDimDate) your measure would look like this:
18 Month Measure:=
CALCULATE( [Measure]
, FILTER( DimDate
, DimDate[MonthSequential] >= MAX( DisconDimDate[MonthSequential] )
&& DimDate[MonthSequential] <= MAX( DisconDimDate[MonthSequential] ) + 18
Please review this example along with the workbook I have linked above. -
I have recently written my first stored procedure.
Its rather a bunch of SQL statements.
I had to hard code lot of dates. most of them are first day of the current monthe or last day of current month etc.
I thot of parametrizing all the dates, but if a business person has to include all the parameters they could go wrong and get the wrong results.
Now, I want to use date functions to achieve these requirements:
Can any one please throw some insght into this:....
1) First day of current month,
2) last day of current month.
3) first day of previious month
4) last day of previous month
5) first day of a month that is 3 months from now.
6) last day of a month that is 3 months from now.
7).....
Can any one please throw some light on any one of this.. I can try to work from there onwards ....
Thanks a lot in advance,
AcHi there,
1) First day of current month
select trunc(sysdate, 'MM') from dual;
2) last day of current month.
select trunc(add_months(sysdate, 1), 'MM') - 1 from dual;
3) first day of previious month
select trunc(add_months(sysdate, -1), 'MM') from dual;
4) last day of previous month
select trunc(sysdate, 'MM') - 1 from dual;
5) first day of a month that is 3 months from now.
select trunc(add_months(sysdate, 3), 'MM') from dual;
6) last day of a month that is 3 months from now.
select trunc(add_months(sysdate, 4), 'MM') - 1 from dual;cheers,
Anthony -
Calculations for 6 months from todays date
Need to calculate the total of all the months starting from today's date for the next 6 months from the current date.
For ex
Month Total
01.07.2008 10
01.08.2008 20
01.09.2008 50
01.10.2008 72
01.11.2008 85
01.12.2008 15
Please advice how to work on this.
Can we use ranges?
Thanks in advance.Hi dolly,
Ref this code.....
TYPE-POOLS :
slis.
TABLES :
pernr.
INFOTYPES :
0000,
0001,
0002.
TYPES :
BEGIN OF t_final,
srlno TYPE i, "Serial No
pernr TYPE p0000-pernr, "Employee No
vorna TYPE p0002-vorna, "First Name
nachn TYPE p0002-nachn, "Last Name
btrtl TYPE p0001-btrtl, "PERSONAL SUB AREA / SEGMENT
btext TYPE t001p-btext, " SEGMENT DESC
begda TYPE p0000-begda, " JOINING DATE
pdate TYPE p0000-begda, " Probation period date.
END OF t_final,
BEGIN OF t_t001p,
btrtl TYPE t001p-btrtl,
btext TYPE t001p-btext,
END OF t_t001p.
DATA :
v_year(4) TYPE n,
v_year1 TYPE i,
count TYPE i,
v_mont(2) TYPE n,
v_dt(2) TYPE n,
v_date(8),
it_final TYPE STANDARD TABLE OF t_final,
it_temp TYPE STANDARD TABLE OF t_final,
it_t001p TYPE STANDARD TABLE OF t_t001p,
wa_t001p TYPE t_t001p,
wa_temp TYPE t_final,
wa_final TYPE t_final.
ALV Grid Declarations *
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat,
wa_layout TYPE slis_layout_alv,
it_sortcat TYPE slis_t_sortinfo_alv,
wa_sortcat LIKE LINE OF it_sortcat.
START-OF-SELECTION.
PERFORM fill_itabs.
GET pernr.
rp-provide-from-frst p0000 space '18000101' '99991231'.
IF pnp-sw-found = 1.
IF p0000-stat2 = 3. " Checking for status.
MOVE :
p0000-begda TO wa_temp-begda,
p0000-pernr TO wa_temp-pernr.
rp-provide-from-last p0001 space pnpbegda pnpendda.
IF pnp-sw-found = 1.
MOVE :
p0001-btrtl TO wa_temp-btrtl.
CLEAR : wa_t001p.
READ TABLE it_t001p INTO wa_t001p WITH KEY btrtl = wa_temp-btrtl.
IF sy-subrc = 0.
MOVE : wa_t001p-btext TO wa_temp-btext.
ENDIF.
ENDIF.
rp-provide-from-last p0001 space pnpbegda pnpendda.
IF pnp-sw-found = 1.
MOVE :
p0002-vorna TO wa_temp-vorna,
p0002-nachn TO wa_temp-nachn.
ENDIF.
APPEND wa_temp TO it_temp.
CLEAR : wa_temp.
ENDIF. "if p0000-stat2 = 3.
ENDIF. "if pn-sw-found = 1.
END-OF-SELECTION.
PERFORM process_data.
PERFORM build_catalog.
PERFORM display_data.
*& Form PROCESS_DATA
text
--> p1 text
<-- p2 text
FORM process_data .
LOOP AT it_temp INTO wa_temp.
IF wa_temp-begda+4(2) > 6.
v_year = wa_temp-begda(4) + 1.
v_mont = wa_temp-begda+4(2) + 6.
v_dt = wa_temp-begda+6(2).
IF WA_TEMP-BEGDA+4(2) = '08'.
IF wa_temp-begda+6(2) = '29' OR
wa_temp-begda+6(2) = '30' OR
wa_temp-begda+6(2) = '31'.
v_dt = '28'.
ENDIF.
ENDIF.
IF v_mont > 12.
v_mont = v_mont - 12.
CONCATENATE v_year v_mont v_dt INTO v_date.
MOVE : v_date TO wa_temp-pdate.
ENDIF.
ELSE.
v_mont = wa_temp-begda+4(2) + 6.
CONCATENATE wa_temp-begda(4) v_mont wa_temp-begda6(2) INTO v_date.
wa_temp-pdate = v_date.
ENDIF.
MODIFY it_temp FROM wa_temp .
CLEAR : v_date, v_year, v_mont.
ENDLOOP.
LOOP AT it_temp INTO wa_temp WHERE pdate BETWEEN pnpbegda AND pnpendda.
MOVE : wa_temp-pernr TO wa_final-pernr,
wa_temp-vorna TO wa_final-vorna,
wa_temp-nachn TO wa_final-nachn,
wa_temp-begda TO wa_final-begda,
wa_temp-btrtl TO wa_final-btrtl,
wa_temp-btext TO wa_final-btext.
CASE wa_temp-pdate+4(2).
WHEN '04' OR '06' OR '09' OR '11'.
IF wa_temp-pdate+6(2) > '30'.
CONCATENATE wa_temp-pdate(4) wa_temp-pdate4(2) '30' INTO v_date.
MOVE : v_date TO wa_final-pdate.
ELSE.
MOVE wa_temp-pdate TO wa_final-pdate.
ENDIF.
WHEN '02'.
v_year1 = wa_temp-pdate+(4) MOD 4.
IF v_year1 = 0 AND wa_temp-pdate+6(2) > '29'.
CONCATENATE wa_temp-pdate(4) wa_temp-pdate4(2) '29' INTO v_date.
MOVE : v_date TO wa_final-pdate.
ELSEIF v_year1 NE 0 AND wa_temp-pdate+6(2) > '28'.
CONCATENATE wa_temp-pdate(4) wa_temp-pdate4(2) '28' INTO v_date.
MOVE : v_date TO wa_final-pdate.
ELSE.
MOVE wa_temp-pdate TO wa_final-pdate.
ENDIF.
WHEN OTHERS.
MOVE wa_temp-pdate TO wa_final-pdate.
ENDCASE.
count = count + 1.
MOVE : count TO wa_final-srlno.
APPEND wa_final TO it_final.
CLEAR : wa_final, v_year1 , v_date.
ENDLOOP.
ENDFORM. " PROCESS_DATA
*& Form BUILD_CATALOG
FORM build_catalog .
DEFINE m_fieldcat.
add 1 to wa_fieldcat-col_pos.
wa_fieldcat-fieldname = &1.
wa_fieldcat-tabname = 'IT_FINAL'.
wa_fieldcat-seltext_m = &2.
wa_fieldcat-outputlen = &3.
append wa_fieldcat to it_fieldcat.
END-OF-DEFINITION.
m_fieldcat 'SRLNO' 'S No' '8' .
m_fieldcat 'PERNR' 'Employee No' '15'.
m_fieldcat 'VORNA' 'First Name' '15' .
m_fieldcat 'NACHN' 'Last Name' '15' .
m_fieldcat 'BTRTL' 'Segment' '15' .
m_fieldcat 'BTEXT' 'Segment Desc' '15' .
m_fieldcat 'BEGDA' 'Date of Joining' '15'.
m_fieldcat 'PDATE' 'Probation End Date' '15' .
ENDFORM. " BUILD_CATALOG
*& Form DISPLAY_DATA
FORM display_data .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = ls_layout
it_fieldcat = it_fieldcat
it_sort = it_sortcat
TABLES
t_outtab = it_final.
ENDFORM. " DISPLAY_DATA
*& Form FILL_ITABS
FORM fill_itabs .
SELECT btrtl
btext
FROM t001p
INTO TABLE it_t001p.
ENDFORM. " FILL_ITABS -
How to get the first day in the month from a domain date ?
Hi,
I like to know how to get the first day in the month from a domain date?
Thanks
StephenHi Gokul...
Instead of using the funtion module you can just write the 3 statements of code to get the first day of the week.
Its similar to the above one but instead of writing case statement you can achive the following.
data : w_res type i,
w_data type d,
w_res = w_date mod 7.
w_date = w_date - w_res.
write w_date.
This works.
Regards,
Siddarth -
Function Module to Return MM/DD/YYYY after 6 Months from today's Date
Hi,
I need to find out the Month/Date/Year, after 6 months from the given Date. Can any one please suggest me a suitable Function Module to get the MM/DD/YYYY after 6 months from current date.
Appreciate your help!
Thanks,
Kannan.You can also use :-
RE_ADD_MONTH_TO_DATE
Kindly reward in case useful.
Regards,
Darshan Mulmule -
How to subtract the month from an item type Date Picker
Hi everybody!!
I´m building an application (V4.2) in wich customer introduce a date (item P11_F_ACTIVIDAD, Display as Date Picker). I need to sustract the month from that field and use it in a SQL query to fetch all rows from a table that met that condition (column F_ACTIVIDAD) . The WHERE clause should has something like this: WHERE substr(to_char(h.F_ACTIVIDAD,'ddmmyyyy'),3,2)= substr(to_char(:P11_F_ACTIVIDAD,'ddmmyyyy'),3,2) but SQL engine does not see ":P11_F_ACTIVIDAD" like a column name..... Of course, it is not a column name.
I appreciate recomend me an idea to overcome this issue.
Thanks so much!
LuisLecc23 wrote:
Hi everybody!!
I´m building an application (V4.2) in wich customer introduce a date (item P11_F_ACTIVIDAD, Display as Date Picker). I need to sustract the month from that field and use it in a SQL query to fetch all rows from a table that met that condition (column F_ACTIVIDAD) . The WHERE clause should has something like this: WHERE substr(to_char(h.F_ACTIVIDAD,'ddmmyyyy'),3,2)= substr(to_char(:P11_F_ACTIVIDAD,'ddmmyyyy'),3,2) but SQL engine does not see ":P11_F_ACTIVIDAD" like a column name..... Of course, it is not a column name.
I appreciate recomend me an idea to overcome this issue.
Thanks so much!
Luis
In APEX, items can certainly be used as bound variables in a SQL statement; like this.
SELECT emp.ename,
emp.hiredate,
EXTRACT (MONTH FROM emp.hiredate) hiredate_month,
EXTRACT (MONTH FROM :p11_f_actividad) datepicker_month
FROM emp
WHERE SUBSTR (TO_CHAR (emp.hiredate, 'ddmmyyyy'), 3, 2) =
SUBSTR (TO_CHAR ( :p11_f_actividad, 'ddmmyyyy'), 3, 2)
Jeff -
Min date for each month from list
Hi all,
I need to select only minimal date for each month from this sample query:
select date '2011-01-04' as adate from dual union all
select date '2011-01-05' as adate from dual union all
select date '2011-01-06' as adate from dual union all
select date '2011-02-01' as adate from dual union all
select date '2011-02-02' as adate from dual union all
select date '2011-02-03' as adate from dual union all
select date '2011-10-03' as adate from dual union all
select date '2011-10-04' as adate from dual union all
select date '2011-10-05' as adate from dual So the result should be:
04.01.2011
01.02.2011
03.10.2011How do I perform it?WITH dates
AS (SELECT DATE '2011-01-04' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-01-05' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-01-06' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-02-01' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-02-02' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-02-03' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-10-03' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-10-04' AS adate FROM DUAL
UNION ALL
SELECT DATE '2011-10-05' AS adate FROM DUAL)
SELECT TO_CHAR (MIN (adate), 'DD.MM.YYYY') adate
FROM dates
GROUP BY to_char(adate, 'YYYY.MM')
ADATE
03.10.2011
01.02.2011
04.01.2011 -
How to calculate first date of month from a given date in IDT BusinessObjects
Hello Experts,
I have a date field in IDT Universe which shows date in this format: Dec 13,2014 12.00.00 PM. Now I want to extract first day and last day of month from this date value. For example: here I want to see Dec 01,2014 12:00:00 PM and Dec 31, 2014 12:00:00 PM in First day of month and Last day of month columns. Also, if database date value is Nov 17, 2014 12:00:00 PM then in first day of month column, it should show Nov 01, 2014 12:00:00 PM and in last day of month it should show Nov 30, 2014 12:00:00 PM.
I got some google help but 'Date' function is not supported by IDT tool in BusinessObjects.
Please help.
Thanks in advance.Hi
Try to use the DB Functions to find out the First and last day. Please find out the below screenshot.
If DB is BW, you can calculate the First and last day @ BW level use same object in BO directly.
SQL DB:
http://docs.oracle.com/html/A95915_01/sqfunc.htm#i1006893
Oracle DB:
http://msdn.microsoft.com/en-US/library/ms189794(v=sql.90).aspx -
Dump in user exist CC01 to set default value to valid from date
Dear friends,
Task is to set default value to valid from date field in Transaction "CC01".
In INCLUDE ZXCCAU01 of Function 'EXIT_SAPMC29C_001' in Enhancement 'PCCD0001' I written the code like this
DATA var LIKE sy-datum.
var = var + 1.
which is not related to program by creating project and activated the project.
When I run cc01 it is giving dump.
Error is :
Program "SAPLXCCA" tried to use screen 1000.
The screen does not exist.
Can some one guide me What is the problem and How to resolve this.
If not, Is there any other method this can be done.
Regards,
VenkatHi venkat,
DATA var LIKE sy-datum.
var = var + 1.
the code u written i guess not ok.The code used by kishan is correct. i.e
DATA var LIKE sy-datum.
sy-datum = sy-datum + 1.
var = sy-datum.
write var.
use the above code.
SAPLXCCA is a functionpool not a program.please check the same.
regards,
Nagaraj -
Picking Month from Date in ABAP query
Dear All,
I want to pick month from date in a abap query but it is giving error "BDTER" is not a valid comparison operator. comparison operator.
Where i am wrong my query is below.
SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
WHERE MONTH( BDTER ) = '12'.
With Regards
Ashwani K MathurDear Deepankar,
Thanks for reply.
Date fomat is yy/mm/dd (like 20071231) after your suggestion i have modified query.
SELECT SUM( BDMNG ) AS BDMNGT FROM RESB INTO CORRESPONDING FIELDS OF IT_MRP
WHERE BDTER+4(2) = 12.
but while compiling it is giving error Field "BDTER+4(2)" unknown.
Please suggest.
Ashwani K Maathur
Maybe you are looking for
-
Why is my page count always 1 (regardless of number of pages)?
I just created a new Numbers document. It has 3 pages. In the footer I display (page number) of (page count). I would expect to see "1 of 3", "2 of 3", "3 of 3". What I get is "1 of 1", "2 of 1", "3 of 1". What do I have to do to get the page count t
-
Problem converting ABAP list into PDF
Hello, Having converted a spool request of an abap list into pdf the "intensified" attribute of the list items will disappeare. Text in the list with i.e. COL_BACKGROUND INTENSIFIED would be converted to text with blue and normal font. None of the po
-
I have recently burned loads of cds to itunes in readiness to transfer to ipod nano When sorting by albums I find some tracks have not been associated with the correct album How can I move tracks to the correct album>? Thanks
-
My Keynote and iPhoto are not working together to build stacked photos
I am new to the Mac world (1st day on the Mac) and I am trying to stack 3 photos on to one Keynote slide. I cannot get my photos in iPhoto to come up when I click on Media. What am I doing wrong?
-
How can i pay off a balance using itunes gift card?
i have a balance of about 16 dollars, and i got a 15 dollar gift card, how can i use it to pay off the balance?