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 between VBRK and BKPF

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

7 REPLIES 7

Former Member
0 Kudos

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

andreas_mann3
Active Contributor
0 Kudos

you can relate key-fields of bkpf with its exemplars in VBRK

A.

Message was edited by:

Andreas Mann

Clemenss
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Ready Thanks for your asnwers

Regards

Gregory