cancel
Showing results for 
Search instead for 
Did you mean: 

Fetching data from SD tables

anupam_srivastava2
Participant
0 Kudos

Hi All

I want the following fileds in my view.

1.Slaes doc- VBAK-VBELN

2.Created On-VBAK-ERDAT

3.Purch.Order No-VBAK-BSTNK

4.Ref1- VBAK-IHREZ

5.Sold to party- VBAK-KUNNR

6.Billing doc- VBRP-VBELN

7.Material- VBRP-MATNR

8.Originating doc- VBRP-VBELV

9.NetValue VBRP-NETWR

Is it possible to create relation between vbak and vbrp, if not how can I fetch these filed from other tables, relate them and create a view. Actualy I want to create a Sales Invoice, where I want to use Sales doc and Billing doc togather. The fileds which I required, I found in these tables, but I am not clear how I can relate these tables and create a view.

Please guide

cheers

AJ

Accepted Solutions (0)

Answers (7)

Answers (7)

anupam_srivastava2
Participant
0 Kudos

This message was moderated.

Former Member
0 Kudos

hi,

In VBRP Table there is a field 'VGBEL', so u can pass the VGBEL no into VBAK table to get the relevant details of the same.

VGBEL is SO No field in VBRP Table.

eg. ur invoice no is 91000017, then u put the no in VBRP table , VBELN Field so that u can get the SO no from VGBEL field.

Then pass this no in VBAK table, VBELN Field so that u can get the relevant details of the so order frm that table & field.

Hope ur clear.

Dont forget to reward points.

Former Member
0 Kudos

HI AJ ,

Here is the link between VBAK and VBRP.

With reference to billing document go to table VBRP as VBRP -VBELN and fetch the VBRP -AUBEL as a sales order number and then with this sales order number you go to VBAK as VBAK - VBELN.

Hope this will help you and you can fetch the required fields from these two tables

Regards,

Narayan Bobde

Former Member
0 Kudos

Similar to other responses, Even I will refer to table VBFA.

Additionally, take a look at the diagramatic flow in the link Below for SD, which will bring a good clearity of the flow:

Link: http://www.sap-img.com/

Topic: Free ABAP eBook Download

SAP MM, SD, FI, PS, PP, PM, HR, System Tables

Regards,

Rajesh Banka

Reward points if helpful.

Former Member
0 Kudos

Hi!

The link between any two set of documents is VBFA, call document flow table.

It will pick all the succeding documents for a specific order.

So for example, if you have say a sales order, delivery, shippment and invoice and invoice cancellation. Then by putting the sales order number in table VBFA all succeding documents will be displayed to you. Now to differentiate between say a delivery and invoice you will have to use a field called document type. So by specifying the preceding document category and giving sales order number and succeding document category you will be able to pick the correct invoice.

Hope this helps.

Abhishek Purwar

csaba_szommer
Active Contributor
0 Kudos

Hi,

You can connect them but you won't get records (or I do not know how to get) for SOs for which deliveries and/or the billing document is missing.

You can realize the connection using tables of delivery documents because the invoices are assigned to delivery docs.

Please take care of the fields!!!

(You have to use LIKP&LIPS only once, but you have to link VBAP-VBAK to it, and VBRP-VBRK to it)

LIKP-LIPS- (fields: VGBEL+VGPOS >> VBELN + POSNR) -VBAP-VBAK

(LIKP-LIPS)- (fields: VBELNPOSNR >> VGBELVGPOS) -VBRP-VBRK

http://www.erpgenie.com/abap/tables_sd.htm

BR

Csaba

Former Member
0 Kudos

Hi AJ,

You will have to use the table VBFA to find the document flow. But the issue is direct link would not be made.

In table VBFA the preecding document category would be sales order and succeeding document category should be invoice, then only you will get a direct link between a sales order and billing will be made.

But still it would quite a messy table, becuase of the presence of say quotation or contract and may be invoice cancellations. So you have to do some coding, which i am not sure you would be able to do much in a view.

But if your problem is just fetching slaes orders for and invoice, i think it would be standard function module available which will help you in creating the correct view.

Hope this helps,

Abhishek Purwar