<?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 statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270079#M781644</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;i need to fetch lifnr  bukrs  and erdat from LFB1 table&lt;/P&gt;&lt;P&gt;following is the select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select lifnr&lt;/P&gt;&lt;P&gt;        bukrs&lt;/P&gt;&lt;P&gt;        erdat&lt;/P&gt;&lt;P&gt;        from lfb1&lt;/P&gt;&lt;P&gt;        into table gt_lfb1&lt;/P&gt;&lt;P&gt;        where lifnr in s_lifnr&lt;/P&gt;&lt;P&gt;        and bukrs in s_bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereas lfb1-lifnr fetched should not be in BSIK and BSAK table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection screen fields are&lt;/P&gt;&lt;P&gt;LFB1-LIFNR&lt;/P&gt;&lt;P&gt;LFB1-BUKRS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i fetch those lifnrs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please its urgent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jan 2008 14:08:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-03T14:08:39Z</dc:date>
    <item>
      <title>select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270079#M781644</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;i need to fetch lifnr  bukrs  and erdat from LFB1 table&lt;/P&gt;&lt;P&gt;following is the select query&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select lifnr&lt;/P&gt;&lt;P&gt;        bukrs&lt;/P&gt;&lt;P&gt;        erdat&lt;/P&gt;&lt;P&gt;        from lfb1&lt;/P&gt;&lt;P&gt;        into table gt_lfb1&lt;/P&gt;&lt;P&gt;        where lifnr in s_lifnr&lt;/P&gt;&lt;P&gt;        and bukrs in s_bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereas lfb1-lifnr fetched should not be in BSIK and BSAK table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection screen fields are&lt;/P&gt;&lt;P&gt;LFB1-LIFNR&lt;/P&gt;&lt;P&gt;LFB1-BUKRS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;how can i fetch those lifnrs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please its urgent.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 14:08:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270079#M781644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270080#M781645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECT a&lt;SUB&gt;lifnr a&lt;/SUB&gt;bukrs a~erdat&lt;/P&gt;&lt;P&gt;INTO TABLE &amp;lt;internal table&amp;gt;&lt;/P&gt;&lt;P&gt;FROM lfb1 as A LEFT OUTER JOIN bsik as B&lt;/P&gt;&lt;P&gt;ON A&lt;SUB&gt;lifnr = B&lt;/SUB&gt;lifnr and A&lt;SUB&gt;bukrs = B&lt;/SUB&gt;bukrs&lt;/P&gt;&lt;P&gt;left outer join bsak as c&lt;/P&gt;&lt;P&gt;ON A&lt;SUB&gt;lifnr = c&lt;/SUB&gt;lifnr and A&lt;SUB&gt;bukrs = c&lt;/SUB&gt;bukrs&lt;/P&gt;&lt;P&gt;where lifnr in s_lifnr&lt;/P&gt;&lt;P&gt;and bukrs in s_bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;madhavi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 14:13:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270080#M781645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270081#M781646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I take it you are not aware of the use of the LEFT OUTER JOIN statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 14:15:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270081#M781646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270082#M781647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can write exclude .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ,,,,,  &lt;/P&gt;&lt;P&gt;from bsak &lt;/P&gt;&lt;P&gt;for all entries in gt_lfb1&lt;/P&gt;&lt;P&gt;where lifnr ne gt_lfb1-lifnr&lt;/P&gt;&lt;P&gt;     and bukrs ne gt_lfb1-bukrs .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ,,,,,  &lt;/P&gt;&lt;P&gt;from bsik &lt;/P&gt;&lt;P&gt;for all entries in gt_lfb1&lt;/P&gt;&lt;P&gt;where lifnr ne gt_lfb1-lifnr&lt;/P&gt;&lt;P&gt;     and bukrs ne gt_lfb1-bukrs .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or  declare a range table , &lt;/P&gt;&lt;P&gt;append all vendors in gt_lfb1 into this range with addition excluding. &lt;/P&gt;&lt;P&gt;loop at gt_lfb1.&lt;/P&gt;&lt;P&gt;r_range-sign ='E'&lt;/P&gt;&lt;P&gt;r_range-option='EQ' &lt;/P&gt;&lt;P&gt;r_range-low = gt_lfb1-vendor .&lt;/P&gt;&lt;P&gt;append r_range.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use select query &lt;/P&gt;&lt;P&gt;select ,,,,&lt;/P&gt;&lt;P&gt;from bsik &lt;/P&gt;&lt;P&gt;where lifnr in r_range.&lt;/P&gt;&lt;P&gt;          bukrs in r_bukrs.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 14:19:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270082#M781647</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270083#M781648</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 below given select statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select lifnr into table it_lifnr from lfb1&lt;/P&gt;&lt;P&gt;       where lifnr not in ( select lifnr from bsik ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it will solve your problem.&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>Thu, 03 Jan 2008 14:20:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270083#M781648</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270084#M781649</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 do as below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Get all the lifnr from BSIK into itab for that company code. (No need to write select statement for BSAK as any posting is done against vendor it will first stored in BSIK, if it closed it will be in BSAK)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Use the select statement what you have written.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Write the below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at gt_lfb1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table gt_bsik with key bukrs = gt_lfb1-bukrs&lt;/P&gt;&lt;P&gt;                                        lifnr = gt_lfb1-lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;delete gt_lfb1.&lt;/P&gt;&lt;P&gt;clear  gt_lfb1.&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;Thanks,&lt;/P&gt;&lt;P&gt;Sriram Ponna.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 14:20:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270084#M781649</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270085#M781650</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;refer the below sample code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables:&lt;/P&gt;&lt;P&gt;       lfa1,&lt;/P&gt;&lt;P&gt;       lfb1.&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;     begin of x_lfa1 occurs 0,&lt;/P&gt;&lt;P&gt;           lifnr like lfa1-lifnr,&lt;/P&gt;&lt;P&gt;           bukrs like lfb1-bukrs,&lt;/P&gt;&lt;P&gt;           erdat like lfb1-erdat,&lt;/P&gt;&lt;P&gt;     end   of x_lfa1,&lt;/P&gt;&lt;P&gt;     begin of x_lifnr occurs 0,&lt;/P&gt;&lt;P&gt;           lifnr like lfa1-lifnr,&lt;/P&gt;&lt;P&gt;           bukrs like lfb1-bukrs,&lt;/P&gt;&lt;P&gt;     end   of x_lifnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen begin of block b1.&lt;/P&gt;&lt;P&gt;select-options:&lt;/P&gt;&lt;P&gt;               s_lifnr for lfa1-lifnr,&lt;/P&gt;&lt;P&gt;               s_bukrs for lfb1-bukrs.&lt;/P&gt;&lt;P&gt;selection-screen end   of block b1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select lifnr&lt;/P&gt;&lt;P&gt;       bukrs&lt;/P&gt;&lt;P&gt;       erdat from lfb1 into table x_lfa1&lt;/P&gt;&lt;P&gt;       where lifnr in s_lifnr&lt;/P&gt;&lt;P&gt;       and   bukrs in s_bukrs.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;   sort x_lfa1 by bukrs lifnr.&lt;/P&gt;&lt;P&gt;   select lifnr&lt;/P&gt;&lt;P&gt;          bukrs from bsak into table x_lifnr&lt;/P&gt;&lt;P&gt;                for all entries in x_lfa1&lt;/P&gt;&lt;P&gt;          where bukrs = x_lfa1-bukrs&lt;/P&gt;&lt;P&gt;          and   lifnr = x_lfa1-lifnr.&lt;/P&gt;&lt;P&gt;   if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      perform f_delete.&lt;/P&gt;&lt;P&gt;      if not x_lfa1[] is initial.&lt;/P&gt;&lt;P&gt;         select lifnr&lt;/P&gt;&lt;P&gt;                bukrs from bsik into table x_lifnr&lt;/P&gt;&lt;P&gt;                      for all entries in x_lfa1&lt;/P&gt;&lt;P&gt;                where bukrs = x_lfa1-bukrs&lt;/P&gt;&lt;P&gt;                and   lifnr = x_lfa1-lifnr.&lt;/P&gt;&lt;P&gt;         if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;            perform f_delete.&lt;/P&gt;&lt;P&gt;         endif.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at x_lfa1.&lt;/P&gt;&lt;P&gt;     write:/ x_lfa1-lifnr.&lt;/P&gt;&lt;P&gt;     clear x_lfa1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form f_delete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  sort x_lfa1 by lifnr bukrs.&lt;/P&gt;&lt;P&gt;  loop at x_lifnr.&lt;/P&gt;&lt;P&gt;    read table x_lfa1 with key lifnr = x_lifnr-lifnr&lt;/P&gt;&lt;P&gt;                         bukrs = x_lifnr-bukrs&lt;/P&gt;&lt;P&gt;                         binary search.&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;       delete table x_lfa1.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;    clear: x_lifnr,&lt;/P&gt;&lt;P&gt;           x_lfa1.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;  refresh x_lifnr.&lt;/P&gt;&lt;P&gt;endform.                    " f_delete&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sreeram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2008 14:31:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/3270085#M781650</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-03T14:31:53Z</dc:date>
    </item>
  </channel>
</rss>

