Skip to Content
0
Former Member
Jun 03, 2008 at 07:36 PM

Database View where I join VBAK to itself?

221 Views

All,

At my company we have a concept of master and lower level contracts which are both stored in the VBAK table. I'd like to create a database view which would do the equivalant of the following valid select statement

select mastervbeln childvbeln into table git_data

from vbak as master inner join vbak as child on mastervbeln = childvbeln_grp

where master~auart = 'ZMTR'.

The above syntax will give me a list of all our master contracts with all it's associated lower level contracts (1 to many relationship).

When I list VBAK twice on the table/join coditions tab of the view definition in SE11 I get an error stating "join fields vbak-vbeln and vbak-vbeln_grp come from the same table". Essentially SAP thinks I'm trying to join the same table rather than 2 seperate occurrences of the same table. I've tried various flavors of incorporating what would essentially be equivalant to the "as master/as child" syntax to no avail.

I wasn't sure if anyone here knew of a way to make this work.