How to get current fiscal year/quarter/month/week
Post Author: [email protected]
CA Forum: Semantic Layer and Data Connectivity
Hi friends,
I have to calculate
1. current year/quarter/month/week.
2.Previous year/quarter/month/week.
please tell the process to achieve the above scenerio's.
the structure of the fiscal_cal is as follows.
Name Null? Type
TODAY NOT NULL DATE
FISCAL_DAY NUMBER(8)
FISCAL_WEEK NUMBER(6)
FISCAL_MONTH NUMBER(6)
FISCAL_QTR CHAR(18)
FISCAL_YEAR NUMBER(4)
FISCAL_MONTH_WORK_DAYS NUMBER(2)
sample week data is as follows
FISCAL_WEEK
200752
200753
209901
Thanks.
based on ur target database DBMS you can find a built-in functions be used in the universe designer to get the requirment you talked about, like in oracle
to_char(mydate,'yyyy') it will return the year in the yyyy format.
and the same way for the other things you want
to_char(mydate,'q') return the quarter.
w return the week of the month
ww return the week of the year
mm return the month
,, to get the last year
you can use also a builtin functions
like add_months(mydate,-12) that return the same date for the last year, and you can do the same operations as before.
its all related to the DBMS.
good luck
Similar Messages
-
How to get current fiscal year.
Hi Experts,
I am working on Asset Management.I need to get current fiscal year.
I have to enter fiscal year on selections screen which i have to validate that it should not be greater than current fiscal year.
For above i have used following code snippet but i have hard coded variant as 'MK'.
To get variant i was using function '/IBS/RB_FI_GET_FISCAL_YEAR_VAR' but in my selection screen we have to enter multiple company codes. if i will keep this function inside loop then it may give multiple variants.
How to resolve this ?
DATA : l_year(4) type c,
l_date TYPE sy-datum.
CALL FUNCTION '/IBS/RB_FI_GET_FISCAL_YEAR_VAR'
EXPORTING
i_company_code =
IMPORTING
E_FISCAL_YEAR_VARIANT =
EXCEPTIONS
COMPANY_CODE_NOT_FOUND = 1
OTHERS = 2.
l_date = sy-datum - 700.
l_date = l_date + 1.
IF sy-subrc EQ 0.
CALL FUNCTION 'GM_GET_FISCAL_YEAR'
EXPORTING
I_DATE = l_date
i_fyv = 'MK'
IMPORTING
E_FY = l_year
EXCEPTIONS
FISCAL_YEAR_DOES_NOT_EXIST = 1
NOT_DEFINED_FOR_DATE = 2
OTHERS = 3.
IF sy-subrc EQ 0.
IF s_gjahr-low GT l_year.
PRINT Error Message "Entered fiscal year should not be greater than current fiscal year".
ENDIF.
ENDIF.make it simpler by using - DATE_TO_PERIOD_CONVERT
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
I_DATE = SY-DATUM
I_PERIV = L_VARI "Fiscal year Variant - refer to tab T009B
IMPORTING
E_BUPER = L_BUPER " Fiscal Period
E_GJAHR = L_GJAHR " Fiscal year
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
Hope this will solve ur problem. -
Hi all,
I need your help how to write customer exit in my BI query to get (current fiscal quarter) and (current fiscal quarter - 1 ) without user input.
in my query info object is 0CALQUARTER and variable is ZFIS_QTR.
in 0CALQUARTER fiscal quarter stored in 201301,201302,201303,201304 and 201401 format, for current fiscal quarter 201401 and (current fiscal quarter - 1 ) would be 201304.
please replay ASAP to deliver the report to client.
thanks in advance.
-- Rakesh NagpureI am Getting the same error for both the codes that i have written...
Do i Need to write sth else in the code...
Code:
WHEN 'ZVLIVELEASES'.
IF I_STEP = 2.
L_DATE = SY-DATUM.
SELECT * FROM "DSO_ACTIVE_TABLE"
INTO TABLE ITAB_LL where "EXPIRY_DATE" > L_DATE.
LOOP AT ITAB_LL INTO WA_LL.
CLEAR l_s_range.
l_s_range-sign = 'I'.
l_s_range-opt = 'EQ'.
l_s_range-low = WA_LL-"EXPIRY_DATE".
APPEND L_S_RANGE TO E_T_RANGE.
ENDLOOP.
ENDIF.
Error: Error for variable in customer enhancement ZLIVELEASES -
How to get last 35th fiscal year periof form current fiscal year period
Hi,
I want last 35th moths fiscal yesr periof from current fiscal yesr periog.
E.g. current month FISPER - 2010011 so required FISPER is 2010011 - 35 = 2007009.
Please help if any one know about it.
Marks will be provided.Hi,
Drag Fiscal year/period characteristic in the query and restrict it .
In the variables , you will find SAP delivered variable which willl give you current fiscal year/period.
Create range on the using this variable and give offset of -35.
For eg.
the name of the variable is 0PF_CP, then create range in the following way.
Lower range will be 0PF_CP - 35
and higher limit will be 0PF_CP.
So the range would be 0PF_CP-35 : 0PF_CP.
This will give you the last 35 fiscal year/period.
- Jaimin -
Variable to display data from Current Fiscal Year to the MONTH entered
Hi Friends,
In the Quey Designer I require a CHARACTERISTIC VARIABLE for the 0CALMONTH which should have the following features:-
1.Input Month(e.g JUN 2008)
2.Mandatory
3.Ready for Input
The query should show the following OUTPUT:-
The data should be displayed from the CURRENT FISCAL YEAR to the value of the Input MONTH entered.
e.g For Input = DEC2008
Output = from APRIL 2008 to DEC2008.
Do we have a standard variable for this or we have to go for a Customer Exit??
Thanks in Advance!!!
VivekHi,
Create a customer exit as follows.
WHEN 'ZCMTD'.
you variable name
data: ZCMTD_LOW like sy-datum.
ZCMTD_LOW = sy-datum.
ZCMTD_LOW+4(2) = '04'.
*replacing last two symbols (month) in the current month with '04'
CLEAR L_S_RANGE.
L_S_RANGE-LOW = ZCMTD_LOW.
*initializing low interval limit
L_S_RANGE-HIGH = SY-DATUM.
*initializing high interval limit
L_S_RANGE-SIGN = 'I'.
*defining interval as inclusive
L_S_RANGE-OPT = 'BT'.
APPEND L_S_RANGE TO E_T_RANGE.
ENDCASE.
Thanks,
Ashok -
How to design extractor can have only current Fiscal Year data.
Dear Experts,
I require a full upload DSO , which can have only current fiscal year data . I have created view putting there certain conditions for minimising the data size. How i can restrict it , to have only current fisacal year data for YTD reports. It would be daily uploaded.
Should i created Data Source based on function ?
Regards,
Anand Mehrotra.while extracting the data from source you can set the filters at the info package level so that it will not extract the previous years data.
In the data selection tab in Info package enter the current fiscal year and schedule the IP it will extract only the current year data.
next execute the DTP to load data till DSO.
the data is restricted in the infopackage level before entering to PSA so there is no need to write any routines in the DSO level.
Edited by: prashanthk on Feb 1, 2011 12:45 PM -
How to get current month and last month dynamically??
how to get current month and last month dynamically
like
month = getCurrentMonth();
lastmonth = getcurrentMonth() -1;
please help
thankshi :-)
/* depracated but can be still useful */
java.util.Date dtCurrent = new java.util.Date();
int month = dtCurrent.getMonth();
int lastmonth = dtCurrent.getMonth() - 1;
System.out.println("* " + month);
System.out.println("* " + lastmonth);
/* better to use this one */
Calendar cal = new GregorianCalendar();
int imonth = cal.get(Calendar.MONTH);
int ilastmonth = cal.get(Calendar.MONTH) - 1;
System.out.println("*** " + imonth);
System.out.println("*** " + ilastmonth);
regards, -
Hi,
Is there an oracle function that returns the current fiscal year in format (2012/2013)?
ThanksHi,
sliderrules wrote:
Is there an oracle function that returns the current fiscal year in format (2012/2013)?That depends on what you mean by fiscal year.
If a fiscal year begins on April 1 of every calendar year, then
ADD_MONTHS ( TRUNC ( ADD_MONTHS (d, -3)
, 'YEAR'
, 3
)is the beginning of the fiscal year that contains DATE d. The "magic number" 3 reflects the fact that the fiscal year starts 3 months after the calendar year.
If you want a string like '2012/2013' that shows the calendar years when the fiscal year begins/ends, then use the expression above to get the beginning date, use EXTRACT to get the year as a number, and then add 1 to it.
If you're just interested in the year number, as in your message, then you don't need the outer ADD_MONTHS or TRUNC; you can just EXTRACT the year from <tt>ADD_MONTHS (d, -3)</tt>
You might consider a user-defined function for this. It will be slower than doing it in pure SQL, but it will be a lot more convenient. You don't have to use the function in situations where performance is an issue.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ {message:id=9360002}
Edited by: Frank Kulash on Mar 14, 2013 11:30 AM -
Current fiscal year period in BEx
Hi,
I have a requirment. i have a BEx query, that query is a source of APD and data is store in direct DSO.
i need to run this query every month and load current fiscal yer period data into the DSO.
i need BEx variable to filter the data for current fiscal year period.
I have fiscal year period char. in query definaton
Please help me to get this.
Thanks.
Edited by: Pria Gupta on Nov 24, 2011 2:18 AMUse variable 0F_CUFPE Current Period of Fiscal Year (Formula Variable)
Re: how to get default value fiscal year period in Variable
Regards,
Sushant -
Reversal of Last Fiscal year asset in current fiscal year
Dear SAP experts
Asset has been booked in last fiscal year (jan2006) depreciation also posted till this fiscal year last month (2007 June)
Asset value-70000 (invoice value)
Accumulated Depreciation-33753.42
Asset net book value as on date- 36246.58
With same information one more asset also booked by mistake, so my client want to reverse any one of them asset with depreciation (which has booked in last fiscal year)
I tried with asset credit memo (T code ABGF); it is picking up only asset net book value (36246.58) not accumulated depreciation (which is already affected in Accumulated GL account).
Can you tell me is there any way to solve this problemHi Chaitanya,
If you have already acquired and depriciated the asset in previous fiscal year and closed the books and published the results why do you want to reverse it now. from accounting point of view also how would you show the entry for reversal of depriciation.
Any how the acqusition and depriciation posted in previous fiscal year can not be reversed in current fiscal year it can be reversed only in previous fiscal year. as per SAP standards you can write up the asset if you have wrongly depricaiated the asset.
Or else you can retire the asset with revenue which will give the same financial impact as you are expecting.
Thanks & Regards
Sree -
Enable fiscal year/quarter selection in a query
Hello all,
I want to have an characteristic fiscal year/quarter similar to fiscal year/period (0FISCPER) in my query. Unfortunately I can not find such a characteristic in the time infoObjects in my cube and in the administrator workbench.
Our Fiscal year starts in July. So the first quarter is July - September. The BW release is 3.5.
How canI enable a fiscal yearquarter selection in my query?
Any ideas would be great.
Thanks upfront and Best regards,
Stefanos from Munich/Bavaria/GermanyStefanos ...
A couple of options for the same :
1. Have 0FISCPER in your cube and map the same to the custom characteristic in the update rules.
2. Have the custom characteristic in the cube in a separate dimension
3. If you have the same in the cube - have a variable against that and execute your query...
By doing the above you can get the same in the query.
Arun
Assign points if useful -
How to set the fiscal year period as default in variables
Hi All,
How to set the fiscal year period as default it shoud take previous period when the report is executed.
And also I need to do the same changes in reporting agent.
Could you please any one help me.
Points will be given.
Thanks!
Best regards,
Ajay.Hi Ajay,
Create a customer exit variable.Write the code in the include 'zxrsru01' using system date.
take the system date from the system date variable and using that you can get the current fiscal year period.use this value and using string commands, you can get period.
subtract 1 from this value.Using this you can get the previous fiscal period..
Please let us know, if you need the coding part
Hope it helps
Thanks,
Teja -
Current Fiscal year/Period (0FISCPER)
Hello
I am using 0FISCPER in a stk query. In that I want to restrict this Char. by Current Fiscal year/Period. But I cant find ant SAP exit variable for this. How to restrict the query by Current Fiscal year/Period??????
Pls help. urgent.You can create a variable with customer exit and use this in your query for your purpose.
to get the current FISCPER you can use RSARCH_DATE_CONVERT Function Module in Customer Exit.
based on your system date this FM will calculate current FISCPER value -
I would like to display current fiscal year always on variable screen
Hi
I have requirement in which I would like to display the current fiscal year on variable screen in BI Report.
we have a standard variable however the sap exit to display the current fiscal year is not shown...
Can any one tell me, how to proceed in this case.
Thanks
ChetanHello,
For I-step = 1, use the function module DATE_TO_PERIOD_CONVERT.
here for IMPORT use i_date = sy-datum and i_periv = ur fiscal variant.
The output is e_buper contains fiscal period and e_gjhar contains fiscal year.
The use concatenate to join fiscal year and fiscal period to the variable low value.
Regards,
Shashank -
Asset write off in the current fiscal year.
Hi Experts,
I want to write off an asset in next 4 periods of the current fiscal year 2007. For example:
Asset 11000
APC value: 10000
APC Date: 01.01.2005
The useful life will end in fiscal year 2008.
The book value left at the begining of the current fiscal year 2007 Rs. 4000.00
In the current fiscal year this asset has already been depreciated for previuos 3 periods.
Now Business wants to write off ( fully depreciated ) this asset in next 4 periods equally and then if the book value and tax value is nil, they want to scap the asset.
Now can you please tell me how to make this happened. Its very urgent. If you need any more information, most welcome.
Rgds,
BABAHi,
You would have to set the asset to manual depreciation(Depr.Key MANU)
and generate a posting via ABMA for each of the periods.
Kind regards
Maybe you are looking for
-
Display Image in Power View and Power BI
Hi all, I need to create a report in power view where i need to display images in tile. I have found one solution to do so, to store the images as a binary data in data model table using the following link http://www.sharepointanalysthq.com/2014/09/a
-
How do I change the printed text size.
How do I change the printed text size? This happens on everything I print out. The text is so small I can just about read it. I use a magnifying glass. Please help. Thank you.
-
Hi, I was wondering will OS X ever support DTS-MA and TRUE-HD? I asking this because i want to setup a Mac Mini as HTPC with Plex. No support for DTS-MA and TRUE-HD is to my knowledge a OS X limitation. Can somone answer this question? Thank you.
-
How do I use AirPlay so that my iPad is linked to my tv? I have turned on home sharing on my mac and can access the mac but can't access my iPad and iPhone, they are all on the same wireless network and I tunes account but the ikon for AirPlay doesn'
-
How to replace system fonts with type 1 version
Can system font Helvetica be replaced with the PostScript Type 1 (Older) Version? Can a system font be deleted? System: iMac 2012, OS X 10.8.2, Output Device: PostScript Level 1 Imagesetter We are trying to pring Helvetica to a PostScript Level 1 dev