FM for the last date of the previos month

Hi folks
my requirement is if we enter the calendar month say YYYYMM in the selection
screen. it has to get the previous month last date in the format DDMMYYYY
For eg.,  selection screen input  200704
            required output : 31/03/2007
Is there any standard function module.
please urgent
Thanks in Advance
Rao

Hi,
Please try this.
data: wa_idate like sy-datum,
      wa_odate like sy-datum.
wa_idate(6) = p_date.
wa_idate+6(2) = '01'.
wa_odate = w_idate - 1.
OR
call function 'RP_CALC_DATE_IN_INTERVAL'
  exporting
    date      = wa_idate
    days      = 0
    months    = 1
    signum    = '-'
    years     = 0
  importing
    calc_date = wa_odate.
write: / 'Last date of the previous month: ', wa_odate.
Regards,
Ferry Lianto

Similar Messages

  • Creation of a Query to show the values for the current month and the last 12 months data.

    Dear All,
    Good day!
    I have to create a Query with the below requirement.
    I have to create a Query to show the values for the current month and the last 12 months data.
    Can you please guide me how to achieve this ??
    thank you,
    Regards,
    Hema

    Hema
    explain the exact problem..? as you mentioned you want to create query to show values for current month and last 12 months.. so I think you want to show values for 12 months from current data.. you can achive this by multiple way..
    you can have selection screen and field with date .. and restrict based on system current date and 12 months before or you can handle this at your target.. .. I mean there are multiple ways to restrict data by date range..
    for some more hints..
    http://www.forumtopics.com/busobj/viewtopic.php?t=34393&sid=7fba465d0463bf7ff5ec46c128754ed6
    http://businessintelligence.ittoolbox.com/groups/technical-functional/cognos8-l/how-to-display-last-12-months-in-report-based-on-todays-date-3231850
    http://scn.sap.com/thread/3217381
    search on SDN you will get many other ways..
    Thanks,
    Bhupesh

  • How to set the filter on a report to show the data for the Current Month

    Hi all,
    I am working on a report, which currently has this filter: Date First Worked is greater than or equal to 10/01/2010. This reports show the data for the current month, so at the beginning of each month we have to remember to change the date on the filter.
    Does anyone know what the criteria should say, so that it automatically changes and shows the information for the current month, without us having to go in and change anything?
    Any help would be greatly appreciated!
    Thanks,
    AA

    You need to add a session variable to date fir worked assuming that this is a date field.
    To do this open up the filter on the field then at then press add Variable then "session" and enter the following CURRENT_MONTH into the Server Variable section.

  • I've never dropped my phone for the 7 months that I've had it but last night I was at a park and when I sat down at a table, my phone as in my pocket and I heard a pop. I took my phone out and the entire screen was cracked. what should I do?

    I've never dropped my phone for the 7 months that I've had it but last night I was at a park and when I sat down at a table, my phone as in my pocket and I heard a pop. I took my phone out and the entire screen was cracked. what should I do?

    Probably not, since user-caused damage isn't covered by the warranty. But you can take the iPhone to an Apple Store and see if there's anything they can do for you. A phone company store will not service your iPhone at all, to the best of my knowledge.
    Regards.

  • Can we run CK40N for the past month?

    Hi All,
    One of our users forgot to do the cost estimate for the month of May, that's why when he run CK40N (June 1), the prices went to future price, (i think because our MM is still May). I have some few questions and hoping for your positive feedback.
    1.) If we open the June period, will the future price became present price? or we need to run again CK40N?
    2.) Can we run CK40N for the past month of May? Reason is, we would like to capture the prices of Material last May.
    Please advise.
    Thank you in advance.

    Hi Tina,
    CK40N Meant for creatting cost estimates for the product and estimation is some wht which you create for future or current period. It is not possible to run ck40n for the past period.
    Now since you said that period june is not opened in MM. you can not release the price i.e.ck40n for june. check the details fo costing dates you have put in the dates parameters in ck40n. If you have run ck40n for june  then after marking the price system will set the price as a future price and same prices become the current price once you release the price. So if  you r executing ck40n  for june and june is not opened , you can not release the price. First u open the period june then execute the release functionality future price would automatically become the current price for  JUNE.
    Regards / Ashok verma

  • Returning Records Only for the Current Month

    Hello,
    I have a query that returns records for the current week and I would like to extend it to return records for the current month.
    where TRUNC (START_DATE) < NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sat') + 1
    AND TRUNC (END_DATE) > NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sat') - 7
    I have two date fields, the first is called 'Start_Date', the second is called 'End_Date'. I would like the query to return all records for the current month including those that may begin prior to or finish post the month as events can begin in one month and end in another. Does anyone know how this is done in a 'Where Clause'?
    Kind Regards,
    Steve Welch

    Actually LAST_DAY(ADD_MONTHS(TRUNC(sysdate),-1))+1 gives you the starting day of the current month, and LAST_DAY(TRUNC(sysdate)) gives you the last day of the current month.
    So the where be
    WHERE TRUNC(START_DATE) >= LAST_DAY(ADD_MONTHS(TRUNC(sysdate),-1))+1 OR TRUNC(END_DATE) <= LAST_DAY(TRUNC(sysdate))
    Start Date >= 1st Day of Month OR End Date <= Last Day of Month, meaning either date is within the current month.

  • Depreciation for the 1st month

    Dear all,
    In my client place, the go live happened on 01.04.2008. The asset transfer date is 31.03.2008. When I run afab, I am unable to calculate depreciation for the  1st month. The 1st month depreciation is getting added to the 2nd month. But i want the 1st month dep to be showed seperatly. Please suggest me how the issue can be solved.
    Thanks & Regards,
    A.Anandarajan.

    Hi can you have a look in the folowing tables with SE16 and there you can see the values posted for the depreciation:
    tabel TABA, I think no values in
    tabel T083D, I think that there in is a values (I hoop not) what is this value?
    When you set AM and transport it and have already run a depreciation run it is possible that this value is transported.
    When it is only period 01 then pehaps you can take the decission to do an unplanned depreciation run in period 02 (values fromperiod 01 and 02). In all cases you can do this as a test run
    Paul

  • Day wise Closing stocks for the given month

    Hi,
    Please suggest me your valuable ideas for Closing Stocks Calender day wise for the given month.
    Ex : User Input 03.2013 , now report has to show daywise closing stock like below
                                            01.03.2013    140 MT
                                             02.03.2013     150 MT
                                              31.03.2013    230 MT.

    I like recursive with clause B-)
    with rec(StaV) as(
    select extract(day from date '2011-01-01')
      from dual
    union all
    select StaV+1
      from rec
    where StaV+1 <= extract(day from last_day(date '2011-01-01')))
    select ListAgg('''' || to_char(StaV) || '''',' ')
           within group(order by StaV) as days
    from rec;
    DAYS
    '1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' '29' '30' '31'

  • Posting Depreciation for the previous months

    HI Experts,
    We got new asset  AS100SA  capitalized on 28.02.2013 (Fiscal Year Period 4  2014 )  and we want to start depreciation  this  asset
    start from  Feb 2014 (Fiscal Year Period 4 2014),
    We have run the  depreciation  for all asset in current Month ( Period 5 2014) , when we try run the  depreciation for new asset  AS100SA
    for the previous months in the Current Period , system prompt error msg : "Period  4 is already posted".
    Asset Master Data
          when I view the posted values Tab in the Asset Explorer (AW01N), system is showing the planned values beginning period 5 (Fiscal Year =  March 2014)  
           AFAB - Depreciation Run
           Period 4 (Previous Month for new asset)
          Error Message 
             kindly advise on this issue. thanks in advance.

    Hi Ginee,
    Radio button planned posting run can only be choose once per period and when you choose planned posting run you should not specify your asset number.
    As for your case, you can run the depreciation (AFAB) by choosing the repeat button (specify your asset number) since you already done the planned posting run for period 4 and after the depreciation posted you can check the posted value tab in AW01N again, system will show the posted value in period 4.
    Ex : asset acquisition : 01.01.2014, in AW01N it start with period 2 but the depreciation start from period 1.
    run AFAB with this parameter
    AW01N after AFAB
    Regards,
    Lelyana

  • Filter for the current month

    Hi all,
    Our client wants to see the report for the current month whenever he opens the report. We have a field called date which shows the date when PO was created in the format of mm/yyyy and mmm yy(JAN 2004 or JAN 2007. How should I create a filter report or Drill not Query to filter the data for the current month only.
    Regards,
    BOB

    Bob,
    filter the data for the current month only.
    It will work best setting up a filter at the Universe level.  You don't mention the database vendor, but for instance if it was SQL Server you could use something like this:
    select convert(char(11),getdate(),101)
    Essentially you'll take the current date and modify it to conform to the MMM/YYYY format....
    thanks,
    John

  • Want to display records for the specified month only

    Hi all,
    In my report I am displaying records for the specified month only.
    I am able to display it in range of the dates, but i want to display name of the month at the top of page.
    e.g.
    i am giving range like
    01.04.2008 to 30.04.2008
    then, it shoud display April, 2008.
    Thanks & Regards,
    Sandip Sonar

    Hi,
    Ru using alv grid?
    Use following FM to get month in words.
    and then using TOP-OF-Page event print the month.
    DATA X_MONTH(11).
    CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
         EXPORTING
           INPUT         = SY-DATUM
         IMPORTING
           OUTPUT        = X_MONTH.
    Regards,
    Dhan

  • How to find entries for the particular month

    hi  all,
    I have a table ZTOS4 where i store the trips, trips created timestamp.
    in my selection screen , i give the month as parameter.
    now i need to select the trips created for the select month. how can i put the select query???
    select trips timestamp
    from ztos4
    where timestamp = month ??????? (as timestamp is date and time and month is 01,02,03,....12)
    how to put the where condition?????
    points will be rewarded
    thanks in advance

    Hi jayasree muthaiyan,
    USE LIKE keyword in where condition of your select query...
    However its better to provide the month and year both form the selection screen because there can be many years data in the table which r having same month ...
    eg .. 02 then it will give Feb months data for all years say 2004 2005 .... 2008 ...
    Also..
    Here is the "help" for the syntax of LIKE in SELECT statement.
    f NOT LIKE g
    Addition:
    ... ESCAPE h
    Effect
    The condition is met for a table entry if the statement "f (does not) equal the pattern in g" is true for the values of f and g. f must always be a field descriptor, and g an ABAP field. If f has the value NULL, then the result of the check for the statement is unknown. Within a pattern, there are two special characters:
    '_' (underscore) stands for any single character.
    '%' (percentage sign) stands for any sequence of characters, including an empty string.
    Examples
    Example to select all customers whose name begins with 'M':
    TABLES SCUSTOM.
    SELECT ID NAME FROM SCUSTOM
    INTO CORRESPONDING FIELDS OF SCUSTOM
    WHERE NAME LIKE 'M%'.
    WRITE: / SCUSTOM-ID, SCUSTOM-NAME.
    ENDSELECT.
    Example to select all customers whose name contains 'huber':
    TABLES SCUSTOM.
    SELECT ID NAME FROM SCUSTOM
    INTO CORRESPONDING FIELDS OF SCUSTOM
    WHERE NAME LIKE '%huber%'.
    WRITE: / SCUSTOM-ID, SCUSTOM-NAME.
    ENDSELECT.
    Example to select all customers whose name does not contain 'n' as the second character:
    TABLES SCUSTOM.
    SELECT ID NAME FROM SCUSTOM
    INTO CORRESPONDING FIELDS OF SCUSTOM
    WHERE NAME NOT LIKE '_n%'.
    WRITE: / SCUSTOM-ID, SCUSTOM-NAME.
    ENDSELECT.
    Notes
    LIKE can only be used for alphanumeric database fields. In other words, table field f must have Dictionary type ACCP, CHAR, CLNT, CUKY, LCHR, NUMC, UNIT, VARC, TIMS or DATS. The comparison field g must always have type C.
    The maximum length of the pattern is 2n - 1 characters, where n is the length of field f.
    Trailing spaces are ignored in comparison field g. If a pattern contains trailing spaces, you must enclose it in single inverted commas ('). If your pattern is enclosed in inverted commas and you also want to include inverted commas as part of the pattern, the inverted commas in the pattern must be doubled.
    You cannot use this variant in the ON addition to the FROM clause.
    Hope it will solve your problem
    Reward points if useful...
    Thanks & Regards
    ilesh 24x7

  • I want to accumulate rain for the day, month and year; What formula can I use?

    I want to accumulate rain for the day, month and year; What formula or expression can I use.
    I am using a Rain Wise product that converts pulses to an analog value.  The Rain Wise device can be
    set to measure up to 1", 5", or 10".  I will be setting the unit to 10 inches in increments of 0.01 inches.
    What I would like to do is everytime the signal increments I would like to count it as 0.01 then after reaching
    a period of time whether it be a day or a month reset back to zero.
    Need some advise on this problem.
    Solved!
    Go to Solution.

    Hello Ryan,
    Lookout gets a Modbus over Ethernet signal which originates as a 4-20mA input to a Moxa Ethernet I/O Module (E1240) in the field.  In Lookout I created a ModbusEthernet Driver and a tag which scales 0 - 65534 RAW to 0-10 Eng.  [0 - 10 is inches of rain]  Also, another piece of information is that after the rain gauge maxes out at 10 inches it will zero out and start over.
    I though the accumulator was time based and took a sample over a specific time period, for instance, one sample every 30 seconds then accumulate.  If this is so then if I have 5 inches of rain and then it stopped raining, then 30 seconds latter it would sample, it would see 5 inches and add that to be 10 inches when actually it had only rained 5 inches. 
    I really need some help with this process,
    David Lopez
    City of Corpus Christi

  • Hi,i just bought the Creative cloud membership and i would want to know why is t one year policy and you payed alot of money and still pay for the next month? Annual means yearly right ? why do i have to pay another next month.

    Hi i just want to know i bought the creative cloud and photoshop and premiere. All those and it said annual meaning i have to pay for the next year right? But why did it said that i have to pay for the next month? What happens  when i didn't pay the next month ?

    You may buy an annual subscription and pay monthly, or a straight monthly subscription... and, being a subscription, if you stop paying the software stops working
    If you want a one time payment, and you can use 3+ year old software, go to Creative Suite 6

  • Calculate Avg  for the given months based on the no. of days in months

    Dear Experts
    I  have a report in which there is a characterictic claenderyr/month.The Input paramter is claenderyr/month which is restricted by a variable of type interval. i mean user will enter calenderyr/month as interval say 012010 to 06.2010. Now I have to calculate Avg sale Qty for the given months based on the no. of days for the given range of months. How I can achieve this in BW Query. Pl. advice
    Dinesh Sharma

    Hi,
    Create formula for the sales qty.
    maintain the exception aggregation as average based on calday
    Best Regards,
    M.H.REDDY

  • Don't die after your billing cycle ends cause they will still charge for the following month

    My husband passed away on Thanksgiving day but becaude my billing cycle ended on the 20th, Verizon is charging me $30 for the next month even tho I cancelled his phone.  thanks for the compassion

    I'm very sorry for your loss.
    Yes, that's the way it works. 
    Best wishes to you.

Maybe you are looking for

  • How to fix iTunes (11.3.1.2) "APPCRASH" on startup?

    Hello, community. Here are my system specs (the ones that might matter): HDD (iTunes directory): Seagate 2TB External HDD @7.2k RPM MOBO: ASUS Sabertooth 990FX CPU: AMD Zambezi FX-8120 8 Core 3.41GHz RAM: G.Skill 16GB RAM @ 1600 GHz Windows 7 Ultimat

  • Why do certain clips (photos), viewed in preview, on Adobe Premiere 11 look different on YouTube?

    Hi folks, I've posted, via Adobe Premiere 11, two different music videos on YouTube and on my Facebook page. The first one, "Back In The Day", looks the same on YouTube (and Facebook) as it did when I viewed it (previewed it) on Premiere 11. But the

  • Just some newbie questions :)

    what would happen to my macbook pro system if i didn't upgrade my OS X to the latest one everytime apple releases new one? will it get any bug or viruses or something strange? thx,

  • Excel/PHP/dreamweaver prob has me stumped

    I am building bar to show the daily goal and what they are at all through the day. I am basing it pretty much of this one: http://www.wynia.org/wordpress/glass-is-too-big/ The data that i want to pull from is on an Excel spreadsheet that is updated t

  • ORACLE EXPORT BACKUP HELP

    We have a DB about 20 GB in size. We have setup the database to be backed up using the EXPORT utility every 12 hours (1 am and 1 pm) using the NT scheduler. Every time a .dmp file is created along with a .txt file which outputs the status. I want to