<?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: help in the query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949396#M64912</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's one way, but that hit to BSEG may take a while if you don't have an index for that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: xbkpf type bkpf.
data: ibseg type table of bkpf with header line.


data: begin of itab occurs 0,
      kunnr type bseg-kunnr,
      blart type bkpf-blart,
      wrbtr type bseg-wrbtr,
      zuonr type bseg-zuonr,
      end of itab.

parameters: p_advnum type bseg-zuonr.


select * into corresponding fields of table ibseg
         from bseg
             where zuonr = p_advnum.

loop at ibseg.

  move-corresponding ibseg to itab.

  clear xbkpf.
  select single * from bkpf into xbkpf
          where belnr = ibseg-belnr.

  itab-blart = ibseg-blart.
  append itab.

endloop.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Jul 2005 16:41:48 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2005-07-20T16:41:48Z</dc:date>
    <item>
      <title>help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949394#M64910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi folks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Help me to build the query here.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables BKPF - fields belnr, blart&lt;/P&gt;&lt;P&gt;       BSEG - fields kunnr,wrbtr, zuonr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to get the data into a single internal table whose strucutre consists of fields kunnr, blart,wrbtr and zuonr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the common field between the two tables is belnr and the query should be run based on 'zuonr' field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i.e&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select ......................... where bseg-zuonr = p_advnum(paramter field where I get the data)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question how to establish relation between two tables in asingle query without the use of 'JOIN' statements because BSEG is a cluster table and i cannot do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 16:34:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949394#M64910</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T16:34:15Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949395#M64911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You cannot use an Inner join as BSEG is NOT a Transparent table. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Instead use Secondary Indexes ( BSID, BSAD....) or use LDB: BRF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 16:38:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949395#M64911</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T16:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949396#M64912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's one way, but that hit to BSEG may take a while if you don't have an index for that field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

data: xbkpf type bkpf.
data: ibseg type table of bkpf with header line.


data: begin of itab occurs 0,
      kunnr type bseg-kunnr,
      blart type bkpf-blart,
      wrbtr type bseg-wrbtr,
      zuonr type bseg-zuonr,
      end of itab.

parameters: p_advnum type bseg-zuonr.


select * into corresponding fields of table ibseg
         from bseg
             where zuonr = p_advnum.

loop at ibseg.

  move-corresponding ibseg to itab.

  clear xbkpf.
  select single * from bkpf into xbkpf
          where belnr = ibseg-belnr.

  itab-blart = ibseg-blart.
  append itab.

endloop.


&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 16:41:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949396#M64912</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-20T16:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949397#M64913</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or as Murugesh  has suggested........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

report zrich_0003.

data: begin of itab occurs 0,
      kunnr type bsad-kunnr,
      blart type bsad-blart,
      wrbtr type bsad-wrbtr,
      zuonr type bsad-zuonr,
      end of itab.

parameters: p_advnum type bseg-zuonr.

select * into corresponding fields of table itab
     from bsad
             where zuonr = p_advnum.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 16:46:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949397#M64913</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-07-20T16:46:14Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949398#M64914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I cannot use the bsad because it delas with 'cleared items' and I need the 'open items' too. therefore I have to use BSEG and BKPF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use the index to track the record because it becomes a performance issue here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 17:34:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949398#M64914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T17:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949399#M64915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not suggested to use BKPF - BSEG tables as this takes away performance. Instead use BSID, BSAD, BSIK, BSAK, BSIS - Secondary Indexs as per your reqmt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regds, Murugesh AS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 17:54:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949399#M64915</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T17:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949400#M64916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok then i will read the data from tables BSID and BSAD into two different internal tables and the code goes like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * into corresponding fields of table patopenitemsitab&lt;/P&gt;&lt;P&gt;     from bsid where zuonr = p_advnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * into corresponding fields of table patcloseditemsitab&lt;/P&gt;&lt;P&gt;     from bsad where zuonr = p_advnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I merge these two data into a single internal table?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Santhosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 18:50:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949400#M64916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T18:50:48Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949401#M64917</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;You can use &lt;/P&gt;&lt;P&gt;            Select  - - - - -&lt;/P&gt;&lt;P&gt;            from bsid into &lt;/P&gt;&lt;P&gt;            table itab&lt;/P&gt;&lt;P&gt;            where &amp;lt;cond&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then &lt;/P&gt;&lt;P&gt;         select - - - - &lt;/P&gt;&lt;P&gt;         from BSAD &lt;/P&gt;&lt;P&gt;         appending table itab&lt;/P&gt;&lt;P&gt;         where &amp;lt;Cond&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gagan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 19:03:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949401#M64917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T19:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: help in the query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949402#M64918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes -there's no need to go to BKPF or BSEG at all. All the fields you need are in BSID and BSAD including BLART and ZUONR. If you do need other fields that aren't in BSID or BSAD, use the company code, fiscal year and document nuber form these tables to retrieve data from BKPF and/or BSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jul 2005 19:32:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-in-the-query/m-p/949402#M64918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-07-20T19:32:00Z</dc:date>
    </item>
  </channel>
</rss>

