<?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: Problem in select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963313#M946736</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use APPENDING option of select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;G@urav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jun 2008 14:09:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-12T14:09:54Z</dc:date>
    <item>
      <title>Problem in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963312#M946735</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 had a problem with a select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have taken 4 internal tables.&lt;/P&gt;&lt;P&gt;1)it_kna1&lt;/P&gt;&lt;P&gt;2)it_item1&lt;/P&gt;&lt;P&gt;3)it_item2&lt;/P&gt;&lt;P&gt;4) it_item3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am filling the it_kna1 with the following select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select kunnr&lt;/P&gt;&lt;P&gt;       name1&lt;/P&gt;&lt;P&gt;       stras&lt;/P&gt;&lt;P&gt;       pstlz&lt;/P&gt;&lt;P&gt;       ort01&lt;/P&gt;&lt;P&gt;       land1&lt;/P&gt;&lt;P&gt;       from kna1 into corresponding fields of table it_kna1 where kunnr&lt;/P&gt;&lt;P&gt;in s_kunnr and brsch in s_brsch.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next for all customers selected in it_kna1 i am getting the data from the bsad by using following query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF it_kna1[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select blart belnr kunnr xblnr zuonr sgtxt budat augdt augbl shkzg from&lt;/P&gt;&lt;P&gt;bsad INTO CORRESPONDING FIELDS OF TABLE it_item1&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN it_kna1&lt;/P&gt;&lt;P&gt;where kunnr = it_kna1-kunnr and&lt;/P&gt;&lt;P&gt;      blart = p_blart and&lt;/P&gt;&lt;P&gt;      budat in s_budat and&lt;/P&gt;&lt;P&gt;      augdt in s_augdt and&lt;/P&gt;&lt;P&gt;      shkzg in s_shkzg and&lt;/P&gt;&lt;P&gt;      bukrs = p_bukrs.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in the it_kna1 i need to fill up some more fields based on the following.So how to fill only those records.I am using the following query to fill up.But it is deleting the existing records in it_item1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select hkont dmbtr from bseg into corresponding fields of table it_item3&lt;/P&gt;&lt;P&gt; for all entries in it_item1 where belnr = it_item1-belnr and koart in&lt;/P&gt;&lt;P&gt;s_koart and   dmbtr &amp;gt; '8000' and bukrs = p_bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to solve this problem&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 14:07:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963312#M946735</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T14:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963313#M946736</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use APPENDING option of select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;G@urav.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 14:09:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963313#M946736</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T14:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem in select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963314#M946737</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hii&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use READ statement &amp;amp; MODIFY to solve this.i think it will work here.&lt;/P&gt;&lt;P&gt;use it like given below.here select query will not work for an internal table so you need to use loop at &amp;amp; READ statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF i_marc[] IS NOT INITIAL.

    SELECT matnr                       " Material Number
           werks                       " Plants
           lgort                       " Storage Location
      FROM mard
      INTO TABLE i_mard
       FOR ALL ENTRIES IN i_marc
     WHERE matnr EQ i_marc-matnr
       AND werks EQ i_marc-werks
       AND lgort IN s_lgort.

  ENDIF.                               " IF i_mara[] IS NOT INITIAL


  IF sy-subrc EQ 0.
    LOOP AT i_output INTO wa_output.
      READ TABLE i_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.
      wa_output-lgort = wa_mard-lgort.
      MODIFY i_output FROM wa_output.
      CLEAR wa_output.
    ENDLOOP.                           " LOOP AT i_output
  ENDIF.                               " IF sy-subrc EQ 0&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;thx&lt;/P&gt;&lt;P&gt;twinkal&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Jun 12, 2008 12:29 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jun 2008 14:11:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-select-statement/m-p/3963314#M946737</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-12T14:11:37Z</dc:date>
    </item>
  </channel>
</rss>

