Skip to Content
author's profile photo Former Member
Former Member

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

  • 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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Oct 13, 2010 at 01:03 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 01:10 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.