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

link between VBAK and VBRK

Former Member
0 Likes
32,588

Hi

How to link VBAK(sales order)and VBRK(billing document)?

what are the fields to link and how to link. because vbak-vbeln is sales order number and vbrk-vbeln is billing document number.

need help...

Thanks

smita

1 ACCEPTED SOLUTION
Read only

15,078

I realize you've probably figured this out by now, but since I found this on a search and others might, here's what I found:

VBAK joins VBAP through VBELN

VBAP joins VBRP through VBAP-VBELN=VBRP-AUBEL and VBAP-POSNR=VBRP-AUPOS

VBRP joins VBRK though VBELN

The data elements for VBELN are different even though the names are the same (se11 helps)

I'm sure some of the other answers worked, I just couldn't follow them.

12 REPLIES 12
Read only

Former Member
0 Likes
15,078

vbrk-vgbel same as lips-vbeln

and now lips-vgbel is same as vbak-vbeln.

Read only

Former Member
0 Likes
15,078

hopen this helps

Hope this will give u some idea..

select avbeln bfkdat into table itab from vbak as a inner join

vbrk as b on

avbeln = bvbeln where

a~audat in s_audat.

if not itab[] is initial.

select fkimg into corresponding fields of table itab_final

from vbrp for all entries in itab

where vbeln = itab-vbeln and

matnr = p_matnr and

charg = p_charg.

endif.

regards

navjot

Pls reward fopr helpful replies!!

Message was edited by:

navjot sharma

Read only

Former Member
0 Likes
15,078

Hello,

Please check VBFA table.

You get relation between sales order number and billing document number there.

Regards,

tarun

Read only

0 Likes
15,078

Hi tarun

I know VBFA table link between VBAK and VBRK , But what are fields and how?

Read only

Former Member
0 Likes
15,078

hi,

Following tables are included in link (In chronological order):

VBAK - sales documetn header,

VBAP - Sales document item

LIPS - Sales doc. Delivery items

VBRP - billing item data

VBRK - Billing header

generally sales doc and billing docs are related by delivery docs.

u can join these tables using joins in select statement.

join structure will loolk like.:

select .....

from vbak as a

inner join vbap as b on avbeln = bvbeln

inner join lips as c on cvgbel = bvbeln and cvgpos = bposnr

inner join vbrp as d on dvgbel = cvbeln and dvgpos = cposnr

inner join VBRK as e on evbeln = dvbeln

.

.

.

Also, pl refer following file, very helpful, forever.

http://www.sap-img.com/sap-download/sap-tables.zip

Jogdand M B

PS: Reward if helpful...

Read only

Former Member
0 Likes
15,078

vbrp-vgbel = lips-vbeln

Get vgbel from lips

lips-vgbel = vbak-vbeln.

Read only

Former Member
0 Likes
15,078

hi,

vbrk-vbeln eq vbak-vbeln for vbak-vbtyp eq 'M'.

VBTYP is SD document category.

u can use

on VBRKVBELN EQ VBAKVBELN

WHERE VBAK~VBTYP EQ 'M'.

Read only

Former Member
0 Likes
15,078

Hi..

VBFA table is the table for Sales Document Flow..SO In the field "Follow-On-Document" if we type the Billing document number, you will get the preceeding documents..there you can see the Sales Document numbers corresponding to them...

select VBELV

from VBFA

into table itab

where vbeln in s_billindocument

and VBTYP_N = 'M'.

try this..

Message was edited by:

Rammohan Nagam

Read only

Former Member
0 Likes
15,078

Hi,

You can link VBRP and VBAP table using VBRP-AUBEL = VBAP-VBELN and VBRP-AUPOS = VBAP-POSNR.Header table you can't link, always links will be in Item tables.

Join VBAK and VBAP and VBRL VBRP using above link:

You can also using VBFA table:

Pass the Preceding Document as VBAK-VBELn and Preceeding Doc type as C(order) and Subceeding Doc as VBRK-VBELN and Subse doc Type as M.

hope you understood .

reward if useful

regards,

Anji

Read only

Former Member
0 Likes
15,078

hi

these are table relations

vbak n vbrk is vbeln

vbak n vbrp is vbeln

vbak n vbfa is vbeln, vbelv n vbtyp_n

vbak n lips is vbeln

Regards,

alson

Read only

15,079

I realize you've probably figured this out by now, but since I found this on a search and others might, here's what I found:

VBAK joins VBAP through VBELN

VBAP joins VBRP through VBAP-VBELN=VBRP-AUBEL and VBAP-POSNR=VBRP-AUPOS

VBRP joins VBRK though VBELN

The data elements for VBELN are different even though the names are the same (se11 helps)

I'm sure some of the other answers worked, I just couldn't follow them.

Read only

0 Likes
15,078

Thanks Lee.

Regards,

Dinesh