Application Development and Automation 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: 
Read only

Remove group by and sum using Itab

Former Member
0 Likes
609

Hello,

I am changing one report or performance problem.

It has a select clause on BKPF which is retrieving SUM (wrbtr ) AS wrbtr in the field list and USING group by 6-7 fields...

I want to remove this group by clause, take all records ( without sum ) into another internal table, sort it by these 6 fields ( will define them at the start of structure),

loop through it and then use AT NEW for these 6 fields and use collect for summing the wrbtr.

Will it be more efficient.? Data volume is very large.

Please advice.

Thanks,

Rupalee.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
575

Hi Rupali,

BKPF is not having field 'WRBTR'. Also just a suggestion, whenever you are fetching data from BKPF try using indexes in where condition if your condition includes the fields that have indexes. Also note that whenever you are using an index then include those fields in same sequence as mentioned in index. For example, if you want to fetch data based on Reference Transaction and Reference Key then in where condition put AWTYP first and then AWKEY. ( See index no. 4 when you click 'Indexes' button on Application toolbar. )

BKPF contains huge volume of data and if selection is based on primay key or indexes then searching will be much faster.

Regards,

Saba

Hello,

I am changing one report or performance problem.

It has a select clause on BKPF which is retrieving SUM (wrbtr ) AS wrbtr in the field list and USING group by 6-7 fields...

I want to remove this group by clause, take all records ( without sum ) into another internal table, sort it by these 6 fields ( will define them at the start of structure),

loop through it and then use AT NEW for these 6 fields and use collect for summing the wrbtr.

Will it be more efficient.? Data volume is very large.

Please advice.

Thanks,

Rupalee.

3 REPLIES 3
Read only

Former Member
0 Likes
575

BKPF does not have a field WRBTR.

Rob

Read only

Former Member
0 Likes
576

Hi Rupali,

BKPF is not having field 'WRBTR'. Also just a suggestion, whenever you are fetching data from BKPF try using indexes in where condition if your condition includes the fields that have indexes. Also note that whenever you are using an index then include those fields in same sequence as mentioned in index. For example, if you want to fetch data based on Reference Transaction and Reference Key then in where condition put AWTYP first and then AWKEY. ( See index no. 4 when you click 'Indexes' button on Application toolbar. )

BKPF contains huge volume of data and if selection is based on primay key or indexes then searching will be much faster.

Regards,

Saba

Read only

Former Member
0 Likes
575

ok