FM takes year and month as input and give firstdate and lastdate as output

Hi,
Can any one tell me any <b>function modules which takes year and month as inputs and gives first date and last date of that month as outp</b>uts.
Regards,
Gurprit Bhatia
Message was edited by:
        GURPRIT BHATIA

Hi Gurprit,
You can use this.
data : ws_date type sy-datum.,
         ws_edtae type sy-datum.
constants : c_01 value '01'.
CONCATENATE ws_date c_01 INTO ws_stdate.
CALL FUNCTION 'HR_JP_ADD_MONTH_TO_DATE'
      EXPORTING
        iv_monthcount = ws_01 (1)
        iv_date       = ws_stdate ( eg :01.01.2007)
      IMPORTING
        ev_date       = ws_edate. (eg : 31.01.2007)
Reward if useful.
Regards,
Chitra

Similar Messages

  • Dynamic Input form with PLAN and Actual Confusion (YEAR-row / MONTH-Column)

    Hi Guru's,
    Assume that
    Row Axis: YEAR
    Column Axis: MONTH
    Page Axis: VERSION
    From the VERSION dimension, we re able to get Budget Year and the latest Actual Month.
    For example, As u see below, the budget year is 2014 and we retreive + or - 2 years of budget year which is 2014.
    And the latest actual month is Jun.
    So is it possible to make a dynamic report that can retreive actual data for the budget year and latest actual month of selected VERSION and also rest of the cells should be inputtable.
    By the way, we have a dimension which named as for the PLAN , ACTUAL etc.
    So what do you suggest for that case?  Is there any way to handle without VBA?
    Thanks to all in adv.
    MONTH / YEAR
    Jan
    Feb
    Mar
    Apr
    May
    Jun
    Jul
    Aug
    Sep
    Oct
    Nov
    Dec
    2012
    2013
    2014
    2015
    2016

    Hi Sadi,
    I agree Vadim, you do not need extra dimension for time. You can "report" in Bex analyzer with this format but BPC reporting/input schedules is not dynamic enough. Because you can not use property in axis but in Bex it is possible. Maybe you can change input form design because where is other contex in your form, 2012.01 what, price or stocks or sth? You have to specify account and entity. I think  it is useless design to input data. I added figure for sales model. In this figure, you can manage actual / budget with "if" and "today" excel formulas. And you can easily link your olap member in column axis. I think it will help you.
    Best regards
    Haşim.

  • How to set filter criteria for month and year using in timestamp input field?

    Hi,
    I am using jdev 11.1.2.3,
    I have one problem with Report generation,,,,,,I have one report table which is in the form of VO(query based) and i want to search this table as month and year basis
    but in this table(query) that field having timestamp based value.. how to search with month name and year only.. Here i am using totally query base VO's for generating
    reports........ Can any one guide me.
    Thank You.

    You can use a inputdate, which allows you to selecte a moth, year and a day. Once the selection is made you convert it to only allow moth and date like
            <af:inputDate label="Label 1" id="id1" autoSubmit="true" value="#{bindings.myMonthYear1.inputValue}">
              <f:convertDateTime pattern="MM/yyyy"/> 
            </af:inputDate>
            <af:outputText value="Selected #{bindings.myMonthYear1.inputValue}" id="ot1" partialTriggers="id1"/>
    then you have a string holding month and year only. This value you split into two variables you or pass it as a whole parameter to the query and split it there.
    Another way is to add two static lovs one for month and one for year and use them to get to the filter values.
    Timo

  • Input: Month Year and Out Put Display

    Dear SDN,
    Is it possible to view a Query, if we provide only Month & Year..
    Then the following result has to display..
    Entered month year --- Previous month year --- YTD entered month -- YTD Previous month year
    Example : During execution of a query -- suppose if i enter Sep 2007
    Sep2007 -- Sep2006 -- YTD Sep2007 -- YTD Sep2006
    Please suggest me...
    Help will appreciated with points
    This is very urgent...
    Thanks in advance

    Hi,
    Create a VAR Ready for input on 0FISCPER (eg ZFPIN)
    COL 1: RKF with your KF restricted to 0FISCPER = ZFPIN
    COL 2: RKF " 0FISCPER = ZFPINLY
    COL 3: RKF " 0FISCPER = ZFPINYTD
    COL 4: RKF " 0FISCPER = ZFPINLYYTD
    ZFPINLY, ZFPINYTD, ZFPINLYYTD are variables NOT ready for input processed by customer exit (CMOD).
    The code should basically be:
    DATA: l_s_range     TYPE rsr_s_rangesid.
    DATA: loc_var_range LIKE rrrangeexit.
    DATA: fiscal_year LIKE t009b-bdatj.
    CASE i_vnam.
    WHEN 'ZFPINLY'.
    IF I_STEP = 2.
    LOOP AT i_t_var_range INTO loc_var_range
    WHERE vnam = 'ZFPIN'.
       fiscal_year = loc_var_range-low(4).
       fiscal_year = fiscal_year - 1.
       CONCATENATE fiscal_year loc_var_range-low+4(3) INTO l_s_range-low.
       EXIT.
    ENDLOOP.
    l_s_range-sign     = 'I'.
    l_s_range-opt      = 'EQ'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    WHEN 'ZFPINYTD'.
    IF I_STEP = 2.
    LOOP AT i_t_var_range INTO loc_var_range
    WHERE vnam = 'ZFPIN'.
       CONCATENATE loc_var_range-low(4) '001' INTO l_s_range-low.
       l_s_range-high = loc_var_range-low.
       EXIT.
    ENDLOOP.
    l_s_range-sign     = 'I'.
    l_s_range-opt      = 'BT'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    WHEN 'ZFPINLYTD'.
    IF I_STEP = 2.
    LOOP AT i_t_var_range INTO loc_var_range
    WHERE vnam = 'ZFPIN'.
       fiscal_year = loc_var_range-low(4).
       fiscal_year = fiscal_year - 1.
       CONCATENATE fiscal_year '001' INTO l_s_range-low.
       CONCATENATE fiscal_year loc_var_range-low+4(3) INTO l_s_range-high.
       EXIT.
    ENDLOOP.
    l_s_range-sign     = 'I'.
    l_s_range-opt      = 'BT'.
    APPEND l_s_range TO e_t_range.
    ENDIF.
    ENDCASE.
    hoping this will guide you....
    Olivier.

  • Year and Month calculation

    Hi
    I have created a report with two prompts, they are "Enter Start date:" and "Enter End date:" where i take date values from a calendar while prompting.
    For example:
    Start date = 10/11/2003
    End date = 10/10/2003
    If i want to display the End date means, i ll use UserResponse("Enter End Date:") in the webi reports. What should i do to calculate Year and Month from this user response value,
    i used these calculations below, but it is not working, showing me #ERROR message.
    1) ToDate(UserResponse("Enter End Date:");"dd/MM/yyyy")     =  #ERROR
    2) FormatDate(ToDate(UserResponse("Enter End Date:");"dd/MM/yyyy");"dd/MM/yyyy")     = #ERROR
    3) Year(UserResponse("Enter End Date:")   = The expression or sub-expression at position 6 in the 'Year' function uses an    invalid data type. (WIS 10037)
    4) FormatDate(ToDate(UserResponse("Enter End Date:");"dd/MM/yyyy  hh:mm:ss A");"MM/dd/yyyy") =#ERROR
    so help me how to get the year and month values from prompts ?
    Thanks
    Dineshkumar

    to get the Month Value and year value in Webi
    month name
    =Month(ToDate(UserResponse("Enter End Date:");""))
    month number of the year
    =MonthNumberOfYear(ToDate(UserResponse("Enter End Date:");""))
    to get the Year Value
    =Year(ToDate(UserResponse("Enter End Date:");""))
    good luck

  • FM to get previous fiscal month/year and calendar month/year for a date.

    Hi All,
    I am having a requirement to extract some data based on either the previous fiscal month/year or the previous calendar month/year. There is no company code input to find the fiscal/calendar month/year.
    At selection screen, user can select either fiscal or calendar selection.
    Based on the selection, the data will be extracted.
    For the system date, we need to calculate previous fiscal month/year or previous calendar month/year and populate the calculated data back to the selection-screen.
    Can you one of you please suggest an FM to find previous fiscal month/year and previous calendar month/year.
    Thanks in Advance,
    Regards
    Gowthami

    Hi Gowthami,
    You can use following function module to calculate previous / next day or month or year.
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    =
            sign      = '-'
            years     =
          importing
            calc_date = .
    Here, you can give '-' to sign, if you want previous day / month / year.
    Here, you can give '+' to sign, if you want next day / month / year.
    And depending upon your requirement, you can pass suitable value to days / month / year.
    e.g. To calcualte last month,
       call function '/SAPHT/DRM_CALC_DATE'
          exporting
            date      = sy-datum
            days      =
            months    = 1
            sign      = '-'
            years     =
          importing
            calc_date = wv_prev_month.
    so it will give '23-01-2008' . Then convert it in the required format as per your requirement using string function concatenate.
    Hope this help you.
    Regards,
    Anil

  • MBP 13" unibody main-board failure after 1 year and 10 month. Apple does not care!!!

    Hi Apple Communites!
    I have a big problem with my MacbookPro. I bought my MacbookPro in december 2010 in Thailand. 5 days ago My MacbookPro suddenly switched off and never start again.
    So I sent it to Apple Dealer in Phuket, Thailand to check. Now they told me it is the main-board failure and i have to change it on my own cost.
    And it is 26000 Thai baht (870 US Dollars). How comes that Apple do not take care for my cost.
    My MacbookPro is not two years old. For this price i better buy a new PC notebook.
    Can some of you please help me for a solution or answer? I use Apple almost 10 years and never have problem like this. Or Apple do not taking care of their customers or quality products anymore?  lertlid trzop

    you are right!! but is this the quality product of Apple that lasts for just 1year and 10 months?
    If it so then i think about to go back to PC after 10 years using Apple products and no one from Apple cares about customer service and quality.
    Sad Story about Apple. What Steve Jobs and Tim Cook gonna think about this.

  • 7 dollar charge per month for 1 year and half

    I hate to rain on everyones parade, because I know everyone is excited about the new iPhone and the new Droid, however I must. I was wondering why I've been getting charged  7 dollars by best buy for a year and a half or maybe even more. Every month 10th of month for at least a year and a half this charge has been showing up on my checking account. The only reason I can think this is the case is that I bought a new phone from them like 2 years ago and maybe the tech accidently gave me some sort of data plan I never asked for. However, I have not been using that phone for about 3 months now. Is there any way I can get rid of this payment so I don't have to pay 7 dollars a month for the rest of my life on a service I won't use because I have a new phone. Any help is appreciated. Thanks
    Solved!
    Go to Solution.

    I don't so. I usually stay away from service plans and extended warranties, because once I bought a PS3 controller with the 2 year extended warranty and the joystick stopped working but they said that I must have caused this problem so they cannot replace it. I was like so what you're saying is that your extended warranty that is suppose replace broken equipment doesn't really cover anything and they said "it only covers normal wear and tear. Like if a button sticks of the joystick loses its cover".  I was like that's fine and I bought it on another controller (stupidly idk why) and the button stick and was ok I should be fine and they will replace it. They said no we cannot replace it because you tampered with it I was like "NO KIDDING IT'S MY CONTROLLER!!!" After that I've avoided service and protection plans and that was like 2 years ago. Could it really still be from something like that? I'm just worried it's a hidden charge I didn't see on the old phones contract or some sort of data fee or something I cannot find. But thank you I will take a look at some receipts and records and see if I can find another protection plan I bought. Thanks

  • How to calulate previous fiscal year from current year and periods as input

    hi all,
    i have a report where i have 2 select options as year and period.
    my period can be a range  like( Ex: 1 to 6).
    i like to know previous fiscal year from the following inputs.
    Tel me a suitable conversion routine to calculate
    depending on periods and fiscal year.
    regards
    sivaram.

    Hi
    U need to check the lower period, if it's 1 the previous fyscal year will be the year before:
    IF PERIOD = '1'.
      PREV_YEAR = YEAR - 1.
    ENDIF.
    U can also use the fm FI_PERIOD_DETERMINE, in this case you need a date, u can get it from lower current period:
    Get the first day of the period
    BUDAT(4)   = YEAR.
    BUDAT+4(2) = PERIDO_LOW.
    BUDAT+6(2) = '01'.
    Now get the last day of the previous month:
    BUDAT = BUDAT - 1.
    Use this date to get its period by fm FI_PERIOD_DETERMINE
    Max

  • How to calculate year and month

    Dear Friends
    I have to make a customised report.In this report there are different buckets of one year from the year and month being entered by the user.
    For example if user is giving input value for year and month as 200912 then system has to show data in first bucket for the period 200912 to 200901.In the second bucket system will show data for period 200812 to 200801.In this way system has to show data in 11 buckets for 11 years.
    Is there any function module/BAPI in SAP through which system will calculate period of one year for different buckets for my report from the input value(year and month) being given by the user.
    Moderator message - Please see The specified item was not found. before posting - post locked and Points unassigned
    Edited by: Rob Burbank on Jan 5, 2010 11:03 AM

    Hi Satish,
    You can do this with a Standard function module.
    I am providing my code below :
    data : G_date type sy-datum.
    CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
        EXPORTING
          DATE      = sy-datum " instead of sy-datum provide
              " the select option here which user provides.
          DAYS      = C_fourty"45
          MONTHS    = C_MM    "00
          SIGNUM    = C_Negative "'-'
          YEARS     = C_YY    "00
        IMPORTING
          CALC_DATE = G_date. "G_date will have date less than 45 days
    *                         " from the day program has been executed.
    Now based upon the G_DATE, we can fetch remaining 10 buckets.
    Regards,
    Kittu
    Edited by: Rob Burbank on Jan 5, 2010 11:01 AM

  • How to capture the presnt year and month  .Urgent!!

    Hi all,
    I need to take the present year and month from the system and have to populate in drodownlists. can any one help me how to get these two seperatly and populate. xxxxxx (please read forum rules)
    regards,
    Sharan
    Edited by: Armin Reichert on Jan 17, 2008 10:23 AM

    Hi,
        If you are using DropDownByKey UI elements:
    1. Let's say the context attributes bound to the selectedKey property are called year and month respectively.
    2. To populate year:
    Date current = new Date(System.currentTimeMillis());
    IWDAttributeInfo attinfo                  = wdContext.getNodeInfo().getAttribute(IContextElement.YEAR);
    ISimpleTypeModifiable modinfo       = attinfo.getModifiableSimpleType();
    IModifiableSimpleValueSet valset   = modinfo.getSVServices().getModifiableSimpleValueSet();
    valset.put("currYear",String.valueOf(current.getYear));
    3. You can do a similar thing for month.
    Regards,
    Satyajit.

  • How to get Quaters of the year if give month year and number of quarters

    My requirement is if i give the input month, year and number of quarters i want the previous quarters. Is there is any function module to get the quarters if we give month and year and number of quarters
    Thank you.

    Pradeep,
    Use the Fm TSTR_PERIODS_QUARTERS and pass the year into the IMPORT PARAM IT_YEARTAB-TSTR.
    U will get the begin & End dates of each quarter...
    reward if helpful,
    Karthik

  • BI Query Monthly (this year and last year) vs YTD (this year and last year)

    I have a query requirement in BI to create a Query which will give me
    Sales Monthly (this year and last)  vs YTD Sales (this year and last).
    Here is an example of how the query would look:
    01/2007     01/2008     02/2007     02/2008     03/2007     03/2008     YTD 2007 YTD 2008
    Above would represent CKF's by month and YTD with Text Variables.
    Is this possible?  Obviously my problem is the number of columns that I would need, since I would not always be reporting on the same month(s).  Any suggestions (if this is possible).
    Thanks

    Hi,
    You can do it, see the following code and change as per your requirement...
    FMYEAR and LMYEAR Customer Exit variables on 0CALMONTH.  If you have any input variable then link it.
    Note:  Use Offsets for the following Variables to get 2007,2008,2009 results...
    * First Month Of Current Fiscal year comment*
        WHEN 'FMYEAR'.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                 EXPORTING
                   i_date               = sy-datum
    *         I_MONMIT             = 00
                   i_periv              = 'V3'
                IMPORTING
                  e_buper              =  zbuper
                  e_gjahr              =  zbdatj.
          CLEAR: l_s_range.
          l_s_range-low+4(2) = '04'.
          l_s_range-low+0(4) = zbdatj.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    * Last Month of Current Fiscal year*
        WHEN 'LMYEAR'.
          CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
                 EXPORTING
                   i_date               = sy-datum
    *         I_MONMIT             = 00
                   i_periv              = 'V3'
                IMPORTING
                  e_buper              =  zbuper
                  e_gjahr              =  zbdatj.
          CLEAR: l_s_range.
          l_s_range-low+4(2) = '03'.
          l_s_range-low+0(4) = zbdatj + 1.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'EQ'.
          APPEND l_s_range TO e_t_range.
    Thanks
    Reddy

  • My iPhone 4 getting off automatically while battery 60% or more and turn on when i plug in please advice it is battery problem or hardware i use this mobile for 2 years and 3 month.

    My iPhone 4 getting off automatically while battery 60% or more and turn on when i plug in please advice it is battery problem or hardware i use this mobile for 2 years and 3 month.
    Thanking you.

    1.  you may have to take it in to Apple and get an out of warranty iphone for $199.
    2.  you can get your information from a backup of your phone.  you do have a backup of your phone right either in iTunes or icloud.  If you don't then your answer will be no.

  • Key Figure format in Years and Months..

    Hi,
    Is there any Key figure similar to 0SRVCLENKYF (Length of Service (in Years)) part of Headcount and Personnel Actions, which should give me value in Years and Months..?
    Thanks in Advance,
    Thanks,
    Madhu.

    For curiousity sake...if you use the FIMA_DECIMAL_MONTHS_AND_YEARS Function Module, the output that you'll get is a months and years in fractional amounts. So, how are you going to get the Years and Months from this?
    For example, if the from date is 20000101 and the to date is 20090914, the results from this Function Module will be Months = 116.42740 and Years = 9.70228. If you do use this, I'd suggest taking the whole number from passed value for years (9 in this example) and then calculate months by taking the franctional amount of the passed value for years and multiple it by 12 (0.70228 * 12), you end up with 9 Years, 8 Months (8.42736 to be exact, but you're going to want to truncate it to 8 so that when it goes above 8.5, the value doesn't become 9 when it still should be 8).

Maybe you are looking for