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: 

can you please help me to improve the performence of this query

Former Member
0 Kudos
  • Select All Invoices cleared between date range

SELECT bsak~prctr AS prfcntco

cepct~ktext AS prfcnttx

bsak~lifnr AS vendcode

lfa1~name1 AS vendname

bsak~bukrs AS compcode

t001~butxt AS compname

bsak~zterm AS paytrmco

tvzbt~vtext AS paytrmna

bsak~waers AS invcurre

bsak~zbd1t AS paydays1

bsak~belnr AS invnumbe

bsak~buzei AS invlinnu

bsak~wrbtr AS invamoun

bsak~budat AS invpstda

bsak~zfbdt AS invdueda

bsak~augdt AS invpayda

bsak~gjahr AS invfiscy

bsak~zlspr AS zlspr

t001~land1 AS land1

bsak~projk AS contract

rbkp~xblnr AS invsupnu

rbkp~bldat AS creadate

rbkp~cpudt AS cpudt

INTO CORRESPONDING FIELDS OF TABLE list_aux

FROM ( ( ( ( ( bsak INNER JOIN rbkp ON bsakbelnr = rbkpbelnr )

LEFT OUTER JOIN t001 ON bsakbukrs = t001bukrs )

LEFT OUTER JOIN lfa1 ON bsaklifnr = lfa1lifnr )

LEFT OUTER JOIN cepct ON bsakprctr = cepctprctr

AND cepct~spras = sy-langu )

LEFT OUTER JOIN tvzbt ON bsakzterm = tvzbtzterm

AND tvzbt~spras = sy-langu )

WHERE bsak~bukrs IN company AND

bsak~lifnr IN vendor AND

bsak~zterm IN payterm AND

bsak~augdt IN daterang AND

bsak~projk IN contract.

SELECT * FROM rseg

INTO TABLE it_rseg

FOR ALL ENTRIES IN list_aux

WHERE belnr = list_aux-invnumbe

AND buzei = list_aux-invlinnu

AND gjahr = list_aux-invfiscy.

SORT it_rseg BY belnr buzei gjahr ASCENDING.

2 REPLIES 2

ravi_lanjewar
Contributor
0 Kudos

Hi,

1) Don't join more than 2 table.

2) Read data from table bsak.

3) Use the for all entries for read data from RBKP, lfa1, list_aux

4) Read table t001 and cepct sepratelly.

5) Merge all data to single table as per your requirement.

Search In SDN before posting the blog.

Former Member
0 Kudos

Moderator message - Welcome to SCN Please see before posting in this forum. there are some things you need to take care of first. - post locked Please read [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again. Rob