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

performance

Former Member
0 Likes
1,255

hi all,

i'm working on payment report..

following query is taking lot of time...

LOOP AT it_rseg .

CLEAR it_temp.

CONCATENATE it_rseg-belnr it_rseg-gjahr INTO it_temp-temp.

APPEND it_temp.

SELECT belnr gjahr awkey

FROM bkpf

APPENDING TABLE it_bkpf

WHERE awkey EQ it_temp-temp.

ENDLOOP.

if i use select statement outside the loop,

even its takes more time...

please help me in reducing the time of execution..

regards

Suprith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,225

try to create index to that field in bkpf table.

that will help u ...........

Regards

Anbu

10 REPLIES 10
Read only

Former Member
0 Likes
1,225

Hi,

For sure you need to keep BKPF selection outside the loop.

Also I checked table RSEG and it has the fields BUKRS, BELNR and GJAHR. So instead of concatenating BELNR and GJAHR in a loop, directly use BUKRS, BELNR and GJAHR to get data from BKPF.

Use for all entries clause while fetching data from BKPF table.

This way you can avoid loop at all and time should reduce considerably.

Hope this helps!!!

Regards,

Lalit

Read only

Former Member
0 Likes
1,226

try to create index to that field in bkpf table.

that will help u ...........

Regards

Anbu

Read only

0 Likes
1,225

Hi,

Dont create Index on BKPF table for this issue. This may affect many other programs as well using BKPF table.

Even if you need to create get an approval from the client/Basis team.

Regards,

Lalit

Read only

megha_h
Participant
0 Likes
1,225

Hi Suprith,

Why dont you directly use the AWKEY in BKPF ? in that way you can avoid append it_temp in the loop.

Else,

LOOP AT it_rseg .

CLEAR it_temp.

CONCATENATE it_rseg-belnr it_rseg-gjahr INTO it_temp-temp.

APPEND it_temp.

ENDLOOP.

SELECT belnr gjahr awkey

FROM bkpf

APPENDING TABLE it_bkpf

FOR ALL ENTRIES IN it_temp

WHERE awkey EQ it_temp-temp.

Regards

Megha

Read only

Former Member
0 Likes
1,225

hi i can't use awkey directly... i've combine belnr + gjahr into temp, then i should pass

Read only

Former Member
0 Likes
1,225

Hi,

I dont understand why dont you use Belnr and GJAHR seprately to get data from BKPF.

That should fetch you the same thing.

Correct me if I am wrong.

Regards,

Lalit

Read only

Former Member
0 Likes
1,225

hi lalit...

i'm using rseg-belnr and rseg-gjahr this combination will give awkey...

bkpf-belnr and gjahr is different.. i'e i've to pass awkey to bkpf table where i'll get belnr and gjahr...

belnr & gjahr values will be different..

rseg <> bkpf

Read only

Former Member
0 Likes
1,225

Thanks Suprith for correcting me and I am sorry for suggesting some wrong solution.

Then may be you need to concatenate RSEG value in a seprate loop as you are doing right now and then after that use for all entries clause after the loop.

Regards,

Lalit

Read only

Former Member
0 Likes
1,225

Hi suprith ,

i think FOR ALL ENTRIES is a good option ....u jst fill your temp table ....and then use this table as a driver table WIth FOR ALL ENTRIES in SELECT statement . ....hope it will work better.

THANKS and REGARDS

Priyank

Read only

Former Member
0 Likes
1,225

Hi,

LOOP AT it_rseg .

CLEAR it_temp.

CONCATENATE it_rseg-belnr it_rseg-gjahr INTO it_temp-temp.

APPEND it_temp.

SELECT belnr gjahr awkey

FROM bkpf

APPENDING TABLE it_bkpf

WHERE awkey EQ it_temp-temp.

ENDLOOP.

1. APPEND inside a LOOP , will create a performance issue.

2. SELECT inside LOOP --> Use FOR ALL ENTRIES.