‎2008 Jul 15 11:38 AM
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
‎2008 Jul 15 11:46 AM
try to create index to that field in bkpf table.
that will help u ...........
Regards
Anbu
‎2008 Jul 15 11:43 AM
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
‎2008 Jul 15 11:46 AM
try to create index to that field in bkpf table.
that will help u ...........
Regards
Anbu
‎2008 Jul 15 12:19 PM
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
‎2008 Jul 15 11:46 AM
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
‎2008 Jul 15 12:31 PM
hi i can't use awkey directly... i've combine belnr + gjahr into temp, then i should pass
‎2008 Jul 15 12:35 PM
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
‎2008 Jul 15 12:43 PM
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
‎2008 Jul 15 12:49 PM
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
‎2008 Jul 15 11:49 AM
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
‎2008 Jul 15 11:54 AM
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.