<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reg : Dates in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007558#M1165765</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) In selection screen if i enter any date range it should show the total month data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex: suppose i given 15.01.2009.&lt;/P&gt;&lt;P&gt;i have to retrieve from 01.01.2009 to 31.01.2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ans&lt;/STRONG&gt;: CONCATENATE p_date+0(6)  '01' INTO v_beg_date.   &lt;/P&gt;&lt;P&gt;       CALL FUNCTION 'FKK_LAST_DAY_OF_MONTH'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;         day_in            = v_beg_date&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;         last_day_of_month = v_end_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      p_date = 20090115&lt;/P&gt;&lt;P&gt;      v_beg_date = 20090101.&lt;/P&gt;&lt;P&gt;      v_end_date = 20090131.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Actually my requirement is i have to retrieve the data which is entered from the current month of given date in selection screen, it should get me the previous 2 months data? whatsthe function module for getting this&lt;/P&gt;&lt;P&gt;ex: suppose i given 01-01-2009&lt;/P&gt;&lt;P&gt;i have to retrieve pervious months data between 01-11-2008 to 30-12-2008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ANS :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BKK_ADD_MONTH_TO_DATE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      months  = '-2'&lt;/P&gt;&lt;P&gt;      olddate = v_beg_date               " 01.01.2009&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      newdate = v_ndate.                  " 01.11.2008&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 15 Jan 2009 05:58:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-15T05:58:45Z</dc:date>
    <item>
      <title>Reg : Dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007556#M1165763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) In selection screen if i enter any date range it should show the total month data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex: suppose i given 15.01.2009.&lt;/P&gt;&lt;P&gt;     i have to retrieve from 01.01.2009 to 31.01.2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)  Actually my requirement is i have to retrieve the data which is entered from the current month of given date in selection screen, it should get me the previous 2 months data? whatsthe function module for getting this&lt;/P&gt;&lt;P&gt;ex: suppose i given 01-01-2009&lt;/P&gt;&lt;P&gt;i have to retrieve pervious months data between 01-11-2008 to 30-12-2008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks &amp;amp; regards&lt;/P&gt;&lt;P&gt;marreddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2009 05:49:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007556#M1165763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-15T05:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : Dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007557#M1165764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use FM SG_PS_GET_LAST_DAY_OF_MONTH to get last day of the month&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get previous month date use FM HR_JP_ADD_MONTH_TO_DATE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2009 05:57:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007557#M1165764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-15T05:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : Dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007558#M1165765</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) In selection screen if i enter any date range it should show the total month data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex: suppose i given 15.01.2009.&lt;/P&gt;&lt;P&gt;i have to retrieve from 01.01.2009 to 31.01.2009&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Ans&lt;/STRONG&gt;: CONCATENATE p_date+0(6)  '01' INTO v_beg_date.   &lt;/P&gt;&lt;P&gt;       CALL FUNCTION 'FKK_LAST_DAY_OF_MONTH'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;         day_in            = v_beg_date&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;         last_day_of_month = v_end_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      p_date = 20090115&lt;/P&gt;&lt;P&gt;      v_beg_date = 20090101.&lt;/P&gt;&lt;P&gt;      v_end_date = 20090131.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Actually my requirement is i have to retrieve the data which is entered from the current month of given date in selection screen, it should get me the previous 2 months data? whatsthe function module for getting this&lt;/P&gt;&lt;P&gt;ex: suppose i given 01-01-2009&lt;/P&gt;&lt;P&gt;i have to retrieve pervious months data between 01-11-2008 to 30-12-2008&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ANS :&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'BKK_ADD_MONTH_TO_DATE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      months  = '-2'&lt;/P&gt;&lt;P&gt;      olddate = v_beg_date               " 01.01.2009&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      newdate = v_ndate.                  " 01.11.2008&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2009 05:58:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007558#M1165765</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-15T05:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : Dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007559#M1165766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can try these fm's&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FM_GET_DATES_FROM_PERIOD&lt;/P&gt;&lt;P&gt;RKE_GET_FIRST_DAY_IN_PERIOD&lt;/P&gt;&lt;P&gt;RKE_GET_LAST_DAY_IN_PERIOD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aakash Banga&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2009 06:05:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007559#M1165766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-15T06:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : Dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007560#M1165767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can make use of the class CL_HRPAD_DATE_COMPUTATIONS for your calculations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz try the code below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

