2007 Nov 08 1:24 PM
Hi
I have two tables : VBRK and BKPF My main table´s is VBRK, but i need to search some information in the BKPF.
How can i do it?? Which is the relations between VBRK and BKPF??
Thanks
Gregory
2007 Nov 08 1:30 PM
Hi,
VBRK-VBELN = part of BKPF-AWKEY.
i think this will help you.
check this also VBRK-VBELN = BKPF-BELNR
Satish
Message was edited by:
Satish Panakala
2007 Nov 08 1:30 PM
Hi,
VBRK-VBELN = part of BKPF-AWKEY.
i think this will help you.
check this also VBRK-VBELN = BKPF-BELNR
Satish
Message was edited by:
Satish Panakala
2007 Nov 08 1:31 PM
you can relate key-fields of bkpf with its exemplars in VBRK
A.
Message was edited by:
Andreas Mann
2007 Nov 08 1:41 PM
Hi Gregory,
because reading from BKPF and BSEG is always a time-consuming task due to the size of the tables, it is always recommended to select from an adequate secondary index first:
BSAD : Accounting: Secondary Index for Customers (Cleared Items)
BSAK : Accounting: Secondary Index for Vendors (Cleared Items)
BSAS : Accounting: Secondary Index for G/L Accounts (Cleared Item
BSEC : One-Time Account Data Document Segment
BSEG : Accounting Document Segment
BSID : Accounting: Secondary Index for Customers
BSIK : Accounting: Secondary Index for Vendors
BSIM secondary index material
BSIS : Accounting: Secondary Index for G/L Accounts
Check if BSAD, BSID or BSIM could be used. And regard the hint on AWKEY.
Regards,
Clemens
2007 Nov 08 1:42 PM
Hi
Always the Item level tables are linked with the preceding and subsequent documents
here in this case both VBRK and BKPF are header level
if you see the Item level table of this BKPF that is BSEG you will find the VBELN field
instead of BSEG or BKPF better to look at the BSID and BSAD tables which are linked with VBRK and VBRP
BSID and BSAD also contain the same Customer related data of BKPF and BSEG
Regards
Anji
2007 Nov 08 1:56 PM
Hi,
the relation is:
vbrk-belnr = bpkf-belnr
vbrk-gjahr = bkpf-gjahr
vbrk-bukrs = bkpf-bukrs
The simplest was to find this is via SQVI insert a test-query with table-join
and insert the both tables.
Here you can see the relations.
Hope it helps.
regards, Dieter
2007 Nov 08 2:32 PM
I'm trying to get a BLOG out on exactly this subject - hopefully, early next week. This part will be relevant for you. I'm using VBFA, but you can easily make some minor changes and use VBRK:
select vbeln
from vbfa
into table vbfa_int
up to 100 rows
where vbelv = vbeln
and vbtyp_n = 'P'. "Debit memo
check sy-subrc = 0.
sort vbfa_int.
delete adjacent duplicates from vbfa_int.
loop at vbfa_int into vbfa_wa.
v_objectkey+00(10) = vbfa_wa-vbeln. "BELNR
v_reference = 'VBRK'.
* Uses index BKPF~4 (4.7)
select single bukrs belnr gjahr "Accounting Doc Header
from bkpf
into doc_wa
where awtyp = v_reference
and awkey = v_objectkey.
if sy-subrc = 0.
append doc_wa to doc_int.
endif.
endloop.
Rob
Message was edited by:
Rob Burbank
2007 Nov 08 6:30 PM