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: 

Diffe b/w View and inner join

Former Member
0 Kudos

Diffe b/w View and inner join

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Gana,

What is a View ?

When you want to fetch data from one or more than one tables from the database, Views can be used. But once a view is created it resides permanently in the database memory for future usage. Also with a view creation it can be used to maintain data in the SM30 transaction when a table maintainence is created for a table. Before creating a view we need to be definite if it is of definite usage in the future.

What is a Inner join ?

When you want to fetch data from one or more than one tables from the database, only in a ABAP program Inner joins can be used. The inner join does the same thing as the view but it is available only in the run time of ABAP code execution.

<b>Difference between View and Inner Join</b>

<b>Inner Join:</b> Run time entity enable to join only Transparent Tables. As the no. of tables fopr the join increases the performace decreases as it occupies more meory and runtime. Also the code becomes complex.

<b>View:</b> A view is a permanent database entity. There is no restriction on the no. of tables. Any type of join can be written in the conditions tab. At run time in a ABAP code a view can be used with select statements as we do with tables.

<b>Types of Views:</b>

Database View: This is a view that can be used on to fetch data in the ABAP code to. Data about an application object is often distributed on several database tables. A database view provides an application-specific view on such distributed data. Database views are defined in the ABAP Dictionary. A database view is automatically created in the underlying database when it is activated. Application programs can access the data of a database view using the database interface. You can access the data in ABAP programs with both OPEN SQL and NATIVE SQL. However, the data is actually selected in the database. Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way. Database views implement an inner join

Projection View: Projection views are used to hide fields of a table. This can minimize interfaces; for example when you access the database, you only read and write the field contents actually needed. A projection view contains exactly one table. You cannot define selection conditions for projection views. There is no corresponding object in the database for a projection view. The R/3 System maps the access to a projection view to the corresponding access to its base table. You can also access pooled tables and cluster tables with a projection view.

Maintenance View: These views are created for the table maintainance for tables. Maintenance views offer easy ways to maintain complex application objects. Data distributed on several tables often forms a logical unit, for example an application object, for the user. You want to be able to display, modify and create the data of such an application object together. Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables. A maintenance view permits you to maintain the data of an application object together. The data is automatically distributed in the underlying database tables.

Search Help View: It is used for producing search helps. You have to create a help view if a view with outer join is needed as selection method of a search help. The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help, you should generally use a database view as selection method. However, a database view always implements an inner join. If you need a view with outer join for the data selection, you have to use a help view as selection method.

R<b>eward Point if helpful</b>

Regards

Gokul

4 REPLIES 4

Former Member
0 Kudos

Hi,

Innerjoin and database view basically does the same. JOin two tables based on a condition.

The difference is that the VIEW is defined in a permanent fashion in the dictionary and the innerjoin's life is within the program. After the program, the join's existence will not be there.

Regards,

Padmam.

Former Member
0 Kudos

Hi

view is maintained in se11 .

and if want to apply same condition b/w two tables most of times its better to create a vies and u can call in any program.

reward points to all helpful answers

kiran.M

Former Member
0 Kudos

Hi Gana,

What is a View ?

When you want to fetch data from one or more than one tables from the database, Views can be used. But once a view is created it resides permanently in the database memory for future usage. Also with a view creation it can be used to maintain data in the SM30 transaction when a table maintainence is created for a table. Before creating a view we need to be definite if it is of definite usage in the future.

What is a Inner join ?

When you want to fetch data from one or more than one tables from the database, only in a ABAP program Inner joins can be used. The inner join does the same thing as the view but it is available only in the run time of ABAP code execution.

<b>Difference between View and Inner Join</b>

<b>Inner Join:</b> Run time entity enable to join only Transparent Tables. As the no. of tables fopr the join increases the performace decreases as it occupies more meory and runtime. Also the code becomes complex.

<b>View:</b> A view is a permanent database entity. There is no restriction on the no. of tables. Any type of join can be written in the conditions tab. At run time in a ABAP code a view can be used with select statements as we do with tables.

<b>Types of Views:</b>

Database View: This is a view that can be used on to fetch data in the ABAP code to. Data about an application object is often distributed on several database tables. A database view provides an application-specific view on such distributed data. Database views are defined in the ABAP Dictionary. A database view is automatically created in the underlying database when it is activated. Application programs can access the data of a database view using the database interface. You can access the data in ABAP programs with both OPEN SQL and NATIVE SQL. However, the data is actually selected in the database. Since the join operation is executed in the database in this case, you can minimize the number of database accesses in this way. Database views implement an inner join

Projection View: Projection views are used to hide fields of a table. This can minimize interfaces; for example when you access the database, you only read and write the field contents actually needed. A projection view contains exactly one table. You cannot define selection conditions for projection views. There is no corresponding object in the database for a projection view. The R/3 System maps the access to a projection view to the corresponding access to its base table. You can also access pooled tables and cluster tables with a projection view.

Maintenance View: These views are created for the table maintainance for tables. Maintenance views offer easy ways to maintain complex application objects. Data distributed on several tables often forms a logical unit, for example an application object, for the user. You want to be able to display, modify and create the data of such an application object together. Normally the user is not interested in the technical implementation of the application object, that is in the distribution of the data on several tables. A maintenance view permits you to maintain the data of an application object together. The data is automatically distributed in the underlying database tables.

Search Help View: It is used for producing search helps. You have to create a help view if a view with outer join is needed as selection method of a search help. The selection method of a search help is either a table or a view. If you have to select data from several tables for the search help, you should generally use a database view as selection method. However, a database view always implements an inner join. If you need a view with outer join for the data selection, you have to use a help view as selection method.

R<b>eward Point if helpful</b>

Regards

Gokul

Former Member
0 Kudos

If a Database View already exist, use it instead of the inner joi statements.

If it doesn't, do not create the Database View. It makes no sesne to create a database view just because you need it in a program or 2.

And, if you have the same inner join being repeated for 8 times, for different where condition, I would rather sugget to select the data in only one inner-join select(With a where condition that would get al the records). Then you can read the internal table using READ or LOOP statements.