PARAMETERS: P_DATE TYPE SY-DATUM DEFAULT SY-DATUM.

DATA:
V_DATE TYPE DATUM,
V_DAT1 TYPE SY-DATUM,
V_DAT2 TYPE SY-DATUM.


CONCATENATE P_DATE+0(6) '01' INTO V_DATE. "First date of the monhn

V_DAT2 = V_DATE - 1. "Last day of previous month


CALL METHOD CL_HRPAD_DATE_COMPUTATIONS=&amp;gt;SUBTRACT_MONTHS_FROM_DATE
  EXPORTING
    START_DATE = V_DATE
    MONTHS     = 2
  RECEIVING
    DATE       = V_DAT1. "Lower Date i.e., 1st date of 2 months prior

WRITE: V_DAT1, V_DAT2.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you can use the variables V_DAT1 &amp;amp; V_DAT2 to get the data using BETWEEN addition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Jan 2009 06:43:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007560#M1165767</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-01-15T06:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reg : Dates</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007561#M1165768</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Check the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: w_dat TYPE dats,
      w_date_s1 TYPE dats, 
      w_date_s2 TYPE dats,
      w_date_e1 TYPE dats,
      w_date_e2 TYPE dats,
      w_month1 TYPE ltx,
      w_month2 TYPE ltx.

w_dat = sy-datum. "So this is january as of now
PERFORM get_date USING 2
                 CHANGING w_date_s1 w_date_e1 w_month1. "Here you will get nov start and end date

PERFORM get_date USING 1
                 CHANGING w_date_s2 w_date_e2 w_month2. "Here you will get dec start and end date


WRITE:      / w_month1 , ':', w_date_s1, w_date_e1, 
            / w_month2 , ':', w_date_s2, w_date_e2.


FORM get_date USING p_month TYPE numc3
              CHANGING p_dat1 TYPE dats
                       p_dat2 TYPE dats
                       p_name TYPE ltx.

  DATA:lw_dat TYPE dats,
       lw_var(6) TYPE c,
       lw_month(2) TYPE c.


  DATA: lit_month LIKE t247 OCCURS 0 WITH HEADER LINE.

  CALL FUNCTION 'CCM_GO_BACK_MONTHS'
       EXPORTING
            currdate   = w_dat  "your date from select-option
            backmonths = p_month
       IMPORTING
            newdate    = lw_dat.


  CALL FUNCTION 'SG_PS_GET_LAST_DAY_OF_MONTH'
       EXPORTING
            day_in            = lw_dat
       IMPORTING
            last_day_of_month =
               p_dat2 "Now w_date_e is end date of last month
       EXCEPTIONS
            OTHERS            = 1. "of date in w_date


  lw_var = p_dat2+0(6).
  lw_month = p_dat2+4(2).

  CONCATENATE lw_var '01' INTO p_dat1. "Create first date

  CALL FUNCTION 'MONTH_NAMES_GET' "Get the month name
       TABLES
            month_names = lit_month.
  READ TABLE lit_month INDEX lw_month.
  p_name = lit_month-ltx.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;o/p:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;November                       : 01.11.2008 30.11.2008
December                       : 01.12.2008 31.12.2008&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now use w_date_s1, w_date_e1 to get Nov month details and&lt;/P&gt;&lt;P&gt;             w_date_s2, w_date_e2 for dec month details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj Kumar P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Jan 2009 09:32:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dates/m-p/5007561#M1165768</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-16T09:32:06Z</dc:date>
    </item>
  </channel>
</rss>

