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
857

Hi All,

I need to get the latest sales order number for Sold-to party and also for ship-to party. I am using VBPA table and fetching the latest sales order but it is taking lot of time.

I have created a index with KUNNR and PARVW in VBPA table but still it is doing a sequential read and taking time. Following is my code:

SELECT vbeln

FROM vbpa

INTO TABLE gt_vbak

WHERE kunnr EQ p_kunnr .

AND parvw EQ 'AG'.

I am sorting the table gt_vbak and getting the latest entry but it is very time consuming

or

SELECT max( vbeln )

FROM vbpa

INTO vbak-vbeln

WHERE kunnr EQ p_kunnr .

AND parvw EQ 'AG'.

Both statements are time consuming.

If any one knows if there is any better way or if there is any table or function module which gives the list of sales orders based on partner function please let me know.

Thanks in advance.

Sonali.

7 REPLIES 7
Read only

Former Member
0 Likes
820

Avoid 'EQ'. Instead use '='. Try using ODER BY in your clause.

A

Read only

0 Likes
820

There is no difference between = and EQ. This is from ABAP documentation for SQL conditions.

=, EQ True, if the content of col is the same as the content of f.

It is not very good to use ORDER BY because you transfer your load on your database. It is better to use SORT BY because this is done on the application server. Usually the DB is bottleneck, not the application servers.

Read only

Former Member
0 Likes
820

Hi,

Please try to add the primary key to the where condition even they don't used. You can make them as

VBELN in ( ) and POSNR in ( ).

Check it whether it is effective.

Best regards,

Chris.

Read only

Former Member
0 Likes
820

Hi,

Try to use some key fields with null value.....if possible can u try PACKAGE SIZE in select stmt....try it out....bcoz performance is d best possible guess only...

Thnx.

Read only

Former Member
0 Likes
820

Should use all primary key fileds in where condition

Read only

Former Member
0 Likes
820

Use all primary key in your select statement as due to indexing data fetching time would be reduced.

SELECT VBELN POSNR PARVW

FROM vbpa

INTO TABLE gt_vbak

WHERE kunnr EQ p_kunnr .

AND parvw EQ 'AG'.

Reward if usefull,

Thanks.

Read only

kiran_k8
Active Contributor
0 Likes
820

Sonali,

Check the SAP Notes 185530.It may give you some lead regarding improving performance in SD Developments.

K.Kiran.