<?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 Selecting data according to condition in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531389#M574033</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;     I have a requirement where , i have to fetch data of employees who joined or left the organisation in the previous month. &lt;/P&gt;&lt;P&gt;The condition is : if i run the report on 11th July, 2007, ...the data fetched must be between 1st June and 30th June , 2007.&lt;/P&gt;&lt;P&gt;                          if i run the report on 23rd March , 2007...the data fetched must be between 1st Feb and 28th Feb, 2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jul 2007 10:24:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-12T10:24:19Z</dc:date>
    <item>
      <title>Selecting data according to condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531389#M574033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;     I have a requirement where , i have to fetch data of employees who joined or left the organisation in the previous month. &lt;/P&gt;&lt;P&gt;The condition is : if i run the report on 11th July, 2007, ...the data fetched must be between 1st June and 30th June , 2007.&lt;/P&gt;&lt;P&gt;                          if i run the report on 23rd March , 2007...the data fetched must be between 1st Feb and 28th Feb, 2007.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i achieve this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 10:24:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531389#M574033</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T10:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting data according to condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531390#M574034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use the fm HR_JP_MONTH_BEGIN_END_DATE  pass any date of a particular month. fm returns the first date and last date of that month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now use ur logic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 10:30:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531390#M574034</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T10:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting data according to condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531391#M574035</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;It's not very clear but it seems you need the first and last day of the previuos month:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: DATE TYPE SY-DATUM VALUE '20070711',
          FIRST_DATE TYPE SY-DATUM,
          LAST_DATE  TYPE SY-DATUM.


LAST_DATE(6)     = DATE(6).
LAST_DATE+6(2) = '01'.
LAST_DATE = LAST_DATE - 1.

FIRST_DATE(6)     = LAST_DATE(6).
FIRST_DATE+6(2) = '01'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 10:31:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531391#M574035</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T10:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting data according to condition</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531392#M574036</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Balaji,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can capture date in some variable of type date, say l_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now l_date+4(2) shall give you the current month, deduct 1 from that. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_date type date,&lt;/P&gt;&lt;P&gt;         prev_month_same_day type date,&lt;/P&gt;&lt;P&gt;         prev_month type n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prev_month = l_date+4(2) - 1.&lt;/P&gt;&lt;P&gt;concatenate l_date&lt;EM&gt;0(4) prev_month l_date&lt;/EM&gt;6(2) into prev_month_same_day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now pass this prev_month_same_day to FM &amp;lt;b&amp;gt;HR_JP_MONTH_BEGIN_END_DATE&amp;lt;/b&amp;gt; . This shall return you the start date and end dates of the previous month. &lt;/P&gt;&lt;P&gt;From here i think you can solve on your own.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points if this helps,&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jul 2007 10:39:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-data-according-to-condition/m-p/2531392#M574036</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-12T10:39:52Z</dc:date>
    </item>
  </channel>
</rss>

