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: 

Why shall we go for views?

Former Member
0 Kudos

What are the situations where we can go for views instead of joins and why?

Regards,

MD.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi MD,

Views are motly advisable to use regarding the performance issue.

Joins reduce the performance because it takes lot of time to retrieve the data.

Its advisable not to use JOINS for more than 2 or 3 tables. 2 tables itself would reduce the performance.

Instead, use for all entries and you can sort the table and use the Read..table to read the entries.

If you are using FOR ALL ENTRIES and need to exclude some entries, then instead of using the Negative stmts like , >=, <= , select all entries and then you can delete the entries which do not match your criteria from the internal table.

Inner Join VS Outer Join:

TABEL1 inner join TABLE2:

only entries found in TABLE1 and TABLE2 are the result.

TABEL1 outher join TABLE2:

all entries found in TABLE1 and, if found the corresponding data from TABLE2 are the result.

For inner and outer join see the below thread:

Views : Data about an application object is often distributed on several tables. By defining a view, you can define an application-dependent view that combines this data. The structure of such a view is defined by specifying the tables and fields used in the view. Fields that are not required can be hidden, thereby minimizing interfaces. A view can be used in ABAP programs for data selection.

For View see the below thread:

Reward Points if Useful

4 REPLIES 4

Former Member
0 Kudos

Hi MD,

Views are motly advisable to use regarding the performance issue.

Joins reduce the performance because it takes lot of time to retrieve the data.

Its advisable not to use JOINS for more than 2 or 3 tables. 2 tables itself would reduce the performance.

Instead, use for all entries and you can sort the table and use the Read..table to read the entries.

If you are using FOR ALL ENTRIES and need to exclude some entries, then instead of using the Negative stmts like , >=, <= , select all entries and then you can delete the entries which do not match your criteria from the internal table.

Inner Join VS Outer Join:

TABEL1 inner join TABLE2:

only entries found in TABLE1 and TABLE2 are the result.

TABEL1 outher join TABLE2:

all entries found in TABLE1 and, if found the corresponding data from TABLE2 are the result.

For inner and outer join see the below thread:

Views : Data about an application object is often distributed on several tables. By defining a view, you can define an application-dependent view that combines this data. The structure of such a view is defined by specifying the tables and fields used in the view. Fields that are not required can be hidden, thereby minimizing interfaces. A view can be used in ABAP programs for data selection.

For View see the below thread:

Reward Points if Useful

Former Member
0 Kudos

SAP standard views will be there to reterive data from the Tables.

If you want to create any views make sure that sap standard related views are not there to reterive the data.

We will use views for more performance...

Allot points if it helps

Regards,

Shiva Kumar

Former Member
0 Kudos

Hi,

Please refer the thread belows,

Best Regards.

  • Reward points if it is helpful.

Former Member
0 Kudos

Hi Friend,

Views are faster than Database Joins.

Because Views are cached by application servers, joins are always accessed by database directly.

Since the views are cached by App server, then the next request for this same info will certainly be faster.

When we go for Views ?

VIEWS behave like reuseable data objects. Other developers no longer need to know the details of numerous tables to combine data between them.

JOINS are standalone SQL statements. They have no formal reuseability.

Example : If you are going to use a specific join and this will be used by your entire team, I would rather create a view and use the view rather than using the join every time, it becomes a reusable component, right?

Hope this helps.

Regards

Hemant Khemani