<?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: Retrieve data from database in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234729#M1209853</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Swapnika,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;take year as a select option.&lt;/P&gt;&lt;P&gt;month as a select option&lt;/P&gt;&lt;P&gt;and emp as a select option.&lt;/P&gt;&lt;P&gt;and code is.*****************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: vbrk.&lt;/P&gt;&lt;P&gt;select-options: s_year for vbrk-gjahr obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             s_month for vbrk-inco1 obligatory,&lt;/P&gt;&lt;P&gt;            s_empno for table-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: py type gjahr,&lt;/P&gt;&lt;P&gt;      cy type gjahr,&lt;/P&gt;&lt;P&gt;      lin type i,&lt;/P&gt;&lt;P&gt;      count type i.&lt;/P&gt;&lt;P&gt; data: begin of jtab occurs 0,&lt;/P&gt;&lt;P&gt;       month like vbrk-inco1,&lt;/P&gt;&lt;P&gt;       year like vbrk-gjahr,&lt;/P&gt;&lt;P&gt;       end of jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;py = s_year-low.&lt;/P&gt;&lt;P&gt;cy = s_year-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'APR'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'MAY'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'JUN'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'JULY'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'AUG'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'SEP'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'OCT'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'NOV'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'DEC'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'JAN'.&lt;/P&gt;&lt;P&gt;jtab-year = cy.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'FEB'.&lt;/P&gt;&lt;P&gt;jtab-year = cy.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'MAR'.&lt;/P&gt;&lt;P&gt;jtab-year = cy.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table jtab with key month = s_month-high.&lt;/P&gt;&lt;P&gt;count = sy-tabix.&lt;/P&gt;&lt;P&gt;data: count1 type i.&lt;/P&gt;&lt;P&gt;count1 = count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete jtab from count1.&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;In select query jus do&lt;/P&gt;&lt;P&gt;select * from ztable into table itab for all entris in jtab where&lt;/P&gt;&lt;P&gt;month = jtab-month &lt;/P&gt;&lt;P&gt;and year = jtab-year  and &lt;/P&gt;&lt;P&gt;emp in s_empno.&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;you will get the desired result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Feb 2009 05:18:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-02-26T05:18:32Z</dc:date>
    <item>
      <title>Retrieve data from database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234725#M1209849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi friends,&lt;/P&gt;&lt;P&gt;I need a logical solution.&lt;/P&gt;&lt;P&gt;I have 10 yrs employees data. I have upload only basic salary through bdc in database table.&lt;/P&gt;&lt;P&gt;I have a MODULE POOL screen, On screen month ,year  and emp. no. (3 text fields) is available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have several records of April(2001,2002........2009) ,May(2001,2002, 2003.......2009)..........Jan(2001,2002, 2003..........2009) . To neglect the overwrite of emp no. i have taken (empno, month, year) as aprimary key in database table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My requirement is When i input month, year and employee no. on screen of particular employee the whole data of current financial year (april 2008 to jan 2009) should be selected from the database table. Not a previous year (2006, 2007, 2008). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One more thing we  need to consider if we r extracting data of same year means we want data till Dec.2008 the data should be extract  from april 2008 to dec 2008. If we wanna data Till Jan. 2009 the should be retrieve April 2008 to Jan 2009. Not  be previous finacial year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz reply as soon as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Swapnika&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:17:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234725#M1209849</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234726#M1209850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Swapnika &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To achieve this first you create an internal table  and pass month data to it based on current month like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES : BEGIN OF tp_month,&lt;/P&gt;&lt;P&gt;        cmonth TYPE znel_perform-cmonth,&lt;/P&gt;&lt;P&gt;        END OF tp_month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;t_month TYPE STANDARD TABLE OF tp_month WITH HEADER LINE,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Get the current month in a variable .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;l_month = sy-datum+4(2).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF l_month EQ '01'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 09.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'SEPTEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'OCTOBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'NOVEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'DECEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '02'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 10.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'SEPTEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'OCTOBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'NOVEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'DECEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JANUARY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '03'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 11.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'SEPTEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'OCTOBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'NOVEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'DECEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JANUARY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'FEBRUARY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '04'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 1.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '05'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 1.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '06'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 2.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '07'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 3.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '08'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 4.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '09'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 5.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '10'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 6.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'SEPTEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '11'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 7.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'SEPTEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'OCTOBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ELSEIF l_month EQ '12'.&lt;/P&gt;&lt;P&gt;    CLEAR : l_rows.&lt;/P&gt;&lt;P&gt;    l_rows = 8.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'APRIL'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'MAY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JUNE'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'JULY'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'AUGUST'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'SEPTEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'OCTOBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;    t_month-cmonth = 'NOVEMBER'.&lt;/P&gt;&lt;P&gt;    APPEND t_month.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now when you loop data  read this table and check if month belongs to any of the months in this table a&lt;/P&gt;&lt;P&gt;and then proceed .&lt;/P&gt;&lt;P&gt;You can even use ranges instead of a table to achieve this  and add it as a condition in select .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any issues update  &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:34:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234726#M1209850</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234727#M1209851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a question. &lt;/P&gt;&lt;P&gt;1. When you are selecting the data from April to Dec or April to Jan why you are giving option of Month in Input screen. You can give only Employee id and Year. Let me confirm ur requirement if user enters&lt;/P&gt;&lt;P&gt;Dec in input screen then should u bring from April to Dec ? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can fetch data based on Employee id and Year, once if you have to fecth data from April to Dec,&lt;/P&gt;&lt;P&gt; then read your internal table with the months you required and populate.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 04:34:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234727#M1209851</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T04:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234728#M1209852</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;According to me the logic would be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select-options: s_month-low &amp;amp; s_month-high, s_year-low &amp;amp; s_year-high, s_emp_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. write in PBO.&lt;/P&gt;&lt;P&gt;data: ldate like sy-datum.&lt;/P&gt;&lt;P&gt;        lyear type char4.&lt;/P&gt;&lt;P&gt;vdate = sy-datum+4(4).  ******this will give u current year.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     if s_year-low or s_year-high = lyear.&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;select -&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt;ur fields -&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt;from -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; into -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; where s_month BETWEEN  '04' AND '01'                                                                                &lt;/P&gt;&lt;P&gt;and s_year BETWEEN ( lyear - 1)  AND lyear&lt;/P&gt;&lt;P&gt;                                                                                and emp in s_emp_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="8" type="ul"&gt;&lt;P&gt;if we calculate for same year like 2008, than it will fetch data from april to dec. 2008 or in one of the select option we give the value ******&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    elseif ( s_year-low = s_year-high ) or s_year NE 0 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      select -&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt;ur fields -&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt;from -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; into -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; where month BETWEEN  '04' AND '12'                                                                                &lt;/P&gt;&lt;P&gt;and year in s_year&lt;/P&gt;&lt;P&gt;                                                                              and emp in s_emp_no.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;elseif s_month-high = '01'&lt;/P&gt;&lt;P&gt; select -&lt;/P&gt;&lt;HR originaltext="---------" /&gt;&lt;P&gt;ur fields -&lt;/P&gt;&lt;HR originaltext="----------" /&gt;&lt;P&gt;from -&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt; into -&lt;/P&gt;&lt;HR originaltext="-----" /&gt;&lt;P&gt; where s_month BETWEEN  '04' AND '01' &lt;/P&gt;&lt;P&gt;                                                                           and s_year BETWEEN ( lyear - 1) AND lyear&lt;/P&gt;&lt;P&gt;                                                                           and emp in s_emp_no.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Probably this could be the nearest solution. i have written logic only, try to implement like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Rudhir&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 05:06:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234728#M1209852</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T05:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve data from database</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234729#M1209853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Swapnika,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;take year as a select option.&lt;/P&gt;&lt;P&gt;month as a select option&lt;/P&gt;&lt;P&gt;and emp as a select option.&lt;/P&gt;&lt;P&gt;and code is.*****************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: vbrk.&lt;/P&gt;&lt;P&gt;select-options: s_year for vbrk-gjahr obligatory,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             s_month for vbrk-inco1 obligatory,&lt;/P&gt;&lt;P&gt;            s_empno for table-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: py type gjahr,&lt;/P&gt;&lt;P&gt;      cy type gjahr,&lt;/P&gt;&lt;P&gt;      lin type i,&lt;/P&gt;&lt;P&gt;      count type i.&lt;/P&gt;&lt;P&gt; data: begin of jtab occurs 0,&lt;/P&gt;&lt;P&gt;       month like vbrk-inco1,&lt;/P&gt;&lt;P&gt;       year like vbrk-gjahr,&lt;/P&gt;&lt;P&gt;       end of jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;py = s_year-low.&lt;/P&gt;&lt;P&gt;cy = s_year-high.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'APR'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'MAY'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'JUN'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'JULY'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'AUG'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'SEP'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'OCT'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'NOV'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'DEC'.&lt;/P&gt;&lt;P&gt;jtab-year = py.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'JAN'.&lt;/P&gt;&lt;P&gt;jtab-year = cy.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'FEB'.&lt;/P&gt;&lt;P&gt;jtab-year = cy.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;jtab-month = 'MAR'.&lt;/P&gt;&lt;P&gt;jtab-year = cy.&lt;/P&gt;&lt;P&gt;append jtab.&lt;/P&gt;&lt;P&gt;clear jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table jtab with key month = s_month-high.&lt;/P&gt;&lt;P&gt;count = sy-tabix.&lt;/P&gt;&lt;P&gt;data: count1 type i.&lt;/P&gt;&lt;P&gt;count1 = count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;delete jtab from count1.&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;In select query jus do&lt;/P&gt;&lt;P&gt;select * from ztable into table itab for all entris in jtab where&lt;/P&gt;&lt;P&gt;month = jtab-month &lt;/P&gt;&lt;P&gt;and year = jtab-year  and &lt;/P&gt;&lt;P&gt;emp in s_empno.&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;you will get the desired result&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Feb 2009 05:18:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/retrieve-data-from-database/m-p/5234729#M1209853</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-02-26T05:18:32Z</dc:date>
    </item>
  </channel>
</rss>

