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: 

HOW TO MAKE INNERJOIN FOR THREE TABLES

Former Member
0 Kudos

Fetch the data ( VBELN,POSNR,FKDAT ) from table VRPMA using condition of billing date (VRPMA-FKDAT) is less than 60 days from current Sales Order requested delivery date (if specified at header VBAK-VDATU or at the schedule line level (VBEP-EDATU) and based on tables VBAK (VKORG,VTWEG,SPART,VBELN),VBAP(MATNR,VBELN,POSNR,) & VBPA(KUNNR,VBELN,POSNR,PARVW,) using INNER JOIN condition

HOW TO ACHIEVE THIS?

2 REPLIES 2

Former Member
0 Kudos

Hello Chakravarthy,

One specific rule is there to use an internal table like:

If you are going to use inner join from table, let say X to table Y, then relatuion ship should be 1 to many from X to Y.

Let say header & item tables, If you consider table VBAK & VBAP u2013 it is 1 to many relation ship. For a single record in VBAK, there will be one or more data in VBAP.

From vbap to vbpa, itu2019s again 1 to many relation ship and so you can extend the inner join.

For the information, I recommend to use only up to three tables in a inner join if you are not much comfortable in the topic.

Syntax.

Select avbeln u2026 bposnr u2026c~parvw

From vbak as a

Inner join vbap as b

On avbeln = bvbeln

Inner join vbpa as c

on b_vbeln = c~vbeln

and bposnr = cposnr

Into table it_tab1

Where u2026.

Regards,

Selva K.

Edited by: Selvakumar Krishnan on May 14, 2010 11:32 AM

Edited by: Selvakumar Krishnan on May 14, 2010 11:33 AM

ThomasZloch
Active Contributor
0 Kudos

Please search and try yourself before posting, don't just post your requirements here, don't use all upper case when posting.

Thread locked.

Thomas