Getting Last Month End date
Dear Experts,
I want the following result. I have a date parameter. I want to
get the last / end date of the previous month
for any given date which the user inputs.
For ex:
If user puts the date 15.06.2008
then i want to get the previous month end date i.e. 31.05.2008.
The reason being i am creating a program for updating Opening and Closing Stocks of every month in a ZTABLE. The user will put the date in the parameter and system will bring the closing stock of previous month and then calculate for the current month.
I hope i am not complicating matters too much....
Basic funda is to arrive at the end date of the previous month for any date which the user puts.
Please help me... it is mission critical..
Thanks & Regards,
Jitesh M Nair
hi,
use this to get last month end date.
ex:
data: d2 like sy-datum.
d2 = sy-datum.
d2+6(2) = '01'.
d2 = d2 - 1. "prev mnth last date
write:/ d2.
Similar Messages
-
Last month end date based on current date
Hi,
How to show last month end date based on the current date.
Eg:
Current date = "08/26/09"
Var- Last Month End Date = "07/31/09" etc...,
Please help me how to get it...
Thank You!Good to hear that it worked for you. but not for me.
I tried like this:
1st::
1. var1= ToDate("06/30/09","MM/dd/yyyy")
2.Var2= RelativeDate([Var1];-DayNumberOfMonth([Var1]))
result: 5/30/09
2nd:
RelativeDate('6/30/2009';-DayNumberOfMonth('6/30/2009'))
result: 5/30/09
Am working on SAP OLAP cubes.
Please help me where am going wrong....
Thank You! -
Need to get data till last month end by using Calday
Hello SAPiens,
Could anybody please guide me how to get the data till last month end date.
Example: If i m executing a report in 05 November 2009 then i should get all the details of last month till last date of the Calmonth. thanks in advance.
Regards,
Sandy.SHi,
you can do the following:
Create a Customer Variable for Calday
EXIT_SAPLRSOO_001 ---> Include ZXRSRUO1 write the code for the variable created above
DATA : date TYPE sy-datum.
date = sy-datum. "Today
date+6(2) = '01'. "First day of this month
date = date - 1. "Previous day before first day of this month = last day of last month
Or
you can you many function Modules
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS
FKK_LAST_DAY_OF_MONTH
OIL_LAST_DAY_OF_PREVIOUS_MONTH
Santosh -
Function Module to get BEGIN and END date of a month?
Hello everybody,
Is there any function module to get BEGIN and END date of a month
GIVEN EITHER THE CURRENT SYSTEM DATE or MONTH?
Regards,
Sanghamitra.A.hi
CALL FUNCTION 'PA03_PERIODDATES_GET'
EXPORTING
f_abkrs = p_abkrs1
IMPORTING
f_permo = wf_permo
f_current_begda = wf_begda
f_current_endda = wf_endda
CHANGING
f_current_period = wf_pabrp
f_current_year = wf_pabrj
EXCEPTIONS
pcr_does_not_exist = 1
abkrs_does_not_exist = 2
period_does_not_exist = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
this is the function module to get the first date and last date of a particular month
if u have any doubts ask
regads
karthik
reward points if useful -
Need formula in my subreport to get last month date - CR XIr2
Post Author: olesco
CA Forum: Formula
I need to pass the value (#of units) from the subreport to the main report u2013 I know how to do that but my problem is I donu2019t know what formula should I put in my subreport to get last month date.
Both main report and subreport have a date parameter (Field link - {?DatePrompt}. What I need is when I fill in the current month date to the main report the subreport should process the last moth date.
Main report u2013 Date Range (2007-10-1) (2007-10-31) - result #of units = 22
u201CRecord Selection Formula Editor
DateRecd = {@DatePrompt} [i.e. current month]
Subreport u2013 should have data from last month - result #of units = 25
u201CRecord Selection Formula Editor
DateRecd < {@DatePrompt} [last month] ??????
There are 22 3 units this month and 25 units last month.
Any help is greatly appreciated.Post Author: SKodidine
CA Forum: Formula
DateRecd in dateadd('m',-1,minimum({@DatePrompt})) to dateadd('m',-1,maximum({@DatePrompt})) -
FM to get start and end date when given month
Hi all,
can anybody help me if there a FM to get start and end date when given month like 01 for jan.
Thanks in advance
SahityaHi,
Check this Function Module
HR_JP_MONTH_BEGIN_END_DATE
here if you r giving the month u wil get the start date and the end date.
Hope this helps you.
Thanks & regards,
Y.R.Prem Kumar -
We need to show month end date for a given date in a table.
Say the date is '03-25-2008', then output should give me '03-31-2008'.
I want to create a new derived column like this in rpd.
I believe variables cannot help me here, because we will need to have month end date for each value the date column will hold.
Please let me know how can we achieve this.Hi....
Better go for creating view by writing the direct function.
if db is: ORACLE, then LAST_DAY(<date column>) is the function to get the last day of the date column.
but in creating view you also fetch the key column of the particular date column table and the above function too... it's like
select key column, LAST_DAY(<date column>) as LastDate from TableNameA
now you create a physical join between the TableNameA and the view, which maintains 1to1 relation ship.
So that we can use the LastDate column in our BMP layer in particular TableNameA logical table.
I think it works out probably....
If not sorry...
Thanks & Regards... -
How Get last five quarters data using ssrs expression
Hi All,
i have an ssrs report where i have to get last five quarters data and also last five months data when i select quarterly/monthly parameter.....
is there any possibilty that we can get this using ssrs expression
any help please.........Hi Mr.SMK,
According to your description, there is an SSRS report, you want to create a parameter, when you select quarterly, data of last five quarters will be displayed. If you select monthly, data of last five months will be displayed. If that is the case, please
refer to the following steps:
1. In design surface, in Report Data pane, right-click Parameters and click Add Parameter.
2. Type parameter name and prompt, set Data Type to Date/Time.
3. Click Available Values in left pane, select Specify values.
4. Click Add button, in Label text box, type Quarterly, then click (fx) button and type the expression like below:
=DateAdd("q",-5,Today())
5. Click Add button, in Label text box, type Monthly, then click (fx) button and type the expression like below:
=DateAdd("m",-5,Today())
6. Right-click the dataset used to retrieve data for the report and open Dataset Properties dialog box.
7. Click Filters in left pane, click Add button, select Data from Expression drop down list, set Operator to >=, in Value text box, type [@ParameterName].
The following screenshots are for your reference:
If you have any more questions, please feel free to ask.
Thanks,
Wendy Fu
Wendy Fu
TechNet Community Support -
Previous month end data for report
Hi expert,
I have to calculate previous month end data for my report.
let say if user select 15 oct then he should be able to see 30 sept data.
I have calander prompt.
Thanks,Hi,
Use presentation variable in date prompt.
Apply sql filter(covert to sql) on report as date_column= TIMESTAMPADD(SQL_TSI_DAY,-DAYOFMONTH(date 'presntation_variable'),date 'presentation_variable')
Refer : How to get LAST_DAY in obiee
Regards,
Srikanth -
Transformation routine to get last month value
Hi experts,
I am trying to write a routine in a transformation to get last months value from another dso.
Here is my code:
Data:
zamnt type F,
zmonth type c length 6.
zmonth = sy-datum+0(6).
select sum( /BIC/ZAMNT ) into i_amnt
from /BIC/AZDSP00700
where CALMONTH = zmonth -1.
RESULT = zamnt.
I get an incorrect expression "where CALMONTH = zmonth -1." because it does not understand "-1"
Can anyone help me?Hi Odd Hilt,
Please confirm CALMONTH format is yyyymm or something different.
If CALMONTH format is yyyymm.
try following code
zmonth = sy-datum+0(6).
ZMONTH1 = ZMONTH - 1.
select sum( /BIC/ZAMNT ) into i_amnt
from /BIC/AZDSP00700
where CALMONTH = zmonth1.
RESULT = zamnt.
Thanks,
Chandra -
Last month with data - BEx variable
Hi guys,
I am using in the query the char 0CALMONTH to restrict the KF amount, just to get the last month of data that was loaded in the infocube. I tried with content variables but none of them are working. I used 0CYMONTH or 0CMLMON.
the only thing that I want is to get from the cube always the last month with data that was loaded.
Do I need to create a customer exit? does anyone has the code to give me?
any help¡?
thank u.
E.V.Hi,
two alternatives:
VarExit: perform a select statement on your cube joined with your time dimension; or even directly on your time dimension something like:
SELECT MAX(SID_0CALMONTH) FROM /BIC/D<cube>T.
This will give the last CALMONTH with posted data in absolute (not considering your query selection)
<i>Replacement path variable based on a query: create a query which has to return one record an 0CALMONTH in the columns. Put a TOP1 condition on one of your KeyFig. In your original query restrict 0CALMONTH with a variable of type replacement path on the TOP1 query. The advantage of this alternative is that you can get the last CALMONTH posted with data RELATIVE to your query selections if you move your variables input from the user to the TOP1 query...</i>
Sorry, the above won't work it out; I just has the same requirement and implemented the varexit reading the time dim table.
hope this helps....
Olivier.
Message was edited by:
Olivier Cora -
Delivery Block at PGI level based on GI date and Month end date
Business need a check on delivery processing based on the Planned GI date, Month end date and transit period. This transit period is a custom field and dependent on customer. Also it is not maintained anywhere in system. Business store it in some excel format.
The logic needed is: For any given month, the delivery order MUST be goods issued in the same month, i.e. once the order is delivered, the Post goods issue should ONLY be allowed if and only if , the PLANNED GI date ( as maintained in delivery ) + transit time ( at customer level ), falls within the month end date. If not, a block should be applied at PGI and only authorized personnel should be able to release that block.
Also, there will be no check at invoicing VF01 level. Once the PGI blocked is removed, there will be no check on invoicing. The month end date may vary month to month and need to in combination of Sales Org / Plant as mentioned
In addition, the business need an exception report where the information of releasing the block should appear for release date, user id of the responsible person, time sales order no etc. and it should be downloadable.
We can have a custom table to maintain the month end day in given combination.
But I need your expert inputs as-
1- Can we add this transit period in at customer master data as it is dependent on customer and there are huge no of customers for the sales unit? If not, then how to maintain it; may be a z table?
2- Based on this logic, what should the code/logic to be written for block at PGI.
3- How to control the authority check for removing the block.
4- The source fields for exception report.
Pls revert accordingly.
Many thanks in advance.Hello,
Please refere the answers to your questions:
1- Can we add this transit period in at customer master data as it is dependent on customer and there are huge no of customers for the sales unit? If not, then how to maintain it; may be a z table?
You can either use some un-used Feild in Customer Master or maintain a Z-Table. I believe maintaining a Z-Table would be easy as you have huge number of Customers. You can also write a dmall program to Pick the Customer-wise transit dates from a excel file & store in Z-Table.
2- Based on this logic, what should the code/logic to be written for block at PGI.
You have explained the requirement well in your thread, you need to explain the same to your ABAPer & Basis person & they would do the needful.
3- How to control the authority check for removing the block.
Basis person would create & assign a Z-Authorization object which the ABAPer would use in his program.
4- The source fields for exception report.
Once you do the above development, your ABAPer will easily pick the required feild in Report as he has already used all the feilds somewhere in his development.
Hope this helps,
Thanks,
Jignesh Mehta -
how to display month end date for every month by default?
hi,
chk this code.
by default it will show the begin and end date in select option.
the similar think u can adopt.
check this sample code...
tables: mkpf.
data date like sy-datum.
data date1 like sy-datum.
select-options: s_date for mkpf-budat.
initialization.
CALL FUNCTION 'HR_JP_MONTH_BEGIN_END_DATE'
EXPORTING
iv_date = sy-datum
IMPORTING
EV_MONTH_BEGIN_DATE = date
EV_MONTH_END_DATE = date1
s_date-option = 'EQ'.
s_date-sign = 'I'.
s_date-low = date.
s_date-high = date1.
append s_date.
rgds
anver
if hlped mark points -
What is the table name for getting Last Receipt & issue date of material?
Hi Friends,
What is the table name for getting Last Receipt & issue date of material?
*Case 1:*
Here, I am running report in May 2008. But, if there is no goods receipt for the respective material since last 13th March 2007.
Then in this case Last goods receipt date should be 13th March 2007.
Please guide me.
Regards
SivaI checked MSEG table. But, I didn't find any field for date.
Can you tell me field name.
Regards
Siva -
What is month end data from mbew?
I have a report that shows valuated stock qty and value that needs to be filtered based on Month End data. (MARD, MBEW).
How to code this filter "Month End data"?MBEWH and MARV are validation points for this. look at MB5W or report J_B1BL07
Maybe you are looking for
-
Restoring Aperture Library from Vault
Hi all, I hope someone can help. I recently had my 'Drobo' die on me as two discs failed at the same time. I also have a copy of my Aperture Library backed up in a Vault. I have carried out a 'Restore from Vault' and my new external HD shows 1.5T
-
XSLT Mapping - replacing attribute value of a specific node
Hi, I want to replace the value of an attribute for a specific node. Can you please tell me how this can be achieved using XSLT coding? The input file is as follows: <?xml version="1.0" encoding="UTF-8"?> <GovTalkMessage xmlns="http://www.govtalk.gov
-
IW42 does not show goods movement at opearation level but at header level
Hi Gurus, If you add the goods movement using IW41, it stores it correctly against the operationa and shows in GI mat doc and in doc flow under opearation but the same does not happen in IW42. is there a way to do this in IW42 so that GI mat doc show
-
Music store not found !!
I bought a new nokia asha 311 it was working perfecty. But after i updated my software the nokia music store was not found anywhere in my phone ... How can i get my nokia music store back ???
-
Running Premiere for Windows on a BootCamped Mac - any experience?
Has anyone had experience with editing video in Premiere for Windows on a Mac running Windows via BootCamp? Are there significant problems, or is it a breeze? Message was edited by: tzikeh