End date of given month

Hi Guys,
i am facing this issue from last 1 month can anyone please give me a solution
i am wrintin the lastdate file with month like  OCT 2010 by doing this  am not getting any results in score card comparison chart, i f i change that to month end date like 31 OCT 2010 i am getting the results, can some body give solution to write the end date of a  given month to the lastdate file
here is the code i am using
begin
     ask
     global  origin middle background Green
     Title 'Set Data Load Date'
     Skip 1
     TITLE 'date  Selection'
          NAME procMonth
               PROMPT 'Enter  month to process: '
End
... copy latest to the lastdate document
output     lastdate      over
exh     control     procMonth
output      off
thanks in advance

You need to apply two FM to get the end day of the month.
First you need to apply FM MONTHS_PLUS_DETERMINE. This will give you the date after 3 months.
            CALL FUNCTION 'MONTH_PLUS_DETERMINE'
              EXPORTING
                MONTHS        = 3   " << for 3 months
                OLDDATE       = l_start_Date   " << 12/01/2007
             IMPORTING
               NEWDATE       = l_3_Date. " << 02/01/2008
Then call the FM RP_LAST_DAY_OF_MONTHS . this will give you the end date of the month
  CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
    EXPORTING
      day_in            = l_3_Date  " << 02/01/2008
    IMPORTING
      last_day_of_month = l_3_Date  " < 02/29/2008
    EXCEPTIONS
      day_in_no_date    = 1
      OTHERS            = 2.
Call both FMs again to get your another date(after 4 months).
Regards,
Naimesh Patel

