First & Last date of month

Hello Everyone ,
Does anyone knows any function module or way to find the first and last date of any month ?
Thanks,
Deepak.

Hi,
Try the following
DATA: l_first_date LIKE SY-DATUM,
      l_last_date  LIKE SY-DATUM.
PARAMETER l_Date LIKE SY-DATUM DEFAULT SY-DATUM.
First day of month
CONCATENATE l_date(6) '01' INTo l_first_date.
call function 'HR_HCP_GET_LAST_DAY_OF_MONTH'
  exporting
    im_date                    = l_date
  IMPORTING
    EX_LAST_DAY_OF_MONTH       = l_last_date.
WRITE:/ l_first_date.
WRITE:/ l_last_date.

Similar Messages

  • FM to find the first & last date of month when we enter period and year

    Hi Gurus,
               I required an urgent need.
               I want a function module which gives me first and the last date of the month when I enter the period and the year.
               Reply me as soon as possible.
    Regards,
    Sagar

    Try this coding...  enter    02/2007 into the selection screen field and execute
    report zrich_0001 .
    data: start_date type sy-datum,
          end_date type sy-datum.
    parameters: p_spbup type spbup.
    start-of-selection.
      start_date = p_spbup.
      start_date+6(2) = '01'.
      call function 'LAST_DAY_OF_MONTHS'
           exporting
                day_in            = start_date
           importing
                last_day_of_month = end_date.
      write:/ start_date, end_date.
    Regards,
    Rich Heilman

  • Get first and last date of month

    Hi,
      Is there any function module to get first and last date of month for a entered date.
    Please let me know.
    Regards,
    SP

    Hi,
    Use the below FM to find the Last day of month and them u can easily calculate the first day.
    DATA : v_startdate TYPE sy-datum.
    DATA : v_enddate TYPE sy-datum.
    DATA : v_temp TYPE dats.
    v_temp = sy-datum.
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
        EXPORTING
          day_in            = v_temp
        IMPORTING
          last_day_of_month = v_enddate
    CONCATENATE  v_enddate+0(6)  '01'  INTO  v_startdate.
    Hope it helps.
    Regards,
    Arnab.

  • Customer Exit for Number of Days from 1 st Apr to last date of Month Enter

    Hello BI Experts,
    I have a requirement to count the number of days from 1 st April of current year to the last date of month entered.
    For example : The use will enter say July 2010 or 003.2010  (as Fiscal Year Variant is V3 ).
    Today is 14 July ...So we have to first find out the end date of the July month ie 31 st July
    Then go to 1 st April 2010.
    Now calculate the Number of days between 1 st April to 31 st July 2010.
    I consider I have to create two Customer Exit variable
    as below
    1 st customer exit Bex variable  say  ZLY_MTH  ( Last day of Month Entered)
      and i_step = 1
    2 nd Customer Exit BEx Formula variable say ZF_NUMDAYS ( Number of days between two dates)
    i_step =1 .
    Please provide me the logic for the above two.
    Thanks in Advance.
    Regards,
    Amol Kulkarni

    PSUDEO CODE:
    1. Initially LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE WHERE VNAM = 'ZMONTH'.
    2. Get the Month input using VAR_MONTH2 = LOC_VAR_RANGE-LOW+4(2)
    3. Now calculate Month+1: VAR_MONTH2 = VAR_MONTH2 + 1 (Refer **)
    4. Now calculate the Current Year: VAR_YEAR = LOC_VAR_RANGE-LOW+0(4).
    5. Get the 1st Day of the Month (VAR_MONTH2):  CONCATENATE '01' '/' VAR_MONTH2 '/' VAR_YEAR INTO L_S_RANGE-LOW.
    6. SUBRACT 1 (0DATE) from this DATE (This will give the logic for last day of the current month)
    Insert this code also for using the date conversions
            CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
              EXPORTING
                INPUT  = VAR_MONTH2
              IMPORTING
                OUTPUT = VAR_MONTH2.
    Pls. check out this logic. Guess it would solve your need.
    Thanks,
    Arun Bala

  • How to find last date of month

    Dear  All,
    Can anybody tell me how to find last date of month I need it to check some validations
    helpful answer will definatly rewarded
    Regards
    Shashikant

    Hi,
    RP_LAST_DAY_OF_MONTHS Determine last day of month
    HR-D: Payroll Germany code
    RP_LAST_DAY_OF_MONTHS
    HR-D: Determine last day of month
    DATE_CONVERT_TO_FACTORYDATE
    Returns factory calendar date for a date Calculates and returns factory calendar date for a date (if CorrectOption = '+');
    Checks if the date is work day (if CorrectOption = '-').
    HOLIDAY_CHECK_AND_GET_INFO Useful for determining whether or not a date is a holiday. Give the function a date, and a holiday calendar, and you can determine if the date is a holiday by checking the parameter HOLIDAY_FOUND.

  • Last date of month

    Hi im new to java. Looking for a class that provides last date of the month according to a given year and month .

    java does provide a calendar object for gregorian
    dates.. surprising its called GregorianCalendar. :PAs I said avoid GregorianDate in Java it is a poor implementation. Date arithmetic is overly complex. There are inconsistencies i.e. Month starts at zero Jan is 0 day of week starts at 1 (Sunday = 1, Monday = 2) First of the month is 0 not 1 as one would expect. Sun's date does not handle dates prior to 1970 ( a real pain in your are doing historical data analysis). Suns Date uses 2 digit years.
    BigDate makes date arithmetic a slam dunk.
    To find the second monday in June 1961
    BigDate aDate = new BigDate(BigDate.nthXXXDay( 2, 1, 1961, 6));
    yyyy = aDate.getYYYY();
    mm = aDate.getMM ();
    dd = aDate.getDD ();
    To calculate 156 days after the 1st of Jan 1999. You would do the following.
    BigDate aDate = new BigDate (1999, 1 , 1 + 156, BigDate.NORMALIZE);
    yyyy = aDate.getYYYY();
    mm = aDate.getMM ();
    dd = aDate.getDD ();
    or
    BigDate aDate = new BigDate (1999, 1 , 1 );
    aDate.setOrdinal(aDate.getOrdinal( )+ 156);
    yyyy = aDate.getYYYY();
    mm = aDate.getMM ();
    dd = aDate.getDD ();

  • Looking for a query to find first/last dates in overlapping dates...

    Hi,
    I'm looking for a query to find the first dates and last dates in a table conaining overlapping dates.
    I have a subscription table which has for each Customer start and end date for different subscriptions.
    I want to know the different ranges of date where there is subscriptions active.
    so if the table has this:
    CustID, Start date, end date
    1, 2008-01-01, 2012-06-06
    1 ,2009-01-01, 2011-01-01
    1, 2011-01-01, 2013-02-02
    1, 2013-01-01, 2013-08-08
    1, 2014-01-01, 2014-04-04
    I want to produce this result:
    custid, range start, range end
    1, 2008-01-01, 2013-08-08
    1, 2014-01-01, 2014-04-04
    the first row is the range identified from the 4 rows in my subscription table.
    thanks :)

    I think I found it...
    http://stackoverflow.com/questions/5213484/eliminate-and-reduce-overlapping-date-ranges
    let me try this method
    Hi,
    m writing to follow up with you on this post. Thanks for you posting a reply to share your workground. Was the problem resolved after performing the above link? If you are satisfied with the above solution, I’d like to mark this issue as "Answered".
    Please also feel free to unmark the issue, with any new findings or concerns you may have.
    Thanks,
    Sofiya Li
    If you have any feedback on our support, please click here.
    Sofiya Li
    TechNet Community Support

  • Last date of Month based on SY_DATUM.

    Hi All,
    I need last date for a month based on SY-DATUM.
    Is there any FM which fulfills above criteria.
    Regards,
    Yugesh A.
    Moderator message: date calculation questions = FAQ, please search before posting.
    Edited by: Thomas Zloch on Mar 21, 2011 12:39 PM

    Hi,
      Here is the small piece of code u can do some changes according to ur need i hope u will get some help....
    data:l_month type am_monat,
         l_year type gjahr,
         f_date type sy-datum,
         l_date type sy-datum.
    l_month = 04.
    l_year = 2008.
    data: fdate type sy-datum.
    data:ldate type sy-datum.
    CALL FUNCTION 'OIUREP_MONTH_FIRST_LAST'
    EXPORTING
       I_MONTH           = l_month
       I_YEAR            = l_year
      I_DATE            =
    IMPORTING
       E_FIRST_DAY       = f_date
      E_LAST_DAY        = l_date
    EXCEPTIONS
      WRONG_DATE        = 1
      OTHERS            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    write:/ f_date.
    write:/ l_date.
    fdate = f_date.
    ldate = l_date .
    write:/ fdate dd/mm/yyyy.
    write:/ ldate dd/mm/yyyy.
    Thanks & Regards
    Ashu Singh

  • Getting last date of month

    Dear Experts
    Please help, i am new in ABAP.
    I want to get number of days for a particular month .Eg if user selects feb as moth and 2009 as year i will get 28.02.2009 as output.
    if user selects march and 2009 as year it will automatically returns 31.03.2009..
    Also give me function module coding for selection of month and year.
    I whouls be highly thankful to you for this.
    Regards
    Raj Jindal

    Hi Raj,
    DATA:
      w_date type sy-datum.
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
      EXPORTING
        day_in                 = '20090214' " pass the date here for which u want the last date
    IMPORTING
       LAST_DAY_OF_MONTH       = w_date
    EXCEPTIONS
       DAY_IN_NO_DATE          = 1
       OTHERS                  = 2
    IF sy-subrc <> 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Write:
      w_date.
    With luck,
    Pritam.

  • URGENT - BI Publisher - Get Last Date of Month/Year

    Hello,
    I want to get the last date of a year/month through BI Publisher. We want to do it by creating a list of values containing the month/year name (i.e. January, February, March for month or 2004 2005 2006 for year) and when the user selects one of this values to get the last date of the month or year in order to select the correct number of records.

    Hi,
    try with a LOV like the following:
    select
    to_char(add_months(trunc(sysdate,'MONTH'),-level),'Month - YYYY') display_value,
    last_day(add_months(trunc(sysdate,'MONTH'),-level)) return_value
    from dual
    connect by level <=12
    which gives you the last 12 month from today.
    Regards
    Rainer

  • Restrict last date of month from date picker

    Hi All,
    I have a requirement to restrict the date picker.
    I want to allow the user to select only the last date of the month from the following four months march, June, September and December.
    I have googled about this i couldn't get related that except that restrict invalid days/months.
    Please suggest to find solution for this.
    My Jdev version is 11.1.2.0.0
    Thanks in advance,
    SAN

    Hi,
    Have a backing bean to construct a list of days to be disabled and set that to disabledDays property of the picker component.
    Ex : Re: Bug on the property "disabledDays" of the component af|inputDate ?
    -Arun

  • How to get last date of month ?

    Dear all
    hi!!!
    How can I get the last date of a particular month?
    I mean if the month is Feb, last date of the month should be 28.
    Is it required to write in loop or there is any method to get it.
    Please write me urgently,
    thanx,
    Samir

    Hello ,
    You can get the last date of a particular month of a particular year like this :
    int year= 2000;
    int month=1;     // February (month is zero based )
    int date = 20;
    java.util.GregorianCalendar gc = new java.util.GregorianCalendar(year,month,date);
    int last_day = gc.getActualMaximum(Calendar.DAY_OF_MONTH));
    Sandip

  • Ora-01847 day of month between 1 and last date of month coming in my query

    i m executing simple query but it is not working plz do help
    select *
    from sgvf_tree_nodes_vw
    where to_date(node_attr9_val, 'dd/mm/yyyy') between
    to_date('01/01/2010', 'dd/mm/yyyy') and
    to_date('31/12/2010', 'dd/mm/yyyy')
    gives : Ora-01847 day of month should be between 1 and last date of month

    Hi,
    Check the date format's once
    SQL> drop table demo;
    Table dropped.
    SQL> create table demo(val number, todate varchar2(12));
    Table created.
    SQL> insert into demo values(1,'04/11/2008');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from demo;
           VAL TODATE
             1 04/11/2008
    SQL> select sysdate from dual;
    SYSDATE
    03-FEB-11
    SQL> insert into demo values(1,'04/11/2010');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select *
      2  from demo
      3  where to_date(todate,'dd/mm/yyyy') between to_date('01/01/2010', 'dd/mm/yyyy') and to_date('31/12/2010', 'dd/m
    m/yyyy');
           VAL TODATE
             1 04/11/2010- Pavan Kumar N

  • How do we find first date of a month and last date of month?

    is it required long caluculation or is there any simple method?

    hi,
    try this FM -> 'HR_JP_MONTH_BEGIN_END_DATE'
    chk this also
    CALL FUNCTION 'LAST_DAY_OF_MONTHS'
    EXPORTING
    DAY_IN = sy-datum
    IMPORTING
    LAST_DAY_OF_MONTH = v_lastdate. <--Gives you the last day of a Month
    Other FM
    SG_PS_GET_LAST_DAY_OF_MONTH
    HRVE_LAST_DAY_OF_MONTH
    SLS_MISC_GET_LAST_DAY_OF_MONTH
    rgds
    anver
    if hklped mark points

Maybe you are looking for

  • SOAP Receiver Adapter Target system down

    Hi All, My scenario is SOAP Receiver adapter --- > Portal system (Target system.). Now team is taking restart of target system. It will take around 1 hr. So my question what will happen to the messages which is received by SOAP Receiver adapter in th

  • Formatting Failed DVD Studio Pro

    I am hoping if some one can help with this DVD Studio Pro Error; I've created a quicktime movie, Imported into DVD studio, created my menu, I am able to simulate the video and it plays fine. Then when I burn the DVD I get the error. The recording dev

  • Propagation O8 - O10g

    Hi All! Scenario: O 8.1.7.4 propagation to 10g. Error from prop. schedule: ORA-02068: following severe error from DBL_BM ORA-03114: not connected to ORACLE ORA-02068: following severe error from DBL_BM ORA-03113: end-of-file on communication channel

  • ACE Sticky issue.

    Hi, The Sticky function of the ACE is not working. There were no changes been made on the device it was working fine before but not now,. We have 2 ACE one is Active(ACE1) and Second one is Standby (ACE2). Testing done till now:- ================ Don

  • Error when making connection:  You have an error in your SQL syntax;

    I'm getting this error when trying to make a simple Database Connection: SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????????????????