Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Performance problem while accessing bseg-help using field symbols.

Former Member
0 Likes
1,059

Hi,

i have to access bseg withoout using belnr primary key,

i have to access all the record of bseg using vbel2 or zuonr field..

since i am not using belnr it is taking time to retrieve the data and fill the internal table.

can anyone help me how to improve the performance and also if anyone can help me of how to do with <b>field symbols</b>

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
993

accessing bseg in this way will be very slow, there is no way round it. Do you have to read bseg? Depending on what it is you are trying read maybe there is another table...for example bsid or bsad for cleared or open items is one possibility and there are other BS* tables that might suit you.

9 REPLIES 9
Read only

former_member186741
Active Contributor
0 Likes
994

accessing bseg in this way will be very slow, there is no way round it. Do you have to read bseg? Depending on what it is you are trying read maybe there is another table...for example bsid or bsad for cleared or open items is one possibility and there are other BS* tables that might suit you.

Read only

Former Member
0 Likes
993

I don't think field symbols will help much. Try to work out a way to use the index. Where do you get vbel2 and zuonr?

Rob

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
993

Hi,

Besg is the most busiest table in the SAP and moreover it is a cluster table so we cant even go for the secondary indexes.

Even if u want to access it. U go for other tables which are in contact with the same data of BSeg such as BSIK, BSAK, BSIS, BSAS,BSIS,BSAS.

This might help u..

Cheers,

SImha.

Reward if helpful...

Read only

Former Member
0 Likes
993

I know its the busiest table and it is very slow....

i am getting the sales order from user as input and checking it with vbak and vbap and passing the same to get amounts in bseg...

otherwise i am getting belnr from bkpf to pass it to bseg...but the belnr that is related to sales order is not fully coming...

Read only

0 Likes
993

OK - you can use the sales document flow to help you out here. Which FI document(s) do you need? Those related to invoices?

(Not GR/IR.)

Rob

Message was edited by:

Rob Burbank

Read only

0 Likes
993

you should be able to use table vbfa to find links to accounting documents from sales orders.

Read only

Former Member
0 Likes
993

Hello Mohammed,

If you are getting Sales order number form the user then I would suggest u don't access BSEG directly but go through VBFA table which is nothing but sales document flow. In this use the document category VBTYP_N and select the releavant documents. Then u will get full key to acess BSEG for any further information.

Read only

0 Likes
993

One NOTE - doc flow may not be updated from sales order up to accounting, so you may need to select docs step-by-step (depending on the level of doc.flow updates),

like - select all deliveries for your order, then select invoices base don delivery, then accounting. OR if you have order-related billing you can go by order-> invoice-> accounting.

If in your system you have all documents (full chain) in VBFA for sales order - then you a lucky 🐵 and 1 select will do the job.

One more thing - in our case accounting doc number = invoice doc number., so if you know invoices from VBFA - you can use these numbers to select from BSEG.

Read only

0 Likes
993

I would like to add one little point to Siarhei's answer.

Please refer to this link:

and I think this could be a solution if you find the Billing Doc from sales order doc.

You can join them as bkpf-awtyp = 'VBRK'

bkpf-awkey = .... " this will be your billing doc ( vbrk-vbeln )

and you can get Belnr for Bseg then

hope this helps.