A day from previous month

Hi,
Is there any function module to get a day from previous month? I tried FM 'CCM_GO_BACK_MONTHS', but it is not working correctly.
If I give the sy-datum input as '03/30/2007', it is giving the previous month date as '02/30/2007'
Thanks,
Uma.

Try.....
report zrich_0001 .
data: day_from_previous type sy-datum.
call function 'RE_ADD_MONTH_TO_DATE'
  exporting
    months        = '-1'
    olddate       = sy-datum
  IMPORTING
    NEWDATE       =  day_from_previous.
write:/  day_from_previous.
Please be sure to award points for helpful answers to all your threads today, and mark as solved when answered completely.  Thanks.
Regards,
Rich Heilman

Similar Messages

  • Defining last day of previous month in ABAP

    All,
    I am a BW guy and hardly know ABAP. I have a requirement where I have to calculate last day of previous month and use it in the routines of the transformations.
    I have decided to define the Last day of previous month in Start routine and then use the global variable in Transformations to calculate further.
    The logic that i have used is outlined below.
             Define G_DATE in global declaration for further use in Transformations.
    In the Routine section,
            Assign G_DATE to SY-DATUM
            G_DATE + 6(2) = '01' (Replace last to field of date with '01' to establish first day of the current month)
            G_DATE = G_DATAE - 1 (To get to last day of previous month)
    My dilemma is to implement this in ABAP in Start routine of transformations. Please include the exact ABAP code that would be needed in Declarations and Routine section.
    Thanks in advance.

    Hi..,
    Go with the function module: LAST_DAY_OF_MONTHS
    So, Just determine the last month from the sy-datum and then use above function module and pick the last date of the month.
    Thanks,
    Naveen Inuganti.

  • How to find first and last day of previous month?.

    Based on current month, I want to find start and end day of
    previous month.
    For example,
    For august, Start date is July 1st and End date July 31st.
    How can i get first of previous month as start date and last
    day of the previous month as end date?.
    Same way,
    i want to find start date of current month and end date of
    next month.
    Example:
    For august,
    i want to get start date, august 1st and end date : september
    30.
    How can i do this from current date or now().
    I am looking for best and easy way to find start and end
    dates..
    Thanks

    <cfset today = now()>
    <cfset firstOfThisMonth = createDate(year(today),
    month(today), 1)>
    <cfset lastOfNextMonth = dateAdd("d", -1, dateAdd("m", 2,
    firstOfThisMonth))>
    <cfoutput>
    today = #today#<br>
    firstOfThisMonth = #firstOfThisMonth#<br>
    lastOfNextMonth = #lastOfNextMonth#<br>
    </cfoutput>
    Edit - To find the start and end day of previous month, get
    the first of THIS month. Use Subtract 1 month ("m") to get the
    start date. Subtract 1 day ("d") to get the end date.

  • Show data of last day of previous month against any day of current month

    Hi,
    I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
    Any suggestion ???

    You're asking to filter your data set to only include rows between:
    1) last day of the previous month
    2) any day of the current month
    This can be achieved with prompting in OBIEE Answers.
    last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
    In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
    For the 'last day of previous month' , use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    For the current date, use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.

  • Why has my calender lost past inputs from previous months?

    Why has my calendar lost inputs from previous months?

    Hi, Shirvinhurst
    Thank you for visiting Apple Support Communities. 
    This sounds like the days to sync are limiting the past events.  I would recommend changing the days to sync to your preference by going to Settings > Mail, Contacts, Calendars > Sync.  Just in case you need to reference this information, it is located on page 61 of the user guide below. 
    iPad User Guide
    Cheers,
    Jason H. 

  • How to create report which includes records of current month and last 7 days of previous month.

    Hi Experts,
    I need to create a report which includes records of current month and last 7 days of previous month.
    I will get records of current month by this formula :- month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)
    Please tell me how to add the records of last 7 days of previous Month for the same report.
    Thanks in Advance.

    Hi Ajay,
    If you have more than a year data in your database then your formula will return wrong results. ie. If your data consist of 2012,2013,2014 data then below formula will return all 8th month data irrespective of year. So, you need to check year also here
    month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)  and
    Year({PROBSUMMARYM1.OPEN_TIME})=Year(currentdate)
    Now add Abhilash second statement in OR so, your formula should look like :
    (month({PROBSUMMARYM1.OPEN_TIME})=month(currentdate)  and
    Year({PROBSUMMARYM1.OPEN_TIME})=Year(currentdate))
    OR
    Date({PROBSUMMARYM1.OPEN_TIME}) IN [DateAdd('d',-7,Maximum(LastFullMonth)), Maximum(LastFullMonth)
    -Sastry

  • First day of previous month

    Hi,
    I created a data parameter and I want my date parameter default value to be the first day of previous month, the expression {$FIRST_DAY_OF_MONTH()$} is pointing to the fitst day of current month and when I tried {$FIRST_DAY_OF_MONTH()-1$} it is just subtracting a day(thought to go back one month)...Is there way I can point my default value to first day of previous month.?
    Regards

    hmm is BI Publisher in Beta? Are there any workarounds you can suggest me to achieve this?
    I see the user stated that a workaround is possible at RTF template level? How can we achieve this?
    Re: Default date as first of month
    Edited by: user8937215 on Aug 10, 2010 7:30 AM

  • Printing Last Day of previous month

    I need to print Last day of previous month, and the date value is relative to the system date.
    In my previous post i have got the answer to print last day of current month. To print last date in previous month do i need to use RelativeDate? and I am not sure whether I can use RelativeDate for months.
    Raghu

    Right now I have written below formula, and it works fine in all cases like if the current month equals to 01, 03, 05,07,08,10 and 12 and months other than mentioned in above including 02.
    for First day of previous month
    =If (FormatDate(CurrentDate();"MM"))InList("07";"08";"10";"12";"05";"01";"03") Then
    (If(FormatDate(CurrentDate();"dd"))="01" Then
    FormatDate(LastDayOfMonth(RelativeDate(CurrentDate();-1));"MM")"/01/"FormatNumber(Year(LastDayOfMonth(RelativeDate(CurrentDate();-1)));"####")Else
    FormatDate(LastDayOfMonth(RelativeDate(CurrentDate();-31));"MM")"/01/"FormatNumber(Year(LastDayOfMonth(RelativeDate(CurrentDate();-31)));"####"))Else
    FormatDate(LastDayOfMonth(RelativeDate(CurrentDate();-30));"MM")"/01/"FormatNumber(Year(LastDayOfMonth(RelativeDate(CurrentDate();-30)));"####")
    For Last day of previous month
    =If (FormatDate(CurrentDate();"MM"))InList("07";"08";"10";"12";"05";"03";"01") Then
    (If(FormatDate(CurrentDate();"dd"))="01" Then LastDayOfMonth(RelativeDate(CurrentDate();-1))Else
    LastDayOfMonth(RelativeDate(CurrentDate();-31)))Else LastDayOfMonth(RelativeDate(CurrentDate();-30))
    Please let me know any other suggestions.
    -Raghu

  • TS4036 I added Icloud to join my calendar to another person. It erased all history date from previous months. how do I get that data back?

    I added Icloud to join my calendar on my phone to another person. It erased all history date from previous months. how do I get that data back?

    i found the answer to the first part: reboot and keep hold of command+r
    this gave me a list of options
    one of them was to reinstall lion from fresh
    i went for this
    dont know why... but all forum posts i read said u should delete hard disc? theres an option for this
    which is the right option?
    any suggesstion where i go to register new mac would be great
    thanks

  • TAX SUMMARY REPORT: Credit from previous months

    Dear experts, I have a problem in the Tax Summary Report. In this report there is a wrong value in the fiel "credit from previous months". The correct value is "0" but in the report I find another value.
    I print the report of the previous months and there is the same problem (wrong value of credit from previous months)
    SAP B1 A SP00 PL42.
    Thanks
    Paolo

    Create a new user is not a solution to my problem.
    There is a configuration file where SAP B1 stored the data of each user?
    Thanks.
    Paolo
    Edited by: Paolo Orlando on Aug 25, 2009 5:06 PM

  • Wagetypes /561(Claim) and /563(Claim from Previous month

    Hi,
    Please explain the wagetypes /561(Claim) and /563(Claim from Previous month). and thier relevance.
    I know that the difference between /561 and /563 shows the net amount that SAP has reclaimed from the overpayment in a single month.
    What in case these wagetypes occur in case of a LEAVER? Then how this should be dealt with.

    Hi Srijit,
    Thanks for replying.
    My case is of an employee who left the company in June08. His last payroll was run in June.
    Now when the salary of february was processed it came to notice that  Rs388/- was posted into employee suspense account. His salary statement shows Take Home pay as Zero.
    The posting shows the following:
    /552 ( stat net adj)  ( amount)388.00 (credit)
    /561 (claim) (amount)50,390.00 ( debit)
    /563(claim from prev month) (amount) 50,002.00( credit)
    This is the scenario.
    Edited by: dips on Feb 27, 2009 7:32 AM
    Edited by: dips on Feb 27, 2009 7:33 AM
    Edited by: dips on Feb 27, 2009 7:36 AM

  • Formula to subtract current month from previous month

    Hi
    I would like to how to subtract current month from previous month in Crystal 10.  Basically am looking at the variations that between the two month .   I would also like to know the 12 m onth rolling data formula.  Using the same formula, you need to get the difference between the two month.
    Any help on this is very much appreciated.
    Thanks
    Regards
    Cauvery

    Hi Thanks for reponding.
    Though the formula is correct, I don't think it will work out in that way because I have a 12 months rolling data  formula and using this formula  I have to subtract the current month from previous month.
    This the formula that am currently using for 12 months rolling data
    {HPD_HelpDesk.Arrival Time} >= DATEADD ("yyyy", -1, CURRENTDATE)
    Please advise.
    Regards
    Cauvery

  • Data being removed from previous months calendars.

    My
    Data is being removed from previous months calendars

    Go to settings>mail,contacts, and calendars. Make sure the settings for Sync under calendars is set to all events to sync all past events.

  • Can someone please help - I want to sync my icloud calendar with my iphone calendar.  All of my entries from previous months are on my icloud calendar but not my iphone.  How do I get them back on there?

    Can someone please help - I want to sync my icloud calendar with my iphone calendar.  All of my entries from previous months are on my icloud calendar but not my iphone.  How do I get them back on there?  I have corrected my settings for future entries (I think/hope) but want to put the old stuff back on.

    Try this...
    Settings > Mail, Contact, Calendars.  Scroll down to Calendars and set "Sync" as desired.

  • Last day of previous month for data load

    Hi,
    I have to load data from the previous month into the psa and then into an infocube. I was wondering as to how to get the last of the previous month to write a code in ABAP. I will be writing the code at the infopackage level in the data selection. I could load data from the 1st of the previous month to the 1st of the current month. This will be an additional load of 30,000 records for the 1st of every month, since I will be loading 30,000 records everyday, I was wondering if I could limit the load from the 1st of every previous month to the last day of that month. This will be a repetitive loading.
    DATA: CURR_MM(2) TYPE N,
    CURR_YYYY(4) TYPE N,
    CURR_DD(2) TYPE N,
    PREV_MM(2) TYPE N,
    PREV_YYYY(4) TYPE N,
    PREV_DD(2) TYPE N,
    YYYY_MM(6),
    YYYY_MM1(6),
    DATE LIKE SY-DATUM.
    DATE = SY-DATUM.
    CURR_YYYY = DATE+0(4).
    CURR_MM = DATE+4(2).
    CURR_DD = DATE+6(2).
    PREV_DD = 1.
    IF CURR_MM = '01'.
    PREV_MM = '12'.
    PREV_YYYY = CURR_YYYY - 1.
    ELSE.
    PREV_MM = CURR_MM - 1.
    PREV_YYYY = CURR_YYYY.
    ENDIF.
    concatenate PREV_YYYY PREV_MM PREV_DD into YYYY_MM.
    concatenate CURR_YYYY PREV_MM PREV_DD into YYYY_MM1.
    read table l_t_range with key
    fieldname = 'BLDAT'.
    l_idx = sy-tabix.
    l_t_range-low = YYYY_MM.
    l_t_range-high = YYYY_MM1.
    l_t_range-sign = 'I'.
    l_t_range-option = 'BT'.
    modify l_t_range index l_idx.
    p_subrc = 0.
    Mind you this code will load data from 1st of the previous month to the 1st of current month. I just don't want to load that extra "1st day" of current month data as I have 30,000 records everyday.
    Say for example, I want to load data from 1st Mar to 31st Mar or 1st Feb to 28thFeb. How should I modify the above code.
    Is there a formula to get the last date of the previous month. That's all I need. This would solve the problem.

    try this routine. it will return a range from 1st day to end of the month.
    DATA: l_s_range TYPE rsr_s_rangesid,
              E_T_RANGE TYPE  RSR_T_RANGESID.
    DATA: year(4) TYPE n,
          month(2) TYPE n,
          day(2) TYPE n,
        ld_keydate  TYPE sydatum,
          ld_lastday  TYPE sydatum.
      REFRESH e_t_range.
      CLEAR l_s_range.
      year  = sy-datum(4).
      month = sy-datum+4(2).
    *Months with 31 days in year
      IF month = '01' OR
         month = '03' OR
         month = '05' OR
         month = '07' OR
         month = '08' OR
         month = '10' OR
         month ='12'.
        day = '31'.
      ENDIF.
    *check for leap year: provoking sy-sybrc <> 0
      IF month = '02'.
        day = '29'.
        MOVE:   '02'        TO ld_keydate+4(2),
                year        TO ld_keydate(4),
                day         TO ld_keydate+6(2).
        CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
          EXPORTING
            date   = ld_keydate
          EXCEPTIONS
            OTHERS = 1.
        IF sy-subrc <> 0.
          day = '28'.
        ENDIF.
      ENDIF.
    *months with 31 days in year
      IF month = '04' OR
         month = '06' OR
         month = '09' OR
         month = '11'.
        day = '30'.
      ENDIF.
      MOVE: year              TO ld_lastday(4),
            month             TO ld_lastday+4(2),
            day               TO ld_lastday+6(2).
      l_s_range-low  = sy-datum.
      l_s_range-high = ld_lastday.
      l_s_range-sign = 'I'.
      l_s_range-opt  = 'BT'.
      APPEND l_s_range TO e_t_range.

Maybe you are looking for