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 issue

Former Member
0 Likes
957

Moderator message: please try to use a more meaningful subject for your questions in future. Thank-you

Hi friends,

In loop there is select single statement is there i have to improve the performance of this statement

please anybody answer this question.

LOOP AT i_keytab.

SELECT SINGLE

perio

belnr

bukrs

werks

kstar

prctr

ktgrm

ww008

paph4

ww013

vbund

ww012

vv002

vv003

vv004

vv005

vv006

vv007

vv009

vv010

vv011

vv012

vv013

vv014

vv015

vv016

vv017

vv019

vv021

vv022

vv023

vv024

vv025

vv026

vv027

vv028

vv029

vv030

vv031

vv032

vv033

vv034

vv035

vv036

vv037

vv038

vv039

vv040

vv041

vv042

vv043

vv044

vv045

vv046

vv047

vv048

vv049

vv050

vv051

vv052

vv053

vv054

vv055

vv056

vv057

vv058

vv059

vv060

vv061

vv062

vv063

vv064

vv065

vv066

vv067

vv068

vv069

vv070

vv071

vv073

vv074

vv077

vv078

vv079

vv080

vv081

vv082

vv083

vv084

vvz01

vvz02

vvz03

vv090

vv091

vv092

vv093

vv094

vv109

vv110

vv117

vv118

vv111

vv112

vv113

vv114

vv115

vv116

ww001

ww020

INTO CORRESPONDING FIELDS OF i_tab

FROM ce12000

WHERE paledger = i_keytab-paledger

AND vrgar = i_keytab-vrgar

AND versi = i_keytab-versi

AND perio = i_keytab-perio

AND paobjnr = i_keytab-paobjnr

AND pasubnr = i_keytab-pasubnr

AND belnr = i_keytab-belnr

AND posnr = i_keytab-posnr.

endloop.

Edited by: Matt on Nov 11, 2008 4:57 PM

6 REPLIES 6
Read only

matt
Active Contributor
0 Likes
813

Read the ABAP help on FOR ALL ENTRIES. Or use a join.

Read only

former_member585060
Active Contributor
0 Likes
813

Hi,

Use FOR ALL ENTRIES

Try this one

SELECT

perio

belnr

bukrs

werks

kstar

prctr

ktgrm

ww008

paph4

ww013

vbund

ww012

vv002

vv003

vv004

vv005

vv006

vv007

vv009

vv010

vv011

vv012

vv013

vv014

vv015

vv016

vv017

vv019

vv021

vv022

vv023

vv024

vv025

vv026

vv027

vv028

vv029

vv030

vv031

vv032

vv033

vv034

vv035

vv036

vv037

vv038

vv039

vv040

vv041

vv042

vv043

vv044

vv045

vv046

vv047

vv048

vv049

vv050

vv051

vv052

vv053

vv054

vv055

vv056

vv057

vv058

vv059

vv060

vv061

vv062

vv063

vv064

vv065

vv066

vv067

vv068

vv069

vv070

vv071

vv073

vv074

vv077

vv078

vv079

vv080

vv081

vv082

vv083

vv084

vvz01

vvz02

vvz03

vv090

vv091

vv092

vv093

vv094

vv109

vv110

vv117

vv118

vv111

vv112

vv113

vv114

vv115

vv116

ww001

ww020

INTO CORRESPONDING FIELDS OF TABLE i_tab

FROM ce12000 FOR ALL ENTRIES IN i_keytab

WHERE paledger = i_keytab-paledger

AND vrgar = i_keytab-vrgar

AND versi = i_keytab-versi

AND perio = i_keytab-perio

AND paobjnr = i_keytab-paobjnr

AND pasubnr = i_keytab-pasubnr

AND belnr = i_keytab-belnr

AND posnr = i_keytab-posnr.

Regards

Bala Krishna.

Read only

Former Member
0 Likes
813

Use a 'FOR ALL ENTRIES' statement instead of using a select single within a loop.

Regards,

SAPient.

Read only

Former Member
0 Likes
813

Hi,

U can write the Select Statement out side the loop and "Read" that internal table inside the loop.

Read only

Former Member
0 Likes
813

Hi,

move the select out of the loop statement and use for all entries

Use select * into corresponding fields...

Shruthi

Read only

Former Member
0 Likes
813

Hi Santosh,

For this issue two things keep in mind.

1.Never use select statement inside a loop. Use 'FOR ALL ENTERIES' in your select statement outside the loop.

2. Do not use INTO CORRESPONDING FIELDS in select statement.When you are using all the fields name then no need to use this.Declare all the selected fields in the internal table I_KEYTAB in the same order as in the select statement.

your code should be like this.

SELECT

perio

belnr

bukrs

werks

kstar

prctr

ktgrm

ww008

paph4

ww013

vbund

ww012

vv002

vv003

vv004

vv005

vv006

vv007

vv009

vv010

vv011

vv012

vv013

vv014

vv015

vv016

vv017

vv019

vv021

vv022

vv023

vv024

vv025

vv026

vv027

vv028

vv029

vv030

vv031

vv032

vv033

vv034

vv035

vv036

vv037

vv038

vv039

vv040

vv041

vv042

vv043

vv044

vv045

vv046

vv047

vv048

vv049

vv050

vv051

vv052

vv053

vv054

vv055

vv056

vv057

vv058

vv059

vv060

vv061

vv062

vv063

vv064

vv065

vv066

vv067

vv068

vv069

vv070

vv071

vv073

vv074

vv077

vv078

vv079

vv080

vv081

vv082

vv083

vv084

vvz01

vvz02

vvz03

vv090

vv091

vv092

vv093

vv094

vv109

vv110

vv117

vv118

vv111

vv112

vv113

vv114

vv115

vv116

ww001

ww020

INTO TABLE i_tab

FROM ce12000

FOR ALL ENTRIES IN TABLE i_keytab

WHERE paledger = i_keytab-paledger

AND vrgar = i_keytab-vrgar

AND versi = i_keytab-versi

AND perio = i_keytab-perio

AND paobjnr = i_keytab-paobjnr

AND pasubnr = i_keytab-pasubnr

AND belnr = i_keytab-belnr

AND posnr = i_keytab-posnr.

I hope this would help you.

Regards,

Amit