For all entries in abap

Folks,

When should we go for inner joins and when for all entries?? basic explanation is given below..

say if u want to display material and its text. u can use this concept.

 

~from the master table i’m selecting the materials based on the input s_matnr.

~then for the materials selected above , i have to get their corresponding description.

ie:

select matnr from mara into table i_matnr

where matnr in s_matnr.

 

if sy-subrc = 0.

select matnr maktx

from makt into table i_makt

for all entries in i_matnr

where matnr = i_mara-matnr.

endif.

This is similar to INNER JOIN concept. get the common data from 2 tables based on the input. Sometimes Join will give poor performance , n there u can use FOR ALL ENTRIES.

 

Joins have the advantage of linking two or more tables based on few of the conditions.However, there are a few disadvantages with same.

1) Duplicates are removed from the resulting set.Hence proper care has to be taken for the unique fields and keys that are used to determine the result.

2)If the resulting table is going to be very large, performace can be well affected.


   It is in this scenario , we use “for all entries“.The strategy would be to obtain the results for first table and based on the entries of first table, second table is filled and so on.But if the table on which the For All Entries IN clause is based is empty, all rows are selected into the destination table. Hence it is advisable to check before-hand that the first table is not empty. 

For more: http://help.sap.com/abapdocu_702/en/abenwhere_logexp_itab.htm

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s