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: 

Views & joining same table twice?

Former Member
0 Kudos

Hi,

I am running into this problem and I am stuck.

Short story:

I need to join two views into one view,

or include one view into another containing base tables,

or join the same table twice using, maybe, and alias.

Long story:

I have to create a view which joins vendor number and name with manufacturer number and name. All this through views and no coding.

There already exists a working view containing the vendor info and manufacturer number.

Z_VENDOR_VIEW

Tables:

MARA

LFA1

MARC

MAKT

EINA

Using the manufacturer number (MFRNR) from the above, I want to fetch the name from LFA1-NAME1.

The problem is that LFA1-NAME1 is already used in the above view as the vendor name with the join condition EINA and LFA1.

The end result should display: vendor_# vendor_name manufacturer_# manufacturer_name.

Thanks,

1 ACCEPTED SOLUTION

franois_henrotte
Active Contributor
0 Kudos

even if I understand your need, having twice the same field in a view makes no sense in a technical point of view ...

you could do it with some abap code but not in a dictionary view

5 REPLIES 5

franois_henrotte
Active Contributor
0 Kudos

even if I understand your need, having twice the same field in a view makes no sense in a technical point of view ...

you could do it with some abap code but not in a dictionary view

Former Member
0 Kudos

Hi,

Try using the coding or using the database view.

Sharin.

Former Member
0 Kudos

Hi,

The best thing is to write an ABAP report.

Regards,

Prashant

Former Member
0 Kudos

Thanks for your help. In the end I will code it as you say. It will simplify things.

It is interesting though that views cannot be joined/nested.

0 Kudos

In real SQL you can, as you say, create a database view by joining a table to itself, but this requires the use of aliases and so cannot be done in SE11. I did once try to bypass this by creating a single table view based on the table in SE11 so that I would have a different name for the table and then trying to create a view joining that view and the table (in real SQL you can base a view on a view), but it wouldn't allow me to do this either.