Similar Messages

  • 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
    Sahitya

    Hi,
    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

  • 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

  • Want to schedule WebI report for End date of Prior Month

    Hello Experts,
    We have WebI report created on top of Bex Query, We have key date as prompt for the report. Can we schedule the webi report for key date as last date of prior month, so if current month is February, my key date should be Jan 30 2011. I am not sure if this is possible?
    Thanks,
    Ravi

    You need to apply two FM to get the end day of the month.
    First you need to apply FM MONTHS_PLUS_DETERMINE. This will give you the date after 3 months.
                CALL FUNCTION 'MONTH_PLUS_DETERMINE'
                  EXPORTING
                    MONTHS        = 3   " << for 3 months
                    OLDDATE       = l_start_Date   " << 12/01/2007
                 IMPORTING
                   NEWDATE       = l_3_Date. " << 02/01/2008
    Then call the FM RP_LAST_DAY_OF_MONTHS . this will give you the end date of the month
      CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
        EXPORTING
          day_in            = l_3_Date  " << 02/01/2008
        IMPORTING
          last_day_of_month = l_3_Date  " < 02/29/2008
        EXCEPTIONS
          day_in_no_date    = 1
          OTHERS            = 2.
    Call both FMs again to get your another date(after 4 months).
    Regards,
    Naimesh Patel

  • Generate all the dates for given month

    Hi all,
    How can I generate all the dates for given month? For example If I give Feb-2008 then it should display all the dates from 01/02/2008 to 29/02/2007
    Thanks,
    Sujnan

    This question was expanded (and answered) at
    Monthly Report
    You can also search for "all days in month".

  • How to derive date from given month, year and day?

    Hi all,
    I have a doubt in date function. I need to create a date from the given month, year and day. How can i do it?

    consider this example
    REPORT zconvertdate001 .
    TYPES : BEGIN OF tt_date_in,
            day(2),
            sep1,
            month(3),
            sep2,
            year(4),
            END OF tt_date_in.
    DATA : wa_date_in TYPE tt_date_in VALUE '07-Jul-2006'.
    TYPES : BEGIN OF tt_date_out,
            day(2),
            month(2),
            year(4),
            END OF tt_date_out.
    DATA : wa_date_out TYPE tt_date_out.
    TRANSLATE wa_date_in-month TO UPPER CASE.
    SELECT SINGLE mnr
    INTO wa_date_out-month
    FROM t247
    WHERE spras EQ sy-langu
    AND   ktx EQ wa_date_in-month.
    CONCATENATE wa_date_in-year wa_date_out-month wa_date_in-day
           INTO wa_date_out.
    WRITE : / ' Date in:', wa_date_in,
            / 'Date out:', wa_date_out.

  • TO FIND START DATE AND END DATE OF THE MONTH

    HAI ALL,
               I want to find the start of the date for the month and end of the date for the month, for given date.
    Ex. if input is : 08-06-2007,
                                           I want to get the first and last date for this month.
    . Is there any FM .
    thanks in advance,
    senthil kumar

    Hi,
    Use the Function modue RE_LAST_DAY_OF_MONTH to get the last day
    For first day..
    DATA: V_DATE TYPE D.
    V_DATE = SY-DATUM.
    V_DATE+6(2) = '01'.
    WRITE: / 'First day is ', v_date.
    Thanks,
    Naren

  • Pay day for period end date as mid month.

    Hi All,
    plz suggest how to proceed.
    Payroll period starts from 15th of month to 14th of next month and payday is last working day of month having period end day.
    Example
    Period start day  15th April
    Period end day  14th May
    Pay day   last working day or last day of May for period 15th April to 14th May.

    Hi,
    I think what you are meeting with is Monthly End Accrual (MEA) senario.
    Pls check the following URL in PY US solutions:
    http://help.sap.com/saphelp_46C/helpdata/EN/d8/c9e93401bdee06e10000009b38f83b/frameset.htm
    The related node is under :
    Payroll United States (PY-US)->Final Payroll Processing (PY-US-FP)-> Month-End Accruals Concept
    Br,Kee

  • How can i get 2nd week starting date and ending date in a month?

    please help me to query this.
    thanks in advance

    Hi,
    I assume the second week start the next monday after the 1st of the current month. End of week is the next sunday.
    If a week start monday, the second week of december start the 5th and ending the 11th :
      1  select 8-to_char(to_date('01'||to_char(sysdate,'MMYYYY'),'DDMMYYYY'),'D')+1 first_day2w,
      2         15-to_char(to_date('01'||to_char(sysdate,'MMYYYY'),'DDMMYYYY'),'D') last_day2w
      3* from dual
    SQL> /
    FIRST_DAY2W LAST_DAY2W
              5         11If we take august, the second week start the 8th to end the 14th
      1  select 8-to_char(to_date('01082005','DDMMYYYY'),'D')+1 first_day2w,
      2         15-to_char(to_date('01082005','DDMMYYYY'),'D') last_day2w
      3* from dual
    SQL> /
    FIRST_DAY2W LAST_DAY2W
              8         14HTH,
    Nicolas.
    Note that my nls_territory = FRANCE.
    if you're in America, first day of week is sunday, and last is saturday :
      1* alter session set NLS_TERRITORY='AMERICA'
    SQL> /
    Session altered.
    SQL> ed
    Wrote file afiedt.buf
      1  select 8-to_char(to_date('01'||to_char(sysdate,'MMYYYY'),'DDMMYYYY'),'D')+1 first_day2w,
      2         15-to_char(to_date('01'||to_char(sysdate,'MMYYYY'),'DDMMYYYY'),'D') last_day2w
      3* from dual
    SQL> /
    FIRST_DAY2W LAST_DAY2W
              4         10
    SQL> Message was edited by:
    N. Gasparotto

  • 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

  • To get first date and end date after entering any month and year

    Hi,
    I need to to get first date and end date of a month and year in yyyyMMdd format. I am reading month and year from a properties file. But I don't know how to get the first date and End date in given format. The properties file gives me just text. But I don't know how to get the date format using this. I need this urgently. Can anyone help me to get code for this?
    I am reading the fields as,
    Properties props = new Properties();
    props.load(new FileInputStream("AnyMonthVolume.properties"));
    String date_month = props.getProperty("date_month");
    String date_year = props.getProperty("date_year");
    Thanks.

    I know this has been posted a while ago but incase someone looking for it, here is the code to get the end of current month date.
    Calendar cal = Calendar.getInstance();
         cal.setTime(new java.util.Date());
         cal.set(Calendar.DATE, 1); //set the date to start of month
         cal.add(Calendar.MONTH,1);
         cal.add(Calendar.DATE,-1);
    System.out.println(cal.getTime());

  • Start date End date of the current Calendar month

    Hi All,
    How can we get the Start date of the Current Calendar month and the End date of the current Calendar month , when we given certain date in the selection screen.
    For Eg : In the Selection screen if I give date as Todays date 04042008, we should be getting the Start date of the month as 01042008 and End date of the month as 31042008.
    Any pointers will be much appreciated.
    Regards
    Rohini.

    Hi,
    Please refer the code below:
      CALL FUNCTION 'FIRST_DAY_IN_PERIOD_GET'
        EXPORTING
        i_gjahr              = sp_gjahr
    *     i_monmit             = gp_monat
          i_periv              = 'K4'
          i_poper              = sp_monat
    IMPORTING
         e_date               = gv_firstday
    EXCEPTIONS
       input_false          = 1
       t009_notfound        = 2
       t009b_notfound       = 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.
    "Last day of the period
      CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
        EXPORTING
          i_gjahr              = sp_gjahr
    *           I_MONMIT             = gp_monat
          i_periv              = 'K4'
          i_poper              = sp_monat
       IMPORTING
               e_date               = gv_lastday
             EXCEPTIONS
               input_false          = 1
               t009_notfound        = 2
               t009b_notfound       = 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.
    Thanks,
    Sriram Ponna.

  • Month end date

    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

  • Rolling Months - Month By Month based on month of variable ending date

    Post Author: jeffr
    CA Forum: Formula
    Hi,
    We want to do a rolling 3 month report, based on the ending month where the ending date is entered as a run time parameter, for example run-time parameter - {?Ending Date} entered is 15 June 2007
    First month - should have all of June 2007
    Previous month shoud have all of May 2007
    Earlier month should have all of April 2007
    We tried Month() = Month({?Ending Date}) for current month and
    Month () = Month (DateAdd("m",-1,({?Ending Date}))), and
    Month () = Month (DateAdd("m",-2,({?Ending Date}))) 
    but they didnt work successfully
    Could someone please let us know the best way to do it with Crystal X?
    Thanks

    Post Author: Charliy
    CA Forum: Formula
    You need to get six dates set up as formulas 
    BOM3 = date(year({?parameter}),month(),1)   First day of Month3 = June 1
    EOM3 - do a dateadd of one month to your parameter, then follow above example to make it the first day of next month and subtract one day
    BOM2 first day of EOM2
    EOM2=- BOM3-1
    BOM1  first day of EOM1
    EOM! = BOM2 -1

  • Month End dates

    Hi all,
    I have a table "xyz" which capturing start_date and end_date in a single row.
    i.e. start_date = *15-oct-2007*, end_date = *25-dec-2008*
    I want to write a query which diplay me month end dates of each month which fall between start_date and end_date like . .
    31-oct-2007
    30-nov-2007
    31-dec-2007
    31-jan-2008
    29-feb-2008
    31-mar-2008
    31-dec-2008
    thanks in advance

    Sreekanth Munagala wrote:
    hi,
    try this
    select last_day(add_months(date1,rownum-1))
    from xx_dates
    where empno=1
    connect by (rownum-1) <= round(months_between(date2,date1))
    ROUND won't work because it can round down as well as up.
    SQL> ed
    Wrote file afiedt.buf
      1  with dt as (select to_date('30/10/2007','dd/mm/yyyy') as start_date, to_date('1/12/2008','dd/mm/yyyy') as end_date from dual)
      2  --
      3  select last_day(add_months(start_date,rownum-1)) as end_month
      4  from dt
      5* connect by rownum <= round(months_between(end_date,start_date))+1
    SQL> /
    END_MONTH
    31-OCT-07
    30-NOV-07
    31-DEC-07
    31-JAN-08
    29-FEB-08
    31-MAR-08
    30-APR-08
    31-MAY-08
    30-JUN-08
    31-JUL-08
    31-AUG-08
    30-SEP-08
    31-OCT-08
    30-NOV-08
    14 rows selected.Instead, to do that sort of method you would need CEIL...
    SQL> ed
    Wrote file afiedt.buf
      1  with dt as (select to_date('30/10/2007','dd/mm/yyyy') as start_date, to_date('1/12/2008','dd/mm/yyyy') as end_date from dual)
      2  --
      3  select last_day(add_months(start_date,rownum-1)) as end_month
      4  from dt
      5* connect by rownum <= ceil(months_between(end_date,start_date))+1
    SQL> /
    END_MONTH
    31-OCT-07
    30-NOV-07
    31-DEC-07
    31-JAN-08
    29-FEB-08
    31-MAR-08
    30-APR-08
    31-MAY-08
    30-JUN-08
    31-JUL-08
    31-AUG-08
    30-SEP-08
    31-OCT-08
    30-NOV-08
    31-DEC-08
    15 rows selected.
    SQL>

Maybe you are looking for