MONTH and YEAR functions. Please help...
Can anyone tell me why the YEAR and MONTH functions will only accept the format dd-MMM-yyyy (ex. 01-JAN-2009)
The calendar prompt will only retun the format dd/mm/yyy (ex. 01/01/2009). This renders the calender pretty useless.
I am really in need of some help on this. Does anyone know how to get the value returned from the calendar in a prompt into a format that can be used by the YEAR and MONTH functions?
Thank you in advance
Hi,
Can you do those things at DB Level.. addition of YEAR and MONTH columns to Table.. because doing CAST to DATE operation will work at DB Level..
Ex: In Answers if you give YEAR(CAST('01-03-2009' AS DATE)), it is erroring out because default allowed date format of BI is different from the one specified.. Though it is issuing correct SQL which is working at DB level.. donno how to change the default format of BI..
So, what I can suggest is an alternative, which is at DB level.. if it is apt for you.. then
Following statement gives you YEAR value..
TO_NUMBER(TO_CHAR( cast('01-03-2009' as DATE), 'yyyy'), '9999')
This is the statement taken from Manage Session of BI..
-Vency
Similar Messages
-
TO GET WEEKS for a given MONTH AND YEAR
Is there any FM to get the no of weeks for a given month, say 01 2005.
Can i get the week numbers say 1 2 3 4 5 for the given month and year.
Please let me know.
Happy Holidays.
Regards,
Manohar EHi Manohar,
Use FM DATE_GET_WEEK twice; first time pass first day of the month and again pass the last day of the month as a parameter. So u will be having week number(yyyyxx) for the first week of the month and week number for the last week of the month. From these two, in between week numbers u can easily fetch. I hope this will help u out.
Regards,
Kavya Shah -
An error occurred in the App Store. Try again later(13)
Can't download or update, install and buy!
I wait for months!!! please help me!
<Email Edited by Host>Disable anti virus software.
Turn off the Firewall in System Preferences > Security (or Security & Privacy) > Firewall
If that doesn't help, open the Finder. From the Finder menu bar click Go > Go to Folder
Type this exactly as you see it here:
~/Library/Caches/com.apple.appstore/Cache.db
Click Go
Move the Cache.db file to the Trash.
Now here:
~/Library/Preferences
Click Go
Move these files from the Preferences folder to the Trash.
com.apple.appstore.plist
com.apple.storeagent.pllist
Now here:
~/Library/Cookies
Click Go
Move the com.apple.appstore.plist file from the Cookies folder to the Trash.
Empty the Trash, try the App Store. -
Function module for getting month and year of the previous month (say -6)
Hi,
Is there a function module that will get you the month and year of say, a month before, and as far as 11 months ago.
For example, say today is 6/2007. I want 7 months ago.
How do i get this value?
What function module or method is available?
Points will be rewarded and responses will be appreciated.
Thank You,
JohnHi
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.
OR
Use the following FM for getting the year and the month based on date
CACS_DATE_GET_YEAR_MONTH
or
Call Function 'CCM_GO_BACK_MONTHS '.
Funny module: 03/31/2002 - 1 month = 02/31/2002
OR
RE_ADD_MONTH_TO_DATE ( Add / substract month to/from date )
Need ur reward points.
Best regards,
Ravi -
Could some body help me:
I am try to get Date, Month and Year
I got stuck, Anyone help me this:
public class DateMonth
public static void main(String[] args)
toDay = new toDay("February 21, 2002");
dayofWeek = today.getDay();
System.out.println("Current month is " + toDay.getMonth());
System.out.println("Current day is " + getDate());
System.out.println("Current year is " + toDay.getYear());
toDay.setDate(toDay.getDate()+60)
System.out.println("Sixty days from now is ");
System.out.println(toDay);
}Try something like this:
import java.util.*;
public class DateMonth {
public static void main(String[] args) {
// Note: 0 = January
Calendar calendar = new GregorianCalendar();
System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
System.out.println("DATE: " + calendar.get(Calendar.DATE));
System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
// 60 days from now
calendar.add(calendar.DATE, 60);
System.out.println("\nSixty days from now");
System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
System.out.println("DATE: " + calendar.get(Calendar.DATE));
System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
}Remember that January is 0!
Take a look at the GregorianCalendar class:
http://java.sun.com/j2se/1.3/docs/api/java/util/GregorianCalendar.html
Hope this helps!
DesQuite -
Hi Gurus,
I m Using SPMON(Period to analyze month and year) as input Field in my BSP Application.
If i Click the Input Help i want to call a Function module "popup_to_display_month" ..
How to acheive this.
I have used onValueHelp attribute in which it will call only the Javascript.
Please guide me...
Thanks n Regards
AravindhHi Aravindh,
First thing if this FM 'POPUP_TO_SELECT_MONTH' gives a popup in SAPGUI , you can not use it in BSP since SAP GUI popups are not supported in BSP.
I have used onValueHelp attribute in which it will call only the Javascript.
If triggering a server side event using onValueHelp solves you problem that you can do it as follows..
1)In the layout somewhere use a blankimage that will not be visible in UI.
2)Suppose ID of this image is 'blank'
now call javascript function for onValueHelp
and in this javascript function use
dacument.getElementById('blank').click();
change dacument to document.
This will trigger a server event which you can process in onInputProcessing and call the FM.
Regards,
Anubhav -
Sales report for current month and year a go month
i could you please guide me builting report for current monthwise for current month and year a ago month
report parameter month_year='06-2010'
tables = sales and below are the table fields
customer_id
invoice_dt
invoice_am
thanks
nhmOkay, Still you did not mention how you will pass value in report while generating.
Anyway the query with UNION ALL will work. For Example.
I am assuming that the parameter for date/month you will pass in range like 01-JUN-2010 to 30-JUN-2010
SELECT customer_id, SUM(curr_value) curr_value, SUM(past_value) past_value
FROM
SELECT customer_id, NVL(SUM(invoice_amount),0) curr_value, 0 past_value
FROM sales
WHERE invoice_dt BETWEEN :P_FROM_DATE AND :P_TO_DATE -- here P_FROM_DATE and P_TO_DATE will be the date range for current year as i showed above.
AND -- Any Condition goes here...
GROUP BY customer_id
UNION ALL
SELECT customer_id, 0, NVL(SUM(invoice_amount),0)
FROM sales
WHERE invoice_dt BETWEEN ADD_MONTHS(:P_FROM_DATE,-12) AND ADD_MONTHS(:P_TO_DATE,-12) -- This add_months function for the previous year same month.
AND -- Any condition goes here...
GROUP BY customer_id
GROUP BY customer_idNow using the above query you can design the tabular report as you showed the format.
-Ammad
Edited by: Ammad Ahmed on Jul 3, 2010 7:55 PM
added GROUP BY -
Table for Material Quantity and Value for particular month and year
Hi All
My requirement is that for a particular month and year I want to know the stock quantity and stock value for a particular material for a given plant.From which SAP table can I get this data as I want to fetch data for my Y report?
Regards
Satish KumarHi,
You can use MB5B table as suggested earlier.also you can use:
MBEW-VMKUM --> stock for previous month period
MBEW-VJKUM --> stock for previous year period
PLease view these links which migh tbe helpful to you:
http://help.sap.com/saphelp_47x200/helpdata/en/39/55fee3bc6111d4b3960050dadf0791/content.htm
TableStock
Thanks
Nisha -
SELECTION SCREEN FIELD FOR MONTH AND YEAR
Hi All.
We are developing a 'Monthly Sales Tax(payable) Report.
they want the report based on the date(in the selection screen it will come only month and year only.).Depends on that month and year for that select-options ,it will pick up the record.
like if, jan 2005 to march 2006.
then it will pick up from 01.01 .20005 to 31.03.2006 records.
Can any body help me to resolve this.
Thanks in advance,
Regards,
VenkatHi Venkat,
Copy the following code.
DATA : ws_billfrom TYPE dats,
ws_billto TYPE dats.
DATA : mon TYPE fcltx.
SELECT-OPTIONS: s_month FOR mon
MATCHCODE OBJECT zsdhtch_sh_mnth
OBLIGATORY. "o get values for F4
PARAMETER : p_year LIKE bkpf-gjahr
MATCHCODE OBJECT zsdhtch_sh_year
OBLIGATORY.
RANGES : s_date FOR sy-datum.
DATA : ws_fcmnr TYPE fcmnr.
START-OF-SELECTION.
SELECT SINGLE mnr
INTO ws_fcmnr
FROM t247
WHERE ltx = s_month-low.
CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = ws_billfrom
IMPORTING
ev_month_begin_date = ws_billfrom
ev_month_end_date = ws_billto.
s_date-low = ws_billfrom.
s_date-high = ws_billto.
s_date-sign = 'I'.
s_date-option = 'BT'.
IF NOT s_month-high IS INITIAL.
SELECT SINGLE mnr
INTO ws_fcmnr
FROM t247
WHERE ltx = s_month-high.
CONCATENATE p_year ws_fcmnr '01' INTO ws_billfrom.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
day_in = ws_billfrom
IMPORTING
last_day_of_month = ws_billto.
s_date-high = ws_billto.
ENDIF.
APPEND s_date.
WRITE s_date.
You can write your select statement here.
select * from dbtable where date in s_date.
If 'HR_JP_MONTH_BEGIN_END_DATE' is nto there in your server, you can use 'RP_LAST_DAY_OF_MONTHS' in both cases.
Regards,
Susmitha.
Dont forget to reward points for useful answers -
hi
In Selection Screen i have Month and Year as input.....
How to give "F4" Option for both Month and Year?
Regards
Smithahi,
this will help u get the month in f4 help .
similarly u can fill up the itab for year and get that f4 help too i guess.
TABLES: T247 ,
DFIES.
PARAMETERS:P_MONTH LIKE T247-MNR.
DATA: BEGIN OF ITAB OCCURS 0,
MNR LIKE T247-MNR,
KTX LIKE T247-KTX,
END OF ITAB .
DATA : LT_FIELDS TYPE TABLE OF DFIES,
LWA_FIELD TYPE DFIES.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MONTH.
SELECT MNR
KTX
FROM T247 INTO CORRESPONDING FIELDS OF TABLE ITAB
WHERE SPRAS = 'EN'.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'P_MONTH'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'MNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
FIELD_TAB = LT_FIELDS. -
Problem to insert only month and year instead of full date
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'dd/mm/yyyy') and to_date(:TO,'dd/mm/yyyy')
order by b.penjara_id, a.bulan_proses,a.no_daftarHi,anyone can help me how i can insert only month and year from the value that have full date in the database??
for example,the date is 09/18/2012, but i just want to insert 09/2012 as parameter. If i want to insert only one parameter, i can do that..But i have problem when I want to insert two parameters..jeneesh wrote:
Welcome to the forum..
This..?
Assuming bulan_proses is a date without time part
select b.penjara_id, p.penj_lokasi, a.no_daftar, b.episod, b.nama1,to_char(a.trkh_mula_prl,'dd/mm/yyyy') as trkh_mula_prl, to_char(bulan_proses,'mm/yyyy') as bulan_proses,
b.epd, b.lpd
from prl_daftar_proses a, senarai_pesalah b, penjara p
where a.no_daftar=b.no_daftar
and a.episod=b.episod
and b.penjara_id = p.penjara_id
and a.setuju_jplp is null
and a.bulan_proses between to_date(:FROM,'mm/yyyy') and last_day(to_date(:TO,'mm/yyyy'))
order by b.penjara_id, a.bulan_proses,a.no_daftar
i got another problem..
before that.may i know what is the function of last_day? -
Elapse days - calculation from month and year
Duplicate thread ...
coding required for converting month into days
I have Month and year field in my DSO --Year( 2009), Month(4)
I want below logic to calculate -
MTD qty % = (qty * elapse days) / no of days in month
so from the above, I want to know,
1. How can we get the no of days from the above 2 objects (year and month).
2. Elapse days are the days that are over from current date to Ist day of that month.
eg: current date - 04.03.2009 , 1st day of the month - 04.01.2009,
elapse days = 2. (you need to consider all days in the month, not only working days)
so my questions is how can we get, # of days n a month from above 2 fields and elapse days based on the above condition.
also want to know, where can I have the logic in transformations or query level.
please provide your suggestions.
Thanks,
Pra
Edited by: Arun Varadarajan on Apr 5, 2009 10:44 PM
Edited by: Arun Varadarajan on Apr 5, 2009 10:45 PMHello,
I think the sample program below does what you ask: it finds the days in the month (bit of an overkill to use function modules for that) and then computes the QTD.
Note that the internal string representation of a data variable is always YYYYMMDD, regardless of the "externalized" form (e.g. yyyy/mm/dd or dd.mm.yyyy), so this code will work regardless of your custom date format.
Regards,
Mark
REPORT zqty_to_date.
PARAMETERS:
p_date TYPE dats,
p_qty TYPE i.
DATA:
days TYPE i,
n_year TYPE numc4,
n_month TYPE numc2,
n_day TYPE numc2,
qtd(6) TYPE p DECIMALS 1.
START-OF-SELECTION.
n_year = p_date+0(4).
n_month = p_date+4(2).
n_day = p_date+6(2).
PERFORM days_in_month USING n_year n_month CHANGING days.
qtd = ( p_qty * ( n_day - 1 ) ) / days.
WRITE: / 'Days in month:', days,
/ 'Qty to date :', qtd.
*& Form days_in_month
* text
FORM days_in_month USING year month CHANGING days.
DATA: ymod4 TYPE i,
ymod100 TYPE i,
ymod400 TYPE i.
CASE month.
WHEN 4 OR 6 OR 9 OR 11.
days = 30.
WHEN 2.
ymod4 = year MOD 4.
ymod100 = year MOD 100.
ymod400 = year MOD 400.
IF ( ymod4 = 0 AND ymod100 > 0 ) OR ( ymod100 = 0 AND ymod400 = 0 ).
days = 29.
ELSE.
days = 28.
ENDIF.
WHEN OTHERS.
days = 31.
ENDCASE.
ENDFORM. "days_in_month -
Display month and year in dropdown list on selection screen
Hi
Can anyone tell me how to display months and year in a dropdown list on a selection screen?
also please tell me how to get the first and the last dates upon selecting the month and year on the dropdown list.
Month: January Year:2007 .
After selecting the required month and year, the first date and last date i.e '01.01.2007 - 31.01.2007' should be displayed on the right side.
Reward Points assured..
thanks,
ChetanHi..,
<b>
Just copy, paste and execute this program !!</b>
type-pools: vrm.
parameters : p_month(2) type n as listbox visible length 10,
p_year(4) type n as listbox visible length 10.
DATA : W_DATE type d, w_ldate type d.
initialization.
perform user_drop_down_list_fordt.
perform user_drop_down_list_foryr.
start-of-selection.
concatenate p_year p_month '01' into w_date.
call function 'BKK_GET_MONTH_LASTDAY'
exporting
i_date = w_date
IMPORTING
E_DATE = w_ldate
write /: w_date,w_ldate.
build user_drop_down_list
form user_drop_down_list_fordt.
data: name type vrm_id,
list type vrm_values,
value like line of list.
data: t_months type t247 occurs 0 with header line.
clear list. refresh list.
name = 'P_MONTH'.
select * into table t_months
from t247 where spras eq 'EN'.
sort t_months ascending by mnr.
loop at t_months.
clear value.
value-key = t_months-mnr.
value-text = t_months-ltx.
append value to list.
endloop.
Set the values
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
endform.
for year...
form user_drop_down_list_foryr.
data: name type vrm_id,
list type vrm_values,
value like line of list.
clear list. refresh list.
name = 'P_YEAR'.
do 9999 times.
clear value.
value-key = sy-index.
append value to list.
enddo.
Set the values
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
endform.
<b>
Hope this solves ur problem..</b>
regards,
sai ramesh -
Problem in conversion of month and year from R/3 into 0calmonth of BI
Hi,
I have to convert two fields of R/3 Calendar month and year into one field of Calendar year/month of BI.
How can i do this..... i have tried using concatenation formula in transformation rules but its not working and converting 09, 2006 into 06.2009.
Please help me if you guys have any idea.
regardsWhy do you want to combine CALMONTH and CALYEAR ??
CALMONTH will give you both month and year (eg: 09.2007)
you can directly map (R/3)KMONTH to 0CALMONTH(BI). -
Can we modify the pnp selection screen and get only month and year?
Dear Freinds,
I have requirement where i have to modify the PNP selection screen. So with the help of report category and coding in AT SELECTION-SCREEN OUTPUT , i have modified all the fields relating to dates . i.e i have removed all the radio buttons (i.e Today, Current month,current year etc) and finally
i have landed with only Period ( PNPBEGDA & PNPENDDA range) . But i dont want the PNPBEGDA & PNPENDDA range , but i want only is the month and year ( i.e just like the PNPPABRP & PNPPABRJ)
on my selection screen along with the pernr .
i have used the below code to close all the fields except pnpbegda and pnpendda.
AT Selection-Screen output.
loop at screen.
IF screen-group4 = '098' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '092' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '094' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '100' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
IF screen-group4 = '104' .
screen-input = '0'.
screen-invisible = '1'.
ENDIF.
MODIFY SCREEN.
endloop.
i.e on my selection screen i want only month & year combination and pernr -
when iam using the logical database PNP . Could any one please let me know how can i get only mon & year only on my selection screen .
If it is possible please let me know .
Thanks & regards
divya.Hi ,
The requirement is that the user doesnt want to enter the date range i.e for ex: 01012008 to 31012008.
As per the requirement the user will enter only the month and year only . so i on the selection screen
i want only the month and year only . Is there any means i can modify the date period which is there by
default (PNPbegda and PNPendda) on PNP selection screen. Instead of we givign to the user the
PNPBEGDA and PNPPENDA i want is only month and year .
AS already the code has already been written and now they have asked that they want only the month and year on the selection screen.
Please suggest me in this regard.If iam hiding all the buttons relating the dates fields, and now if iam adding the parameters for the month and year it is coming below below the fields pernr , personnel ara and subara , company code , payroll area, employee group of the standard fields of PNP selection screen , there by any body could please suggest me how to change.
regards
divya.
Maybe you are looking for
-
How do I open an additional iTunes account on my MacBook Pro in a foreign country?
I have a iTunes account in America, but now living in Germany and want to purchase items on the German site, can I open an additional account on the same computer? Can you have different accounts in different countries at the same time? I understand
-
How do i disable the drop down menu every time i type suggestions come up
when i open up firefox then type in a site i want there is a suggestion drop down its very annoying as i keep looking up to the screen can i disable it and how cheers
-
in dubai FT,siri are not working in case when we move other country could we activate those feature in that country
-
Reset iPod = videos unplayable, album art gone?
i'm not sure if this is supposed to happen, but every time i reset my iPod (menu and middle button) all my videos disappear from the Video section in my iPod. When i check in iTunes, i can still see the video files, but the little TV icon beside them
-
Quicktime Operation could not be completed when trying to save
I have recently been watching webinars online and have been using Quicktime to record these so I can go back when I have more time to study them and learn from them. I have run into an issue when I go to save my most recent file. I get the error me