<?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: sample code for month / year needed in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563909#M254908</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kris , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make use of MM_ARRANG_SPMON_RANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as per ur requirement u have to get o/p month wise , in that case :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first u have to get the data from given period ( user input ) after that  u have to manipulate with the data to get in month wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. select * from BKPF into corresponding field of i_bkpf &lt;/P&gt;&lt;P&gt;    where bukrs in s_bukrs &lt;/P&gt;&lt;P&gt;      and budat in s_budat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. After that Divied ur output month wise by using the that FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Sep 2006 04:41:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-21T04:41:36Z</dc:date>
    <item>
      <title>sample code for month / year needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563904#M254903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have data for:&lt;/P&gt;&lt;P&gt;month1 = m1&lt;/P&gt;&lt;P&gt;year1 = y1&lt;/P&gt;&lt;P&gt;month2 = m2&lt;/P&gt;&lt;P&gt;year2 = y2.&lt;/P&gt;&lt;P&gt;Now I want to go to bkpf and give the data for bukrs, belnr, gjahr (from y1 to y2), monat (from m1 to m2) and get all the corresponding entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example: If month1 = 3, year1 = 2003&lt;/P&gt;&lt;P&gt;month2 = 5, year2 = 2005, I want to get all the entries as explained above for:&lt;/P&gt;&lt;P&gt;(3,2003) to (12,2003)&lt;/P&gt;&lt;P&gt;(1,2004) to (12,2004)&lt;/P&gt;&lt;P&gt;(1,2005) to (12,2005)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(and not just for months 3 to 5 for years 2003 to 2005 as normally many abappers will do)&lt;/P&gt;&lt;P&gt;Can you give me a sample code here with out affecting performance please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishen&lt;/P&gt;&lt;P&gt;P.S.Shall definitely award points for helpful answers and thanks in advance for your input.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 04:11:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563904#M254903</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T04:11:09Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for month / year needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563905#M254904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Krishnen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In BKPF table... u have a field called BUDAT (Posting date) / BLDAT (Document date) ....&lt;/P&gt;&lt;P&gt;Check whether on what criteria u r going to fetch data from the database ... either by Posting date / document date ??? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Say for ex.. u need to fetch records based on document date BLDAT ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BLDAT is a date field.... of the form YYYYMMDD ... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so u can query like this ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT BUKRS BELNR GJAHR FROM BKPF&lt;/P&gt;&lt;P&gt;INTO TABLE ITAB_BKPF &lt;/P&gt;&lt;P&gt;WHERE ( ( BLDAT &amp;gt;= '20030301' AND &lt;/P&gt;&lt;P&gt;        BLDAT &amp;lt;= '20051231' ) .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the above query will help in fetching up of all the records which falls bet march 2003 to december 2005 ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps u &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Kripa Rangachari ...................................&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 04:25:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563905#M254904</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T04:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for month / year needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563906#M254905</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;Try like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
N = ( year2 - year1 ) + 1
M1 = month 1.
M2 = Month2.
Y = year1.

IF N GT 1.
Do N times.
  case sy-tabix.
   when 1.
      select .... from bkpf
      into table IT_BKPF
      Where gjahr = Y
        and monat GE M1
        and monat LE 12.  
   when N.
      select .... from bkpf
      Appending table IT_BKPF
      Where gjahr = Y
        and monat GE 1
        and monat LE M2.
   when others.
      select .... from bkpf
      Appending table IT_BKPF
      Where gjahr = Y
        and monat GE 1
        and monat LE 12.
  endcase.
  add 1 to Y.
enddo.  
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it help you,&lt;/P&gt;&lt;P&gt;Regards &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 04:32:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563906#M254905</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T04:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for month / year needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563907#M254906</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Kripa and Jatra. &lt;/P&gt;&lt;P&gt;Kripa, I have a question for you. Is posting date (BUDAT) always lies in posting period (MONAT) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please clarify this. Your solution seems to be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Krishen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 04:35:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563907#M254906</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T04:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for month / year needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563908#M254907</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Krishnen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes .... Posting period is nothing but the month of posting ... which will definitely fall in an year &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just check with ur consultants whether they are in need of a report based on Posting date / document date ... and query ur database based on that ...... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Kripa Rangachari .............&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 04:40:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563908#M254907</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T04:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for month / year needed</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563909#M254908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kris , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;make use of MM_ARRANG_SPMON_RANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as per ur requirement u have to get o/p month wise , in that case :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first u have to get the data from given period ( user input ) after that  u have to manipulate with the data to get in month wise.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. select * from BKPF into corresponding field of i_bkpf &lt;/P&gt;&lt;P&gt;    where bukrs in s_bukrs &lt;/P&gt;&lt;P&gt;      and budat in s_budat.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. After that Divied ur output month wise by using the that FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Prabhu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Sep 2006 04:41:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-month-year-needed/m-p/1563909#M254908</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-21T04:41:36Z</dc:date>
    </item>
  </channel>
</rss>

