<?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 me to solve this. select statement! in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881413#M676708</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use BSEG, use BKPF and fields AWTYP, AWREF which link a financial document to the application and document that generated it. (The "original document" under transaction like FB03)&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Example: "RMRP" + invoice number for purchase invoice&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In  some case you need an intermediate table&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Example: from EKPO, EKBE, you get the MKPF records and from them the BKPF/BSEG&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a list of "referenced procedures" Look at TTYP (text table is TTYPT), you will get the code, structure used to build the key (if more than one field) and a function module used to display the origin&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Example :  MKPF "Material document" structure MKPF_AWKEY function module MB_DOCUMENT_SENDER_MKPF&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also look at your accounting documents found with the "slow" BSEG version of your program and establish a list of AWTYP used in you company/customer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An other way, used in some companies, is to append a structure with EBELN field to BSIS and BSAS table, these table are filled via a MOVE-CORRESPONDING statement, so the nesw records will be filled (You may write a program to update past records) then create an index on EBELN on these fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: BSEG is a cluster table, so the only real criteria are the primary keys, if you select via EBELN, the program read the whole table, may be correct in Development, but not in Production and there it will be more and more resources consuming. So NEVER select from BSEG vithout the primary keys, use the secondary tables : BSIS/BSAS, BSIM, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Sep 2007 11:55:20 GMT</pubDate>
    <dc:creator>RaymondGiuseppi</dc:creator>
    <dc:date>2007-09-27T11:55:20Z</dc:date>
    <item>
      <title>help me to solve this. select statement!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881412#M676707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello alll&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there any functional module which gives me the BELNR(of bseg) by passing the vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yeah ...we can do tht by passing bseg table ,,,,but its taking loads of time to give me the output as its not a primary key or secondary key.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when i m using this condition in the prog i cannot use inner join as its a cluster table . if i m writing a condition it is effecting my prog performance &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this statement is really taking long time to process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in bseg table as vbeln is not primary key or seconday key, i guess thz the reason it is taking so much time ,,,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone help me to sort this out... ??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any fun mod to get the data of bseg cluster table by giving vbeln?/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or any other conditions to reduce the processing time?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear t_vbrkvbrp.&lt;/P&gt;&lt;P&gt;sort t_vbrkvbrp by vbeln.&lt;/P&gt;&lt;P&gt;loop at t_vbrkvbrp.&lt;/P&gt;&lt;P&gt;at new vbeln.&lt;/P&gt;&lt;P&gt;select bukrs belnr vbeln&lt;/P&gt;&lt;P&gt;from bseg&lt;/P&gt;&lt;P&gt;into corresponding fields of table t_temp&lt;/P&gt;&lt;P&gt;where bukrs = t_vbrkvbrp-bukrs&lt;/P&gt;&lt;P&gt;and vbeln = t_vbrkvbrp-vbeln.&lt;/P&gt;&lt;P&gt;endat.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT bukrs belnr buzid koart shkzg dmbtr vbeln hkont kunnr werks&lt;/P&gt;&lt;P&gt;FROM bseg&lt;/P&gt;&lt;P&gt;INTO TABLE t_bseg&lt;/P&gt;&lt;P&gt;for all entries in t_temp&lt;/P&gt;&lt;P&gt;WHERE hkont IN s_hkont&lt;/P&gt;&lt;P&gt;AND bukrs = t_temp-bukrs&lt;/P&gt;&lt;P&gt;AND belnr = t_temp-belnr&lt;/P&gt;&lt;P&gt;AND buzid = ' '&lt;/P&gt;&lt;P&gt;AND koart = 'S'&lt;/P&gt;&lt;P&gt;AND shkzg = 'H'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to get the g/l account number and belnr from bseg for the above condition type so i have to use bseg table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as there is no apporpriate index it is scanning the full table ,,,, so can anyone tell me how to create a index or like wise to get the data faster??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:43:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881412#M676707</guid>
      <dc:creator>Shahid</dc:creator>
      <dc:date>2007-09-27T11:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: help me to solve this. select statement!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881413#M676708</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't use BSEG, use BKPF and fields AWTYP, AWREF which link a financial document to the application and document that generated it. (The "original document" under transaction like FB03)&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Example: "RMRP" + invoice number for purchase invoice&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In  some case you need an intermediate table&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Example: from EKPO, EKBE, you get the MKPF records and from them the BKPF/BSEG&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a list of "referenced procedures" Look at TTYP (text table is TTYPT), you will get the code, structure used to build the key (if more than one field) and a function module used to display the origin&lt;/P&gt;&lt;P&gt;&amp;lt;i&amp;gt;Example :  MKPF "Material document" structure MKPF_AWKEY function module MB_DOCUMENT_SENDER_MKPF&amp;lt;/i&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can also look at your accounting documents found with the "slow" BSEG version of your program and establish a list of AWTYP used in you company/customer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An other way, used in some companies, is to append a structure with EBELN field to BSIS and BSAS table, these table are filled via a MOVE-CORRESPONDING statement, so the nesw records will be filled (You may write a program to update past records) then create an index on EBELN on these fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: BSEG is a cluster table, so the only real criteria are the primary keys, if you select via EBELN, the program read the whole table, may be correct in Development, but not in Production and there it will be more and more resources consuming. So NEVER select from BSEG vithout the primary keys, use the secondary tables : BSIS/BSAS, BSIM, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:55:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881413#M676708</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2007-09-27T11:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: help me to solve this. select statement!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881414#M676709</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi shahid,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try to use select ... for all entries in this code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear t_vbrkvbrp.&lt;/P&gt;&lt;P&gt;sort t_vbrkvbrp by vbeln.&lt;/P&gt;&lt;P&gt;*loop at t_vbrkvbrp.&lt;/P&gt;&lt;P&gt;*at new vbeln.&lt;/P&gt;&lt;P&gt;select bukrs belnr vbeln&lt;/P&gt;&lt;P&gt;from bseg&lt;/P&gt;&lt;P&gt;into corresponding fields of table t_temp&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;for all entries in t_vbrkvbrp[]&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;where bukrs = t_vbrkvbrp-bukrs&lt;/P&gt;&lt;P&gt;and vbeln = t_vbrkvbrp-vbeln.&lt;/P&gt;&lt;P&gt;*endat.&lt;/P&gt;&lt;P&gt;*endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are using a select in a loop, this cause a long time, if this table is heavy, will take a lot.&lt;/P&gt;&lt;P&gt;Or you can use a other it to do what you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 11:56:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881414#M676709</guid>
      <dc:creator>rodrigo_paisante3</dc:creator>
      <dc:date>2007-09-27T11:56:27Z</dc:date>
    </item>
    <item>
      <title>Re: help me to solve this. select statement!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881415#M676710</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shahid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BSEG is a cluster table which gives performance problems and does not allow joins.&lt;/P&gt;&lt;P&gt;But the same data is also stored in tables&lt;/P&gt;&lt;P&gt;BSID - Closed items customer&lt;/P&gt;&lt;P&gt;BSAD - Open items customer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can see the field BSID-AUGBL that store the sales order no (VBAK-VBELN).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward if Helpful.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 12:07:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881415#M676710</guid>
      <dc:creator>varma_narayana</dc:creator>
      <dc:date>2007-09-27T12:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: help me to solve this. select statement!</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881416#M676711</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To get invoice financial document : Use AWTYP = 'VBRK' and AWKEY = invoice-number to read BKPF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Sep 2007 12:22:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-me-to-solve-this-select-statement/m-p/2881416#M676711</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2007-09-27T12:22:48Z</dc:date>
    </item>
  </channel>
</rss>

