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

help me

Former Member
0 Likes
701

Hi.

am joining 2 tables to get the data its working good only thing is that its taking long time to execute , please tell me how reduce execution time .Please give me a code.

SELECT FSLNO FCUST FWERKS FMATNR FPURNO FPODATE FBILL FPRICE

FMEINS FQTY1 FQTY2 FQTY3 PNAME1 PORT01 INTO (it_zporder-SLNO,

it_zporder-CUST, it_zporder-WERKS, it_zporder-MATNR, it_zporder-PURNO,

it_zporder-PODATE, it_zporder-BILL, it_zporder-PRICE, it_zporder-MEINS,

it_zporder-QTY1, it_zporder-QTY2, it_zporder-QTY3, it_zporder-NAME1,

it_zporder-ORT01) from zporder as f inner join kna1 as p on f~cust =

pkunnr WHERE fmatnr IN s_matnr AND f~werks IN s_plant AND

f~cust IN s_cust AND

f~slno IN s_slno AND

f~price IN s_date.

append it_zporder.

ENDSELECT.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
671

Hi Prajwal,

You shud use two select stmt on both the table. when you can the data in two internal table. you can join them on the basis of kunnr and cust.

it will definately be fast then your join condition.

ne query ping me.

Regards

Azad.

5 REPLIES 5
Read only

Former Member
0 Likes
672

Hi Prajwal,

You shud use two select stmt on both the table. when you can the data in two internal table. you can join them on the basis of kunnr and cust.

it will definately be fast then your join condition.

ne query ping me.

Regards

Azad.

Read only

gopi_narendra
Active Contributor
0 Likes
671

Its always not suggested to use select and endselect.

To avoid this use the select <> into table it_tab format

for getting the records into table it_zporder in your case

SELECT F~SLNO F~CUST F~WERKS F~MATNR F~PURNO 
                       F~PODATE F~BILL F~PRICE F~MEINS F~QTY1 
                       F~QTY2 F~QTY3 P~NAME1 P~ORT01 
INTO corresponding fields of table it_zporder
from zporder as f inner join kna1 as p 
on f~cust = p~kunnr 
WHERE f~matnr IN s_matnr AND f~werks IN s_plant AND
             f~cust IN s_cust AND
             f~slno IN s_slno AND
             f~price IN s_date.

Regards

Gopi

Read only

0 Likes
671

thanks a lot.

but still its taking nearly a mint

Read only

0 Likes
671

Try to avoid INTO Corresponding fields. It will still improve the performance.

In this process make sure you follow the order of fields in the select query according to the order of fields in the table only.

Regards

Gopi

Read only

Former Member
0 Likes
671

data:

begin of fs_zporder,

SLNO like zporder-SLNO,

CUST like zporder-CUST,

WERKS like zporder-WERKS,

MATNR like zporder-MATNR,

PURNO like zporder-PURNO,

PODATE like zporder-PODATE,

BILL like zporder-BILL,

PRICE like zporder-PRICE,

MEINS like zporder-MEINS,

QTY1 like zporder-QTY1,

QTY2 like zporder-QTY2,

QTY3 like zporder-QTY3,

NAME1 like zporder-NAME1,

ORT01 like zporder-ORT01,

end of fs_zporder.

data: t_zporder like standard table of fs_zporder.

SELECT FSLNO FCUST FWERKS FMATNR FPURNO FPODATE FBILL FPRICE

FMEINS FQTY1 FQTY2 FQTY3 PNAME1 PORT01 INTO table t_zporder from zporder as f inner join kna1 as p on f~cust =

pkunnr WHERE fmatnr IN s_matnr AND f~werks IN s_plant AND

f~cust IN s_cust AND

f~slno IN s_slno AND

f~price IN s_date.

Change the necessary modifications.

Avoid using ENDSELECT.

Regards,

Pavan P.