08-20-2007 6:09 AM
Hi all,
is there any special care to be taken while fetching
the data from the cluster table....
for example i want to fetch the data from the
BSEG table... generally data retrieval from these tables
are very slow... is there any method to improve the performance.....
Regards
cnu
08-20-2007 1:31 PM
BSEG table is a cluster table with a key of 4 fields - BUKRS, BELNR, GJAHR and BUZEI. Only the first three are key fields on the underlying cluster table. There are no secondary indexes to this table. The rest of the fields in the BSEG dictionary structure are stored on the database in a compressed format in a single long LRAW field - with multiple lines (BUZEI) for a document packed into a single database record. When you read fields from this table the database passes each LRAW cluster to the application server to be uncompressed into the BSEG field structure - using fields other than the 3 primary key fields in a select WHERE block will slow down performance as SAP has to unpack and look in each cluster to see what matches.
For best performance, get a list of the desired keys from other tables (at least BUKRS and BELNR) and then read the records you want using a FOR ALL ENTRIES IN, or possibly a RANGES table for BELNR if you have a single company code.
SAP has provided some alternate access pathways using other tables to help build the list of document numbers - check tables BKPF, BSIS, BSAS, BSID, BSAD, BSIK, BSAK. Even though you may have to read several of these tables to get the full list of documents you want as each of the BSI* and BSA* tables contains a subset of the BSEG documents, it will still work out quicker than trying to select from BSEG without the key fields. Tables in other modules also may have the company code and FI document number stored to give you the link you need.
Also, BSEG has a lot of fields - so specify the ones you want in the select instead of using SELECT *
Andrew
08-20-2007 6:18 AM
Hi,
fetching data from the BSEG table will take more time as it is cluster table
but in some case you can use the tables like
VBSEGK , VBSEGs , VBSEGd like that which are in side the bseg cluster table
and then loop the internal tables to get the desired output
if it is not possi
then declare the itab with the fields you want from bseg table ( the order should be of bseg table field s order -- it will yields in better performance)
and write
select fields ( which are of same order in the bseg table )
from bseg into table itab
where conditions ( try to give more conditions here inorder to fetch the data fastly)
thanks & regards,
Venkatesh
08-20-2007 10:36 AM
Hi CNU,
There is no special rules for getting data from cluster tabe. Try to use maximum number of key fields in the same order as it is in table in the where conditions.
Thanks,
Jiten
08-20-2007 12:27 PM
Hi,
system does not check whether the structure of the object in the database
is compatible with the structure into which you are reading it. If this is not the case, a runtime error occurs. Exceptions are fields with type C, which may occur at the end of a structured data obj.
<b>REWARD ALL HELPFUL ANSWERS</b>
Regards,
Murali
08-20-2007 1:31 PM
BSEG table is a cluster table with a key of 4 fields - BUKRS, BELNR, GJAHR and BUZEI. Only the first three are key fields on the underlying cluster table. There are no secondary indexes to this table. The rest of the fields in the BSEG dictionary structure are stored on the database in a compressed format in a single long LRAW field - with multiple lines (BUZEI) for a document packed into a single database record. When you read fields from this table the database passes each LRAW cluster to the application server to be uncompressed into the BSEG field structure - using fields other than the 3 primary key fields in a select WHERE block will slow down performance as SAP has to unpack and look in each cluster to see what matches.
For best performance, get a list of the desired keys from other tables (at least BUKRS and BELNR) and then read the records you want using a FOR ALL ENTRIES IN, or possibly a RANGES table for BELNR if you have a single company code.
SAP has provided some alternate access pathways using other tables to help build the list of document numbers - check tables BKPF, BSIS, BSAS, BSID, BSAD, BSIK, BSAK. Even though you may have to read several of these tables to get the full list of documents you want as each of the BSI* and BSA* tables contains a subset of the BSEG documents, it will still work out quicker than trying to select from BSEG without the key fields. Tables in other modules also may have the company code and FI document number stored to give you the link you need.
Also, BSEG has a lot of fields - so specify the ones you want in the select instead of using SELECT *
Andrew