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

need tip for performace

hallow

i wont option for this select for better perfomace (i haerd about up to 1 row but if i use it here i get the same results?)

SELECT SINGLE pspnr pbukr

FROM prps

INTO (project_type ,l_pbukr)

WHERE pspnr = ps_psp_pnr.

SELECT SINGLE waers

FROM t001

INTO l_waers

WHERE bukrs = l_pbukr.

Regards

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2007 at 02:05 PM

    Please use select up to 1 row if you do not have key field in where condition.

    <b>Here PRPS Table contains PSPNR is key field ,so you can use select single</b>SELECT SINGLE pspnr pbukr

    FROM prps

    INTO (project_type ,l_pbukr)

    WHERE pspnr = ps_psp_pnr.

    <b>Here BUKRS Is the key field ,so you can use Select single</b>SELECT SINGLE waers

    FROM t001

    INTO l_waers

    WHERE bukrs = l_pbukr.

    Thanks

    Seshu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2007 at 02:15 PM

    Hi

    As you all know, it is important to use as many key fields as possible in WHERE clauses of SELECT

    statements. Sometimes you are not sure about the value of some key

    fields. They seem to be empty (Initial value) but you are afraid to use this in your ABAP coding.

    Using the option GE (greater equal) in your coding can improve your performance considerably

    without the risk of table lines not being selected.

    Code

    REPORT ZZBM_SELECT_1 .

    TABLES: S001.

    CONSTANTS: SSOUR_INI LIKE S001-SSOUR VALUE IS INITIAL,

    VRSIO_INI LIKE S001-VRSIO VALUE IS INITIAL,

    SPMON_INI LIKE S001-SPMON VALUE IS INITIAL,

    SPTAG_INI LIKE S001-SPTAG VALUE IS INITIAL,

    SPWOC_INI LIKE S001-SPWOC VALUE IS INITIAL,

    SPBUP_INI LIKE S001-SPBUP VALUE IS INITIAL.

    DATA: TA_S001 TYPE STANDARD TABLE OF S001.

    DATA: WA_S001 TYPE S001.

    SELECT-OPTIONS:

    SO_SPTAG FOR S001-SPTAG OBLIGATORY,

    SO_KUNNR FOR S001-KUNNR OBLIGATORY,

    SO_VKORG FOR S001-VKORG OBLIGATORY,

    SO_VTWEG FOR S001-VTWEG OBLIGATORY,

    SO_SPART FOR S001-SPART OBLIGATORY,

    SO_MATNR FOR S001-MATNR OBLIGATORY.

    START-OF-SELECTION.

    SELECT * FROM S001

    INTO TABLE TA_S001

    WHERE SSOUR GE SSOUR_INI "Greater Equal initial value

    AND VRSIO GE VRSIO_INI " idem

    AND SPMON GE SPMON_INI " idem

    AND SPTAG IN SO_SPTAG

    AND SPWOC GE SPWOC_INI " idem

    AND SPBUP GE SPBUP_INI " idem

    AND KUNNR IN SO_KUNNR

    AND VKORG IN SO_VKORG

    AND VTWEG IN SO_VTWEG

    AND SPART IN SO_SPART

    AND MATNR IN SO_MATNR.

    and

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2007 at 02:05 PM

    the 2 select statements look perfectly ok ,

    make sure that they are not inside a loop ..endloop statements.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 29, 2007 at 02:10 PM

    Hi,

    Select Upto 1 Rows and the select single will not take that much of differecne in execution. but you need to maintain all the key fields in the where condition then the select will run perfectly

    SELECT pspnr pbukr

    FROM prps

    UP TO 1 ROWS

    INTO (project_type ,l_pbukr)

    WHERE pspnr = ps_psp_pnr.

    SELECT waers

    FROM t001

    UP TO 1 ROWS

    INTO l_waers

    WHERE bukrs = l_pbukr.

    Regards

    Sudheer

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 30, 2007 at 09:30 AM

    make sure that select statements are not in between loop endloop

    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.