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

urgent -performance

Former Member
0 Likes
1,351

select amblnr amjahr azeile amatnr alifnr aebeln

awerks amenge

b~budat

from mseg as a join mkpf as b on amblnr = bmblnr

and amjahr = bmjahr

into corresponding fields of table it_mseg

for all entries in it_vbap

where a~werks = p_werks

and a~bwart = '122'

and b~budat in s_budat

and a~matnr = it_vbap-matnr

and a~werks = it_vbap-werks.

endif.

can any one give alternate for this.........plz

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,328

hi,

IF NOT i_mara[] IS INITIAL.

SELECT mblnr " Material document

mjahr " Material doc. year

zeile " Item in material document

bwart " Movement type

matnr " Material number

werks " Plant

shkzg " Credit/Debit indicator

dmbtr " Amount in loc. currency

menge " Quantity

FROM mseg

INTO TABLE i_mseg

FOR ALL ENTRIES IN i_mara

WHERE matnr EQ i_mara-matnr

AND werks EQ p_werks

AND lgort IN r_lgort

AND bwart IN r_bwart

AND sobkz IN r_sobkz.

This uses secondary index on mseg table......

when u select more records... u program performance goes down....

No alternate for mseg table , I have tried a lot but no answers from any one...

try to improve performance on the other part of ur program...

Regards,

Priya

select amblnr amjahr azeile amatnr alifnr aebeln

awerks amenge

b~budat

from mseg as a join mkpf as b on amblnr = bmblnr

and amjahr = bmjahr

into corresponding fields of table it_mseg

for all entries in it_vbap

where a~werks = p_werks

and a~bwart = '122'

and b~budat in s_budat

and a~matnr = it_vbap-matnr

and a~werks = it_vbap-werks.

endif.

can any one give alternate for this.........plz

11 REPLIES 11
Read only

Former Member
0 Likes
1,329

hi,

IF NOT i_mara[] IS INITIAL.

SELECT mblnr " Material document

mjahr " Material doc. year

zeile " Item in material document

bwart " Movement type

matnr " Material number

werks " Plant

shkzg " Credit/Debit indicator

dmbtr " Amount in loc. currency

menge " Quantity

FROM mseg

INTO TABLE i_mseg

FOR ALL ENTRIES IN i_mara

WHERE matnr EQ i_mara-matnr

AND werks EQ p_werks

AND lgort IN r_lgort

AND bwart IN r_bwart

AND sobkz IN r_sobkz.

This uses secondary index on mseg table......

when u select more records... u program performance goes down....

No alternate for mseg table , I have tried a lot but no answers from any one...

try to improve performance on the other part of ur program...

Regards,

Priya

Read only

Former Member
0 Likes
1,328

hi,

1. avoid into corresponding

2. split the join. first fetch the data from mseg. then based on the mblnr, mjahr and s_budat fetch the data from mkpf.

3. try to populate a range table for all werks put together.

regards,

madhu

Read only

0 Likes
1,328

hi

thanks.. today my first day of work... can u help me to optimize if i send u my program..plz plz...

Read only

0 Likes
1,328

Hi meena...

Your total Select Query is incorrect Could You tell Wht You need do actually...

regards,

sg.

Read only

Former Member
0 Likes
1,328

Hi,

You can create a database view with this two tables and than select data from this view.

For my case and with this same tables, worked fine.

Regards,

Fernando

Read only

Former Member
0 Likes
1,328

if not it_vbap[] is initial.

select amblnr amjahr azeile amatnr alifnr aebeln

awerks amenge b~budat

into corresponding fields of table it_mseg

from mseg as a

inner join mkpf as b on amblnr = bmblnr

and amjahr = bmjahr

for all entries in it_vbap

where a~werks = p_werks

and a~bwart = '122'

and b~budat in s_budat

and a~matnr = it_vbap-matnr

and a~werks = it_vbap-werks.

endif.

This could correct but I suggest You not to Hard Code Movement type and try to declare a type wht Fields You need.

Regards,

sg.

Read only

0 Likes
1,328

Hi ..

thanks ..its vendor performance report. it takes 20 hrs to run. i need to optimize...

i tried to run but its not showing any output... how to check..

Read only

0 Likes
1,328

Hi Meena,

Is only this Select query You are Using in your whole program, the better way to check is ...try to select the data separetly from one one table using For all entries then you wil come to know whether the data is selecting or not.

Try out..

regards,

sg.

Read only

0 Likes
1,328

Hi ..

1. Get the index of each table.

2. Used the field order selection from top to bottom if no table

index created in each table.

3. Select to table consuidering the foreign key first before

secondary.

Try out this...

if not it_vbap[] is initial.

select amblnr amjahr azeile amatnr alifnr aebeln awerks amenge b~budat

into table it_mseg

from mseg as a

inner join mkpf as b

on amandt = bmandt

and amblnr = bmblnr

and amjahr = bmjahr

for all entries in it_vbap

where a~werks = p_werks

and a~bwart = '122'

and b~budat in s_budat

and a~matnr = it_vbap-matnr

and a~werks = it_vbap-werks.

endif.

regards,

sg

Read only

Former Member
0 Likes
1,328

Hi Meena,

One quick question, have you limited the data going into the select? I noticed that your for all entries table implies it's from VBAP (it_vbap) which could contain many entries for the same material/plant combinations.

Have you limited this table (or a subset) to contain only a SINGLE entry for each material/plant code?

(Just a thought).

Good luck with your tuning effort.

Andy

Read only

former_member251078
Participant
0 Likes
1,328

Hi,

MSEG

-


MANDT

MATNR

WERKS

BWART

MKPF

-


MANDT

BUDAT

If there is no index exists on the above fields, please create secondary index for the

above tables for improving the performance.

Please create histograms for tables MKPF and MSEG tables as mentioned in SAP Notes 902675 and 921164.

Also please ensure you have the value 5 for the following parameters.

rsdb/max_blocking_factor

rsdb/min_in_blocking_factor

Hope this helps

Regards

Dileep