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

Similar Messages

  • Function module to derive start and end dates from fiscal year and period.

    Hi,
    I want to know a function module to derive start and end dates from fiscal year and period.
    ie: If I have say fiscal year '2010' and period '07', then the start date of this period would be '01.10.2010'.
    Thanks.
    Moderator Messge: Basic Date questions are not allowed.
    Edited by: kishan P on Oct 18, 2010 4:45 PM

    Hi,
    This is one of my exit that display the calmonth (offset -12). Usefull when I have to retrieve in a KF a complete rolling year depending one calmonth.
    S_VMUCMN is my selection variable
    S_TXTCMN_M12 is my text variable calmonth-12
    S_TXTCMN_M0 is my text variable for selected calmonth.
    WHEN 'S_TXTCMN_M12'.
        IF i_step = '2'.
          LOOP AT i_t_var_range INTO loc_var_range WHERE vnam = 'S_VMUCMN'.
            CLEAR l_s_range.
            " First day of the selected month
            CONCATENATE loc_var_range-low '01' INTO l_calday.
            CALL FUNCTION 'YFRBW_FUM_CAL_DATE_IN_INTERVAL'
              EXPORTING
                date      = l_calday
                months    = 12
                signum    = '-'
              IMPORTING
                calc_date = l_calday.
            l_s_range-low = l_calday+0(6).
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO e_t_range.
            EXIT.
          ENDLOOP.
        ENDIF.
    Thus, in KF header you have to put the two text variable to display the complete period.
    Hope it helps,

  • 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

  • How to get Start and End date

    Hi All,
    I need to get the start date and end date of a month by passing parameter like 'MAy-2011'
    Result should be start date - 01-MAY-2011 and end date - 31-MAY-2011
    thnxs

    I did the documentation drill down for you :
    http://tahiti.oracle.com/
    http://www.oracle.com/pls/db112/homepage?remark=tahiti
    http://www.oracle.com/pls/db112/portal.all_books
    http://www.oracle.com/pls/db112/portal.all_books#index-SQL
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/toc.htm
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions.htm#i1482196
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions002.htm#i88891
    from here on you should be able to find a solution on yout own.

  • RFC enabled function module to insert , update and delete data in a ZTABLE

    friends..
    Is there any standatd RFC enabled function module to insert , update and delete data in a custom database-table (Ztable)?
    if not how can we create it? plz give me the details steps..
    what are the import, export parameters and how to code and process it.. (for example: suppose fields in the table is Emp_Id, Name, Address. I need to develop a RFM which does the 3 tasks, insert update delete in the same RFM)
    Thanks and Regards

    create a f.n mod in se37 and make it rfc enabled.  ur import parameters are Emp_Id, Name, Address and TASK and u can have an export parameter like result which gives the status of the update. based on task u can insert using keyword INSERT....and update using UPDATE or MODIFY and delete using DELETE. these keyword are not compelte with syntax but need to refer the SAP documentation.

  • Function module to get the difference of dates ..

    Hi ,
    Can somebody pls help me with the function module to get the difference between two dates?
    I need to find the difference value and delete records if >1.
    Thanks in advance.
    Regds,
    Leeza.

    Leeza,
       When I tested the FM in my Program, it is <b>working</b>!!!!!
       Note that the Two Input Dates are to be in the format of <b>DATS</b> type (Eg: <b>vimimv-dmibeg</b>).
      U can want the Day which u have specified in the parameter I_DATUM_BIS (eg: 20050101) to be included for
    the calculation , then put X in the parameter I_KZ_INCL_BIS.
    Sample Code :
    report zkam01.
    data:           
    <b>sav_nlaufz like rf60v-nlaufz, 
    date1 type vimimv-dmibeg,
    date2 type vimimv-dmiend.</b>
    date1 = '20050101'.
    date2 = '20051001'.
    call function 'MONTHS_BETWEEN_TWO_DATES'
         exporting
             i_datum_von   = date1
             i_datum_bis   = date2
             i_kz_incl_bis = 'X'
         importing
             e_monate      = sav_nlaufz.
    write:
    date1,
    / date2,
    / sav_nlaufz.
    Please allot points if the problem is solved.
    Thanks
    Kam
    Message was edited by: Kam

  • Function Module for Start time and End time

    Hi Experts,
    I need a function module for getting particular Work schedule rule start time and endtime and further details by passing personnel number and day.
    Thanks in advance.
    Sunil

    FYI - https://forums.sdn.sap.com/click.jspa?searchID=-1&messageID=5338428
    Thanks,
    SK

  • Function module to get attribute and value from organisation model

    Hi
    I need a function module to get the attribute and its corresponding values set on the sales org stucture.The export parameter will be the Sales Org Id.
    Please reply ASAP.
    Edited by: prem kumar on Apr 16, 2009 9:37 AM

    Hi Prem,
    If it helps, we use FM RHGA_READ_ATTRIBUTES for that in version 4.
    Kind regards,
    Garcia

  • 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

  • Function module for getting teh last working day of a month.

    Hi GURUS,
    this is criteria,please help me 
    if V_T001B- FRYE1 < month entered in selection screen
              Then throw the error message
                Else
    Find the previous period and its last working day from the function module
          (i..e Assume entered date as June 2 2009 then
                   Period 6 -1 = 5.
         Pass the month 05 to function module then
                   Find last working day.
                   Keep it in a variable (V_LAST_PRD_WRKDAY)
                           Proceed further.
    thanks in advance,
    Rajeev

    Hi Rajeev,
    You can use Function Module LAST_DAY_IN_PERIOD_GET.
    Ex:
          CALL FUNCTION 'LAST_DAY_IN_PERIOD_GET'
            EXPORTING
              i_gjahr = p_gjahr
              i_periv = lwa_t009b-periv
              i_poper = lwa_t009b-poper
            IMPORTING
              e_date  = s_audat-high.
    Regards,
    Ravi K

  • Getting first and last dates of a month

    Jello all,
    I am really sorry I am posting this topic here, not actually owned by this forum but in fundamental forum i am not getting it attended.
    I am generating monthly, quartelry and yearly reports, for which I need to get first and last dates of a given Month taking in to account leap year. I searched the API and docs for Calendar class. I could not find any useful methods / fields. I wonder this being a very common requirement, how SUN has not provided these essential features. I still feel, it must be some where. Please help me and reply. Also if you came across any other forum for util package, let me know.
    Thanks
    Varde

    Jello all,
    I am really sorry I am posting this topic here, not
    actually owned by this forum but in fundamental forum
    i am not getting it attended.
    Yes, and I can see you are a very patient person, waiting a whole half hour for a response before cross posting other boards.
    Question answered.
    http://forum.java.sun.com/thread.jsp?thread=514908&forum=31&message=2451646

  • Any function module to get Stock and value of material on a given date?

    Hi Friends
    Is there any function module available to get Stock/and  value of material on a given date?
    Thanks
    Harish

    Sorry I didn't elaborate the requirement.
    I am asked to develop a custom report for inventory management. For range of materials it is required to display stock and value on particular date and GRs GIs for the range.
    I need function module to use in Zreport.
    Thanks
    Harish

  • Function Module to get the MMBE transaction Data

    Hi All,
    My requirement is to calculate the open stock of a given part number in all the plants. I was told that the MMBE transaction in SAP can give me the data. So, I was searching for a function module or Bapi which could get this data which I can call in my program. Can anyone help me out?? Thanks.

    Hi Mohan,
    You can try this code..with slight modifications.. (to work for all PLANTS)
    Regards,
    Raj
    FUNCTION ZMM_ISSUES_PER_YEAR_POWER.
    ""Local interface:
    *"  IMPORTING
    *"     REFERENCE(I_MATNR) LIKE  MARA-MATNR
    *"     REFERENCE(I_PLANT) LIKE  T001W-WERKS
    *"     REFERENCE(I_GJAHR) LIKE  MSEG-GJAHR
    *"  EXPORTING
    *"     REFERENCE(E_STK_OPBAL) LIKE  BSIM-MENGE
    *"     REFERENCE(E_STK_VAL) LIKE  BSIM-DMBTR
    DATA : V_STK_OPBAL LIKE BSIM-MENGE,
           V_STK_VAL   LIKE BSIM-DMBTR,
           V_GJAHR     LIKE MSEG-GJAHR.
    DATA : BEGIN OF IT_BSIM OCCURS 0,
              MATNR LIKE BSIM-MATNR,
              SHKZG LIKE BSIM-SHKZG,
              MENGE LIKE BSIM-MENGE,
              DMBTR LIKE BSIM-DMBTR,
           END OF IT_BSIM.
    TYPES: BEGIN OF ST_MSEG,
              MATNR LIKE MSEG-MATNR,
              SHKZG LIKE MSEG-SHKZG,
              MENGE LIKE MSEG-MENGE,
              DMBTR LIKE MSEG-DMBTR,
              BWART LIKE MSEG-BWART,
              LGORT LIKE MSEG-LGORT,
           END OF ST_MSEG.
    DATA : IT_MSEG  TYPE ST_MSEG OCCURS 0 WITH HEADER LINE,
           TMP_MSEG TYPE ST_MSEG OCCURS 0 WITH HEADER LINE.
    DATA : BEGIN OF IT_MBEW OCCURS 0,
              MATNR LIKE MBEW-MATNR,
              LBKUM LIKE MBEW-LBKUM,
              SALK3 LIKE MBEW-SALK3,
           END OF IT_MBEW.
    *V_KEYDT = I_KEYDT + 1.
    SELECT MATNR
           SHKZG
           SUM( MENGE )
           SUM( DMBTR )
      INTO TABLE IT_BSIM
      FROM BSIM
    WHERE MATNR EQ I_MATNR
       AND BWKEY EQ I_PLANT
       AND GJAHR EQ I_GJAHR
       AND BLART IN ('RE','WE','WA','PR')
    GROUP BY MATNR SHKZG.
    *SELECT MATNR
          SUM( LBKUM )
          SUM( SALK3 )
    INTO TABLE IT_MBEW
    FROM MBEW
    WHERE MATNR EQ I_MATNR
      AND BWKEY EQ I_PLANT
      AND VPRSV EQ 'V'
      AND BWTAR EQ ''
    GROUP BY MATNR VPRSV.
    SELECT A~MATNR
           A~SHKZG
           SUM( A~MENGE )
           SUM( A~DMBTR )
           A~BWART
           A~LGORT
      INTO TABLE IT_MSEG
      FROM MKPF AS B
      JOIN MSEG AS A
        ON BMBLNR EQ AMBLNR
       AND BMJAHR EQ AMJAHR
    WHERE A~MATNR EQ I_MATNR
       AND A~WERKS EQ I_PLANT
       AND A~KZBEW IN (' ','B')
       AND A~BWART NOT IN ('541','542','321','322','121')
       AND A~KZVBR NOT IN ('A')
       AND A~GJAHR EQ I_GJAHR
    GROUP BY AMATNR ASHKZG ABWART ALGORT.
    LOOP AT IT_MSEG WHERE BWART EQ '544' AND LGORT EQ ''.
       TMP_MSEG = IT_MSEG.
       APPEND TMP_MSEG.
    ENDLOOP.
    DELETE IT_MSEG WHERE ( BWART EQ '309' AND DMBTR EQ 0  ).
    DELETE IT_MSEG WHERE ( BWART NE '543' AND LGORT EQ '' ).
    LOOP AT TMP_MSEG.
       IT_MSEG = TMP_MSEG.
       APPEND IT_MSEG.
    ENDLOOP.
    *READ TABLE IT_MBEW WITH KEY MATNR = I_MATNR.
    *V_STK_OPBAL = IT_MBEW-LBKUM.
    *V_STK_VAL   = IT_MBEW-SALK3.
    LOOP AT IT_MSEG.
       IF IT_MSEG-SHKZG EQ 'H'.
          V_STK_OPBAL = V_STK_OPBAL  - IT_MSEG-MENGE.
          V_STK_VAL   = V_STK_VAL    - IT_MSEG-DMBTR.
      ELSE.
         V_STK_OPBAL = V_STK_OPBAL  + IT_MSEG-MENGE.
       ENDIF.
    ENDLOOP.
    LOOP AT IT_BSIM.
       IF IT_BSIM-SHKZG EQ 'H'.
         V_STK_OPBAL = V_STK_OPBAL  - IT_BSIM-MENGE.
         V_STK_VAL   = V_STK_VAL    - IT_BSIM-DMBTR.
      ELSE.
         V_STK_OPBAL = V_STK_OPBAL  + IT_BSIM-MENGE.
         V_STK_VAL   = V_STK_VAL    + IT_BSIM-DMBTR.
       ENDIF.
    ENDLOOP.
    E_STK_OPBAL = V_STK_OPBAL.
    E_STK_VAL   = V_STK_VAL.
    ENDFUNCTION.

  • Getting Start and End Date of Current Year?

    Hi Folks,
    How do I get the start of the year and end of the year in Java ?
    If I say :
    Calendar cal = Calendar.getInstance();
    int day = cal.get(Calendar.DATE);
    int month = cal.get(Calendar.MONTH);
    int year = cal.get(Calendar.YEAR);
    System.out.println("Day: " + day);
    System.out.println("Month: " + month);
    System.out.println("Year: " + year);
    I get the current day and time.What I need is the start of the current Year (Jan 2010) and the End of the Current Year (Dec 2010).
    How can get the above 2 dates if I the current date is March 24th 2010 ?
    Thanks

    sabre150 wrote:
    What am I missing? The start date of 2010 is 1/1/2010 and the end data is 31/12/2010 . So, as I see it, at any time the only information you need is the current year which you currently get from int year = cal.get(Calendar.YEAR);
    Well, with the GregorianCalendar, anyway. ;-)

  • Function module to get user AND usergroup

    Hi Folks,
    I need a function module which returns the user and the usergroup.
    BAPI_USER_GETLIST won't work as it doesn't return the usergroup.
    There are some other function modules but none of them can be called remotely.
    I can't write a function module myself as we are working with validated systems.
    The whole approval process would take months...
    Does anybody know a function module which returns the user AND the usergroup AND can be called remotely?
    Hope somebody can help me.
    Bastian

    are you talking about usr02-CLASS values if yes
    BAPI_USER_GET_DETAIL returns this in
    export parameter LOGONDATA-class
    Regards
    Raja

Maybe you are looking for

  • You are viewing this document in PDF/A mode.

    In the latest version of Adobe Reader the message "You are viewing this document in PDF/A mode." is displayed very prominently when viewing PDF/A files. While fairly trivial if you are spending some time with the document this can be quite a nuisance

  • ITunes crashes/not responding

    My iTunes keeps crashing and stops responding. Closing and re-opening the application does not help. Neither does restarting. I reinstalled iTunes - it helped for about 10 minutes and then the same thing started happening again. thoughts? ideas? (i t

  • PO standard print program

    Hi experts, I have a requirement where we will dsiplay the PO output in different layout(landscape orientation, all items shown in one line only, additional info to be displayed). Now, the functional designer requires us to use the sap standard print

  • Datalist Tag in Forms

    Hello to All, I recently watched a really good and informative video by David Powers about Datalist for use in forms with a choice entry from a list to replace the <Select> tag. In the <select> option a user restricted to only one or more given optio

  • Security tables...

    Hello, I have requirement where I have to scan a role in SAP which has certain combination of T-Code, Object, Field and value. For example: I need to write a query which will find all roles in SAP which has following combination of T-Code, Object, Fi