Application Development 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: 

Performace Issue

Former Member
0 Kudos

hi all,

below code is taking a lot of time in prod server.

can any help me to optimize this code.

SELECT amatnr aersda

bwerks bdispo bmatnr beisbe b~mmsta

c~maktx

INTO CORRESPONDING FIELDS OF TABLE it_matl

FROM ( mara AS a INNER JOIN marc AS b

ON amatnr = bmatnr )

INNER JOIN makt AS c

ON bmatnr = cmatnr

WHERE a~matnr IN s_matnr

AND b~werks IN s_werks

AND mtart EQ 'UNBW'

AND mmsta NE '98'

AND b~dispo IN s_dispo

AND b~kzaus EQ ' '

AND c~spras EQ sy-langu.

regards,

raghu

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this:

INTO CORRESPONDING FIELDS OF TABLE it_matl

Remove Into Corresponding fields of..by chnging the Internal Table Structure....

AND mmsta NE '98'

Replace NE by a suitable condition..

AND b~kzaus EQ ' '

Use keyword SPACE....

Anyway...your Query is having PK MATNR in the where and hence should not take a lot of time......is the number of Materials satisfying this QUERY are a lot in numbers?????

14 REPLIES 14

former_member156446
Active Contributor
0 Kudos
SELECT a~matnr a~ersda
b~werks b~dispo b~matnr b~eisbe b~mmsta
c~maktx
INTO CORRESPONDING FIELDS OF TABLE it_matl "try to remove into corresponding by giving all the field in the same sequence as in structure of it_matl.
FROM ( mara AS a INNER JOIN marc AS b
ON a~matnr = b~matnr )
INNER JOIN makt AS c
ON b~matnr = c~matnr
WHERE a~matnr IN s_matnr
AND b~werks IN s_werks
AND mtart EQ 'UNBW'
AND mmsta NE '98'
AND b~dispo IN s_dispo
AND b~kzaus EQ ' '
AND c~spras EQ sy-langu.

Former Member
0 Kudos

Hi,

This should goto the Forum for Peformance Tunning......

Former Member
0 Kudos

thanks for the reply,

but if i remove move corresponding then its giving a dump error.

regards,

raghu

0 Kudos

why are u selecting matnr twice? If you use matnr for join then you have duplicated value ...

SELECT amatnr aersda

bwerks bdispo bmatnr beisbe b~mmsta

c~maktx

To not have dump you have to have structure of your internal table the same as listed fields in select statement (same order and not more or less than listed...)

Then also check the order of the fields in where condition if are matching order in indeces. If not correct that.

Regards,

Karol

0 Kudos

its going to dump bcoz ur internal table structure and the sequence of fields in select stmt is not the same.

0 Kudos

Hi,

Before removing the Into Corresponding fields.....you need to change your Internal Table strucutre......you can only have those fields in same order...which u r fetching from SELECT....

Former Member
0 Kudos

Is s_matnr empty??

Rob

Former Member
0 Kudos

Hi,

Try this:

INTO CORRESPONDING FIELDS OF TABLE it_matl

Remove Into Corresponding fields of..by chnging the Internal Table Structure....

AND mmsta NE '98'

Replace NE by a suitable condition..

AND b~kzaus EQ ' '

Use keyword SPACE....

Anyway...your Query is having PK MATNR in the where and hence should not take a lot of time......is the number of Materials satisfying this QUERY are a lot in numbers?????

Former Member
0 Kudos

hi rob and ajay ,

let me create a separate structure and see as you say.

and the field s_matnr is not initial.

regards,

raghu

0 Kudos

>

> and the field s_matnr is not initial.

OK - what does it look like? Is a large range being used?

Rob

Former Member
0 Kudos
INTO CORRESPONDING FIELDS OF TABLE it_matl

is not a performance problem.

Rob

Former Member
0 Kudos

Are you sure the problem is with the select statement? I've tried it in my system with 40K materials and it takes a couple of seconds. Is the select in a loop perhaps? Or do you have a truly huge number of matnr/werks/dispo?

Former Member
0 Kudos

first declare it_mat1 as

data: begin of it_mat1,

matnr type....

ersda

werks

dispo

matnr

eisbe

mmsta

maktx

end of it_mat1.

SELECT amatnr aersda bwerks bdispo bmatnr beisbe bmmsta cmaktx

INTO TABLE it_matl

FROM ( mara AS a INNER JOIN marc AS b

ON amatnr = bmatnr )

INNER JOIN makt AS c

ON amatnr = cmatnr

WHERE a~matnr IN s_matnr

AND b~werks IN s_werks

AND mtart EQ 'UNBW'

AND mmsta NE '98'

AND b~dispo IN s_dispo

AND b~kzaus EQ ' '

AND c~spras EQ sy-langu.

Former Member
0 Kudos

before that have a check that s_matnr is not initial...