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: 

Using Views instead of tables

Former Member
0 Kudos
661

hi all

Using views instead of tables a good programming or not ?

1 ACCEPTED SOLUTION

Former Member
0 Kudos
308

A nested select is something different than a join. Nested selects = bad (uhm, usually... You can still use them if the amount of data you need is small and the tables you read from are small in size).

A join however, is not always worse than a view. When programmed right, a join can be just as fast. Actually a View is nothing else than a join.

If the dataset selected is small, there is no problem with a join. Personally I prefer NOT to create views... You will end up with a lot of views on the system which in itself will be confusing.

Personally I prefer to read data into an internal table, then use a second select with FOR ALL ENTRIES (If the amount of data selected is not too high).

Also, I only use a JOIN over a maximum of two tables. This is for maintenance reasons: having a JOIN over more tables will be difficult to read/understand.

It is not possible to say that Views (or joins and nested selects) are by default bad or not as good as another option. It all depends on the amount of data selected, the size of the tables you select from and the type of tables you select from...

When in doubt about performance, use multiple options and check the performance of each.

P.S. There is a really useful book from SAP about performance: SAP Performance Optimization Guide.

8 REPLIES 8

jj
Active Contributor
0 Kudos
308

View is an alternative to Joins and nested selects in programs.

Compared to nested selects , views are better.

Former Member
0 Kudos
308

So Can I create views for all the reports and use them for all the reports.

andreas_mann3
Active Contributor
0 Kudos
308

1st) look whether the view exists with se11

2nd) what's about logical database (LDB) - it could be an alternative (tcode se36)

A.

former_member233090
Active Contributor
0 Kudos
308

hi,

Since releASE 4.0, OPEN SQL allows both inner and outer table joins. A nested SELECT loop may be used to accomplish the same concept. However, the performance of nested SELECT loops is very poor in comparison to a join. Hence, to improve performance by a factor of 25x and reduce network load, you should either create a view in the data dictionary then use this view to select data, or code the select using a join.

cheers

Bhavana

0 Kudos
308

Creating Views newly for every report i do is suggestable ?

0 Kudos
308

Views in the ABAP Dictionary are implemented as inner joins. If the inner table contains no lines that correspond to lines in the outer table, no data is transferred. This is not always the desired result. For example, when you read data from a text table, you want to include lines in the selection even if the corresponding text does not exist in the required language. If you want to include all of the data from the outer table, you can program a left outer join in ABAP.

0 Kudos
308

Views in the ABAP Dictionary are implemented as inner joins. If the inner table contains no lines that correspond to lines in the outer table, no data is transferred. This is not always the desired result. For example, when you read data from a text table, you want to include lines in the selection even if the corresponding text does not exist in the required language. If you want to include all of the data from the outer table, you can program a left outer join in ABAP.

Former Member
0 Kudos
309

A nested select is something different than a join. Nested selects = bad (uhm, usually... You can still use them if the amount of data you need is small and the tables you read from are small in size).

A join however, is not always worse than a view. When programmed right, a join can be just as fast. Actually a View is nothing else than a join.

If the dataset selected is small, there is no problem with a join. Personally I prefer NOT to create views... You will end up with a lot of views on the system which in itself will be confusing.

Personally I prefer to read data into an internal table, then use a second select with FOR ALL ENTRIES (If the amount of data selected is not too high).

Also, I only use a JOIN over a maximum of two tables. This is for maintenance reasons: having a JOIN over more tables will be difficult to read/understand.

It is not possible to say that Views (or joins and nested selects) are by default bad or not as good as another option. It all depends on the amount of data selected, the size of the tables you select from and the type of tables you select from...

When in doubt about performance, use multiple options and check the performance of each.

P.S. There is a really useful book from SAP about performance: SAP Performance Optimization Guide.