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: 

need tip for performace

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos

the 2 select statements look perfectly ok ,

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

make sure that select statements are not in between loop endloop