Application Development 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: 

Relation betwen VBRK AND BSEG

Former Member
0 Kudos

Hello everybody.

can anyone help me in finding relationship between VBRK and BSEG. I want to find out BSEG-BELNR using VBRK-VBELN.

please note: VBRK-VBELN = BSEG-VBELN works but takes too much time.

is there any other way or table which can relate these two tables.

Txs in advance.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

seek should be on

Vbrk-vbeln eq bkpf-awkey and

bkpf-awtyp ='VBRK'

11 REPLIES 11

dev_parbutteea
Active Contributor
0 Kudos

HI,

you can use fields GJAHR and bukrs also.

Regards,

Sooness

0 Kudos

You mean search should be BUKRS + GJAHR + VBELN in BSEG.

if so, but since BSEG does not have any index on VBELN , it uses a

sequential index and hence it takes too much time to locate on desired record.

Former Member
0 Kudos

Hi,

Could you please specify the fields which you are looking for from BSEG?

Regards,

Bharati

0 Kudos

BELNR.

0 Kudos

Hi,

The best solution would be fetch all the entries from BKPF for the given company code, fiscal year.

Then select entries from BSEG for the given set of billing documents and relevant accounting documents fetched from BKPF. Eliminate the ones which are not relevant.

Hope this helps.

0 Kudos

Txs for your response.

i want the search should be done from VBRK/VBRP(invoice) to BSEG/BKPF (billing).

we have a report in smartforms for Credit/Debit note (invoice).

user demanded for Billing detail (BELNR) also. but by searching in

BSEG using VBRK-VBELN = BSEG-VBELN it takes

too much time to hunt down the desired record because no index is maintained

on this field in BSEG, it uses a sequential index.

Former Member
0 Kudos

Hi

There is no need of querying on BSEG.

Use the function module RV_ORDER_FLOW_INFORMATION.

This will list the function module name. If your requirement is for a single document then this approach will work fine. If you have multiple records then you can't use this FM in a loop because of performance constraints.

Regards,

Sreekanth

0 Kudos

txs for your response.

My problem is solved by applying a search like

where

VBRK-VBELN = BKPF-AWKEY

BKPF-AWTYP = 'VBRK'

this work faster.

Former Member
0 Kudos

You can also use table BKPF (which is the Acctng. document header). The billing document should be stored in field XBLNR (reference field). BKPF has an index for this field so it shouldn't take long. Once you have the accounting document #, you can read BSEG for other field information. Hope this helps.

0 Kudos

txs for your response.

My problem is solved by applying a search like

where

VBRK-VBELN = BKPF-AWKEY

BKPF-AWTYP = 'VBRK'

this work faster.

XBLNR found empty.

Former Member
0 Kudos

seek should be on

Vbrk-vbeln eq bkpf-awkey and

bkpf-awtyp ='VBRK'