<?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 problem in the select statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107006#M737598</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to select the values of the fields BEZEI  depending on tha sales order number vbeln. HOw can i write the select statement what will be the tables associated?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Dec 2007 09:18:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-12-04T09:18:18Z</dc:date>
    <item>
      <title>problem in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107006#M737598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have to select the values of the fields BEZEI  depending on tha sales order number vbeln. HOw can i write the select statement what will be the tables associated?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 09:18:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107006#M737598</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T09:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: problem in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107007#M737599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You need to link VBAK &amp;amp; TKA01 based on KOKRS field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 09:23:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107007#M737599</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T09:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: problem in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107008#M737600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In these cases ,you will have to use joins to select data from different tables.I am sending a simple eg on how to do it.Plz go through it and implement in you case.Plz do reward points if useful.&lt;/P&gt;&lt;P&gt;Thankx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;ebeln b&lt;/SUB&gt;ebelp a&lt;SUB&gt;ernam a&lt;/SUB&gt;ekgrp a~bedat &lt;/P&gt;&lt;P&gt;       b&lt;SUB&gt;txz01 b&lt;/SUB&gt;netwr b&lt;SUB&gt;afnam b&lt;/SUB&gt;effwr&lt;/P&gt;&lt;P&gt;       INTO CORRESPONDING FIELDS OF TABLE it_po&lt;/P&gt;&lt;P&gt;       FROM ekpo AS b INNER JOIN ekko AS a&lt;/P&gt;&lt;P&gt;       ON b&lt;SUB&gt;ebeln = a&lt;/SUB&gt;ebeln&lt;/P&gt;&lt;P&gt;       WHERE a~bukrs = s_bukrs  AND&lt;/P&gt;&lt;P&gt;             a~aedat LE p_date  AND&lt;/P&gt;&lt;P&gt;             a~ebeln IN s_ebeln AND&lt;/P&gt;&lt;P&gt;             a~bedat IN s_bedat AND&lt;/P&gt;&lt;P&gt;             a~ekgrp IN s_ekgrp AND&lt;/P&gt;&lt;P&gt;             a~frgke NE 'E'     AND&lt;/P&gt;&lt;P&gt;             b~loekz NOT IN ('L', 'S', 'X').&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 09:26:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107008#M737600</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T09:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: problem in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107009#M737601</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;&lt;/P&gt;&lt;P&gt;  Select vbeln &lt;/P&gt;&lt;P&gt;            kokrs&lt;/P&gt;&lt;P&gt;            from vbak into table it_vbak&lt;/P&gt;&lt;P&gt;            where vbeln in s_vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_vbak[] is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select bezei&lt;/P&gt;&lt;P&gt;          from tka01 into table it_tka01&lt;/P&gt;&lt;P&gt;          for all entries in it_vbak&lt;/P&gt;&lt;P&gt;          where kokrs eq it_vbak-kokrs.&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;Prashant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 09:28:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107009#M737601</guid>
      <dc:creator>former_member386202</dc:creator>
      <dc:date>2007-12-04T09:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: problem in the select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107010#M737602</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;PRE&gt;&lt;CODE&gt;tables: vbak.
types: begin of ty_vbak,
           vbeln type vbeln,
           kokrs type kokrs,
          end of ty_vbak,
          begin of ty_it_tka01,
            kokrs type kokrs,
            bezei type bezei,
          end of ty_tka01.

data: it_vbak type table of ty_vbak,
        wa_vbak type ty_vbak,
        it_tka01 type table of ty_tka01,
        wa_tka01 type ty_tka01.

Select-options: s_vbeln for vbak-vbeln.
Select VBELN KOKRS from VBAK into table it_VBAK where vbeln in s_vbeln.
if sy-subrc = 0.
 select KOKRS BEZEI from TKA01 into it_tka01 for all entries in it_vbak where kokrs = it_vbak-kokrs.
endif.

Loop at it_vbak into wa_vbak.
 read table it_tka01 into wa_tka01 with key kokrs = wa_vbak-kokrs.
 if sy-subrc = 0.
* Move data to final internal table.
 endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Satish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Dec 2007 09:30:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-in-the-select-statement/m-p/3107010#M737602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-12-04T09:30:13Z</dc:date>
    </item>
  </channel>
</rss>

