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 tuning

Former Member
0 Likes
561

hi all ,

i have a piece of code in my program ,

is there any replacement for that to get good performannce .

SELECT b~mblnr

b~mjahr

b~bwart

b~matnr

b~menge

b~meins

b~dmbtr

b~bnbtr

b~kostl

b~ebeln

b~ebelp

FROM mkpf AS a INNER JOIN mseg AS b

ON amblnr = bmblnr

AND amjahr = bmjahr

INTO CORRESPONDING FIELDS OF TABLE ist_mseg

FOR ALL ENTRIES IN ist_mara

WHERE a~budat IN s_budat

AND b~matnr = ist_mara-matnr

AND b~bwart IN (c_bwart1, c_bwart2). "('101', '102' ) .

i mean is it good to use joins & for all entries in single query .

please let me know .

thanks in advance ,

regards ,

srinivas .

5 REPLIES 5
Read only

Former Member
0 Likes
533

hi,

what ever you try to do with mseg table

bseg and mseg always make performance issue.

if wont give any performance improvement

Make sure u r using the primary keys of mseg or any secondary indexes on the mseg table.

it may make some differences.

Regards,

priya.

Read only

Former Member
0 Likes
533

Hi,

To improve performance you can use cursors.

OPEN CURSOR: c1 FOR

  • SELECT matnr

  • satnr

  • matkl

  • zz_subclass

  • zz_subrand

  • zz_choice

  • attyp

  • zz_style

  • FROM mara

  • FOR ALL ENTRIES IN lt_art

  • WHERE satnr = lt_art-satnr

  • AND matkl <> ' '

  • AND ( mtart = 'FERT' OR mtart = 'HAWA' )

  • AND ( attyp = '02' OR attyp = '10')

  • AND mstae <> '17'

  • AND zz_subclass <> ' '

  • AND zz_style <> ' '

  • AND zz_choice <> ' '

  • AND zz_choiceid <> ' '.

*

  • DO .

  • FETCH NEXT CURSOR c1 INTO CORRESPONDING FIELDS OF gwa_mara_variant.

  • IF sy-subrc = 0.

  • APPEND gwa_mara_variant TO gt_mara_variant.

  • ELSE.

  • EXIT.

  • ENDIF.

  • ENDDO.

*

  • CLOSE CURSOR c1.

Reward if useful.

Regards

Susheel

Read only

Former Member
0 Likes
533

Hi,

Also check the order of fields in Selection and Where clause.. It should be in the same order as in original database table.

That also counts for performance improvement.

Read only

Former Member
0 Likes
533

Hi Srinivas,

When ever u use INNER JOIN u need to specify all the key fields in WHERE CONDITION.

If u are using any cluster tables its better to use all the key fields (primary index)and secondary index if any.

It would be better to use FOR ALL ENTRIES instead of JOINS.

some cases JOINS work better.

Please check this link

JOINS vs. FOR ALL ENTRIES - Which Performs Better

/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better

Best regards,

raam

Read only

Former Member
0 Likes
533

hi

well instead of using joins for perfrormance it is always recommended that u use for all entries in select statement

Cheers

snehi Chouhan