<?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 Select stmt in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526492#M241037</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a task this way:&lt;/P&gt;&lt;P&gt;I need to fetch some records based on a logic from CATSDB table. After applying a series of conditions, I have the final data. For this data, I need to fetch the name, personnel number, payroll area (SNAME, WERKS, ABKRS) from infotype 1. I am using the following logic:&lt;/P&gt;&lt;P&gt;select  PERNR&lt;/P&gt;&lt;P&gt;        BEGDA&lt;/P&gt;&lt;P&gt;        SNAME&lt;/P&gt;&lt;P&gt;        WERKS&lt;/P&gt;&lt;P&gt;        ABKRS&lt;/P&gt;&lt;P&gt;        from PA0001 into corresponding fields of table GT_PA0001&lt;/P&gt;&lt;P&gt;        for all entries in GT_FINAL&lt;/P&gt;&lt;P&gt;        where PERNR = GT_FINAL-pernr AND              &lt;/P&gt;&lt;P&gt;              BEGDA &amp;lt;= SP_ENDDA AND&lt;/P&gt;&lt;P&gt;              ENDDA &amp;gt;= SP_BEGDA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT GT_FINAL.                                    &lt;/P&gt;&lt;P&gt;  read table gt_pa0001 with key pernr = gt_final-pernr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      binary search.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      GT_FINAL-SNAME = GT_PA0001-SNAME.&lt;/P&gt;&lt;P&gt;      GT_FINAL-WERKS = GT_PA0001-WERKS.&lt;/P&gt;&lt;P&gt;      GT_FINAL-ABKRS = GT_PA0001-ABKRS.&lt;/P&gt;&lt;P&gt;      MODIFY GT_FINAL.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, GT_FINAL is the final output to be displayed. It has the following fields:&lt;/P&gt;&lt;P&gt;	 PERNR&lt;/P&gt;&lt;P&gt;         COUNTER&lt;/P&gt;&lt;P&gt;         WORKDATE&lt;/P&gt;&lt;P&gt;         CATSHOURS&lt;/P&gt;&lt;P&gt;         AWART&lt;/P&gt;&lt;P&gt;         PRAKN&lt;/P&gt;&lt;P&gt;         ZZPSPNR&lt;/P&gt;&lt;P&gt;         RNPLNR&lt;/P&gt;&lt;P&gt;         RKOSTL&lt;/P&gt;&lt;P&gt;         ZZALTC1&lt;/P&gt;&lt;P&gt;         ERNAM&lt;/P&gt;&lt;P&gt;         ERSDA&lt;/P&gt;&lt;P&gt;         AENAM&lt;/P&gt;&lt;P&gt;         LAEDA&lt;/P&gt;&lt;P&gt;	 SNAME&lt;/P&gt;&lt;P&gt;	WERKS&lt;/P&gt;&lt;P&gt;	ABKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I am not getting the correct logic to append the employee personnel area/payroll area depending upon the begda and endda of selection screen.&lt;/P&gt;&lt;P&gt;Secondly, how to update the gt_final internal table with the data of gt_pa0001? i also want performance.&lt;/P&gt;&lt;P&gt;Can anyone help. It is very urgent.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Aug 2006 05:13:25 GMT</pubDate>
    <dc:creator>abdulazeez12</dc:creator>
    <dc:date>2006-08-29T05:13:25Z</dc:date>
    <item>
      <title>Select stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526492#M241037</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a task this way:&lt;/P&gt;&lt;P&gt;I need to fetch some records based on a logic from CATSDB table. After applying a series of conditions, I have the final data. For this data, I need to fetch the name, personnel number, payroll area (SNAME, WERKS, ABKRS) from infotype 1. I am using the following logic:&lt;/P&gt;&lt;P&gt;select  PERNR&lt;/P&gt;&lt;P&gt;        BEGDA&lt;/P&gt;&lt;P&gt;        SNAME&lt;/P&gt;&lt;P&gt;        WERKS&lt;/P&gt;&lt;P&gt;        ABKRS&lt;/P&gt;&lt;P&gt;        from PA0001 into corresponding fields of table GT_PA0001&lt;/P&gt;&lt;P&gt;        for all entries in GT_FINAL&lt;/P&gt;&lt;P&gt;        where PERNR = GT_FINAL-pernr AND              &lt;/P&gt;&lt;P&gt;              BEGDA &amp;lt;= SP_ENDDA AND&lt;/P&gt;&lt;P&gt;              ENDDA &amp;gt;= SP_BEGDA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT GT_FINAL.                                    &lt;/P&gt;&lt;P&gt;  read table gt_pa0001 with key pernr = gt_final-pernr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      binary search.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      GT_FINAL-SNAME = GT_PA0001-SNAME.&lt;/P&gt;&lt;P&gt;      GT_FINAL-WERKS = GT_PA0001-WERKS.&lt;/P&gt;&lt;P&gt;      GT_FINAL-ABKRS = GT_PA0001-ABKRS.&lt;/P&gt;&lt;P&gt;      MODIFY GT_FINAL.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, GT_FINAL is the final output to be displayed. It has the following fields:&lt;/P&gt;&lt;P&gt;	 PERNR&lt;/P&gt;&lt;P&gt;         COUNTER&lt;/P&gt;&lt;P&gt;         WORKDATE&lt;/P&gt;&lt;P&gt;         CATSHOURS&lt;/P&gt;&lt;P&gt;         AWART&lt;/P&gt;&lt;P&gt;         PRAKN&lt;/P&gt;&lt;P&gt;         ZZPSPNR&lt;/P&gt;&lt;P&gt;         RNPLNR&lt;/P&gt;&lt;P&gt;         RKOSTL&lt;/P&gt;&lt;P&gt;         ZZALTC1&lt;/P&gt;&lt;P&gt;         ERNAM&lt;/P&gt;&lt;P&gt;         ERSDA&lt;/P&gt;&lt;P&gt;         AENAM&lt;/P&gt;&lt;P&gt;         LAEDA&lt;/P&gt;&lt;P&gt;	 SNAME&lt;/P&gt;&lt;P&gt;	WERKS&lt;/P&gt;&lt;P&gt;	ABKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, I am not getting the correct logic to append the employee personnel area/payroll area depending upon the begda and endda of selection screen.&lt;/P&gt;&lt;P&gt;Secondly, how to update the gt_final internal table with the data of gt_pa0001? i also want performance.&lt;/P&gt;&lt;P&gt;Can anyone help. It is very urgent.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 05:13:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526492#M241037</guid>
      <dc:creator>abdulazeez12</dc:creator>
      <dc:date>2006-08-29T05:13:25Z</dc:date>
    </item>
    <item>
      <title>Re: Select stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526493#M241038</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;why are you filling 'GT_PA0001' can can get values directly from table pa0001 into gt_final. in this way you can save an Extra loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT gt_final.
select 
SNAME
WERKS
ABKRS
from PA0001 into corresponding fields of GT_final
where PERNR = GT_FINAL-pernr AND 
BEGDA &amp;lt;= SP_ENDDA AND
ENDDA &amp;gt;= SP_BEGDA.

MODIFY gt_final.

ENDOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;lt;/b&amp;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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 05:23:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526493#M241038</guid>
      <dc:creator>dani_mn</dc:creator>
      <dc:date>2006-08-29T05:23:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select stmt</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526494#M241039</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;  use SORT gt_pa0001 by PERNR, since you are using binary search..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Check if the internal table is not initial before using the FOR ALL ENTRIES..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF NOT GT_FINAL[] IS INITIAL.&lt;/P&gt;&lt;P&gt;     SELECT...FROM ..PA0001.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2006 05:23:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-stmt/m-p/1526494#M241039</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-29T05:23:42Z</dc:date>
    </item>
  </channel>
</rss>

